From patchwork Fri Mar 6 22:37:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1250647 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=FHboh9xh; 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 48Z2Yq17YPz9sPR for ; Sat, 7 Mar 2020 09:37:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 35AFE22926; Fri, 6 Mar 2020 22:37:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TSVL8o-PTSAP; Fri, 6 Mar 2020 22:37:29 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 4AFA122902; Fri, 6 Mar 2020 22:37:29 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3202CC18DA; Fri, 6 Mar 2020 22:37:29 +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 66476C013E for ; Fri, 6 Mar 2020 22:37:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 51AE188400 for ; Fri, 6 Mar 2020 22:37:27 +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 thDTPXlg-fC7 for ; Fri, 6 Mar 2020 22:37: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 hemlock.osuosl.org (Postfix) with ESMTPS id 52BCB87DDB for ; Fri, 6 Mar 2020 22:37:26 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id y26so1779768pfn.11 for ; Fri, 06 Mar 2020 14:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WcrQbVxQi2XHMM1HuYNbIk5LiiKj4Kz9eiTrd8xt4TU=; b=FHboh9xhrNdowhu7J/mBLR9MdFcoM15E+ktydspNPagildqJeQgBceAeBa+bWjORuu /bBzJX20MeWYmWyiu1kvhXB5PWZybqsfGPQx50GhAgdpjzoHtLiKXKGefxP+wxkB90fm FduBsCL3ZcfYR+mo57Yvk/v/CadcHmS3y+bjqAJid+ybkeIB9DjpoRYgkzFxw0CuAC2k 2Dk3k68RByENlDpH00Vhm4qMSDzIV55beoTuaOKXNf4pebl/gZ5k2m0L+fy+HQHN/yvW yDlm1lxU0cI57FkJFXD/KTXKVig9NxPeVT9zBfB7VTJ6cWuGla1QioitWlo5RQIs3aU/ SiZA== 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=WcrQbVxQi2XHMM1HuYNbIk5LiiKj4Kz9eiTrd8xt4TU=; b=YaBaVeFgkgJ1DbWOJQQTzPNW1vVPWwfsNrPCxjhsbr2Iz0hfMn/iOfuJ9gUST1nmwj /mEN08WeBf0tCkXRHhUB/HaZg+jL1VRhhC0iEHgxs+XiYDaM/jAQLQlu8Rc4xN1VUpQi zNPIIQal/vbNrKZMgE7nAlaiBcgpr2HBSgsWuZkmgiqHmTa3jyNyuPrxYiY+mkjsFS2m EXZD8scEHB5n1j7RxJTx2PM/SK29JAkGTdrquAk6LbM71iTWKO3wUmj6+6GYlElK/+1B D1hLjDnij9yQvvJZiGPmXnJo9blwZj1AWDXibbl9X1/2b3OvSAX1t8pjBhtqyZUbWTC0 gP2g== X-Gm-Message-State: ANhLgQ0hnYWMnUJm+AQfiBoRaxkYi0wSjgjLok7VrSzMDbjnZWaWzzSt sw2/XcO0RmbJnK9is4vk3NxX4DW6Hq0= X-Google-Smtp-Source: ADFU+vv6bADiX6Isn4AqOJ5o7sDSKm67QzPsmEy3GZODQCWDnN1G+h4cJKJlpIBMOiQZP0RZg5g06w== X-Received: by 2002:aa7:8b03:: with SMTP id f3mr6018939pfd.133.1583534245629; Fri, 06 Mar 2020 14:37:25 -0800 (PST) Received: from gizo.domain (97-115-106-43.ptld.qwest.net. [97.115.106.43]) by smtp.gmail.com with ESMTPSA id k3sm35939602pgh.34.2020.03.06.14.37.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2020 14:37:25 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 6 Mar 2020 14:37:13 -0800 Message-Id: <1583534241-16600-2-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> References: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 1/9] acinclude: Enable Linux kernel 5.5 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" Acked-by: Yi-Hung Wei Signed-off-by: Greg Rose --- V4 - Fix up the error message indicating that kernels greater than 5.5 are not supported. --- acinclude.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 9338af9..03d3484 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -151,10 +151,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [ AC_MSG_RESULT([$kversion]) if test "$version" -ge 5; then - if test "$version" = 5 && test "$patchlevel" -le 0; then + if test "$version" = 5 && test "$patchlevel" -le 5; then : # Linux 5.x else - AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 5.0.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.5.x is not supported (please refer to the FAQ for advice)]) fi elif test "$version" = 4; then : # Linux 4.x From patchwork Fri Mar 6 22:37:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1250646 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=TnZqA/kq; 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 48Z2Yp0RZ5z9sPJ for ; Sat, 7 Mar 2020 09:37:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5242B86F50; Fri, 6 Mar 2020 22:37:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eeSuBFht_rhE; Fri, 6 Mar 2020 22:37:29 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id DAD6B86F57; Fri, 6 Mar 2020 22:37:29 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D2AD2C1D8E; Fri, 6 Mar 2020 22:37:29 +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 95BEFC013E for ; Fri, 6 Mar 2020 22:37:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 84320228F1 for ; Fri, 6 Mar 2020 22:37: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 uAwW4-nBSHrm for ; Fri, 6 Mar 2020 22:37:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by silver.osuosl.org (Postfix) with ESMTPS id 8A7BB22816 for ; Fri, 6 Mar 2020 22:37:27 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id d8so1685631pje.4 for ; Fri, 06 Mar 2020 14:37:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nFgS2xvboQiozga+zEWc9O0n1XvJItJd+Qxtg+rRGfM=; b=TnZqA/kqz4R5zYwCbxnxzC0DotoGicWB9RBRAEK1KoLrhvG6uedDg6x9FlFlpBQlCc wSQRe+K6MpJG1mzWaHbP0KPAlRRipw6V5rO58vVV89HWTe3fxyEfpdwsqZzH2PbrEnX7 qx5uJokhivHClRY0Cy7nBf77HaigMFCZdPRxAIYCzA3YT/D5FGd7YVcfXnzZh6v9LAe/ PgfiMLTWjWKwnJCyEveuj6ZkWzM7Hp1eYZYZnDusJujghu07Z4cKuQV5d5EpFmSrLoDx /OW/q5Sb+33qSd9hu60vgCndbRd3Zs/SRRae962u/XRq6ho9oATmuBaXSAnYWPsWnDHm G6Uw== 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=nFgS2xvboQiozga+zEWc9O0n1XvJItJd+Qxtg+rRGfM=; b=jbnofdrNCnGDQRIM0FjsPEVFR75s85Ubdzc2wuRBn4X/TZYIF/ltZGIZaZkOQR3KsN AcddlsD6Z1gven41VUGLq7POKLP38qx1hZ2I1t3Kft39Lphn7wVb6i+Efc2Sx19vDZaN 1YVjZLBHTXcXkPyTBosth3JmpZ365AHLFUIsbaLMm8HQwnVUViy2/xT+j9qGTwOIbowy vIX5hOdBu/y83W42xCN3fWft2bPCQk7rq9Df+ki6KA5fuYmB3JVEJKxZPz9kce1jGrpj LrVHoZmG5viD+9mFIxmcMG2jpMxDsSXYeF1K9HximYn+sl3wWURFLKce4jeMbpTqrdwN dgcw== X-Gm-Message-State: ANhLgQ2cjw5vszV9jgnm+4fIkk36ybPIXGPyVvzHEgz8GJq4CcGqImTT BWE1cw/1NrLSZ5wCD3YZcn55zgkZ66U= X-Google-Smtp-Source: ADFU+vuUfvfyo0l9IJY5e16awq4Kn+dL0H/7q5iztG2BQBKfpNEJINrFD3WulOVsMQov8qZ+V4IzLg== X-Received: by 2002:a17:90b:8c9:: with SMTP id ds9mr5972083pjb.11.1583534246658; Fri, 06 Mar 2020 14:37:26 -0800 (PST) Received: from gizo.domain (97-115-106-43.ptld.qwest.net. [97.115.106.43]) by smtp.gmail.com with ESMTPSA id k3sm35939602pgh.34.2020.03.06.14.37.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2020 14:37:26 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 6 Mar 2020 14:37:14 -0800 Message-Id: <1583534241-16600-3-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> References: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 2/9] compat: Fix up changes to inet frags in 5.1+ 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" Since Linux kernel release 5.1 the fragments field of the inet_frag_queue structure is removed and now only the rb_fragments structure with an rb_node pointer is used for both ipv4 and ipv6. In addition, the atomic_sub and atomic_add functions are replaced with their equivalent long counterparts. Acked-by: Yi-Hung Wei Signed-off-by: Greg Rose --- V3 - Use HAVE_CORRECT_MRU_HANDLING instead of less reliable kernel version check for compile time handling of the rb_fragments change. --- acinclude.m4 | 2 ++ datapath/linux/compat/include/net/inet_frag.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 03d3484..3a555ad 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1048,6 +1048,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [OVS_DEFINE([HAVE_RBTREE_RB_LINK_NODE_RCU])]) OVS_GREP_IFELSE([$KSRC/include/net/dst_ops.h], [bool confirm_neigh], [OVS_DEFINE([HAVE_DST_OPS_CONFIRM_NEIGH])]) + OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [fqdir], + [OVS_DEFINE([HAVE_INET_FRAG_FQDIR])]) if cmp -s datapath/linux/kcompat.h.new \ datapath/linux/kcompat.h >/dev/null 2>&1; then diff --git a/datapath/linux/compat/include/net/inet_frag.h b/datapath/linux/compat/include/net/inet_frag.h index 124c8be..00784da 100644 --- a/datapath/linux/compat/include/net/inet_frag.h +++ b/datapath/linux/compat/include/net/inet_frag.h @@ -12,6 +12,7 @@ #define qp_flags(qp) (qp->q.flags) #endif +#ifndef HAVE_CORRECT_MRU_HANDLING #ifndef HAVE_INET_FRAG_EVICTING static inline bool inet_frag_evicting(struct inet_frag_queue *q) { @@ -22,6 +23,7 @@ static inline bool inet_frag_evicting(struct inet_frag_queue *q) #endif /* HAVE_INET_FRAG_QUEUE_WITH_LIST_EVICTOR */ } #endif /* HAVE_INET_FRAG_EVICTING */ +#endif /* HAVE_CORRECT_MRU_HANDLING */ /* Upstream commit 3fd588eb90bf ("inet: frag: remove lru list") dropped this * function, but we call it from our compat code. Provide a noop version. */ @@ -29,6 +31,10 @@ static inline bool inet_frag_evicting(struct inet_frag_queue *q) #define inet_frag_lru_move(q) #endif +#ifdef HAVE_INET_FRAG_FQDIR +#define netns_frags fqdir +#endif + #ifndef HAVE_SUB_FRAG_MEM_LIMIT_ARG_STRUCT_NETNS_FRAGS #ifdef HAVE_FRAG_PERCPU_COUNTER_BATCH static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i) @@ -45,13 +51,21 @@ static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i) #else /* !frag_percpu_counter_batch */ static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i) { +#ifdef HAVE_INET_FRAG_FQDIR + atomic_long_sub(i, &nf->mem); +#else atomic_sub(i, &nf->mem); +#endif } #define sub_frag_mem_limit rpl_sub_frag_mem_limit static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i) { +#ifdef HAVE_INET_FRAG_FQDIR + atomic_long_add(i, &nf->mem); +#else atomic_add(i, &nf->mem); +#endif } #define add_frag_mem_limit rpl_add_frag_mem_limit #endif /* frag_percpu_counter_batch */ From patchwork Fri Mar 6 22:37:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1250648 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=SBA8jwCI; 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 48Z2Yw1psMz9sPR for ; Sat, 7 Mar 2020 09:37:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9192B86F8D; Fri, 6 Mar 2020 22:37:38 +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 CS554LmWP5-G; Fri, 6 Mar 2020 22:37:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id B389B86F90; Fri, 6 Mar 2020 22:37:33 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 79E02C1D8F; Fri, 6 Mar 2020 22:37:33 +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 B4CB9C013E for ; Fri, 6 Mar 2020 22:37:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8B23A228E3 for ; Fri, 6 Mar 2020 22:37: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 7mHomcmWPtNy for ; Fri, 6 Mar 2020 22:37:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by silver.osuosl.org (Postfix) with ESMTPS id 0CF39228BD for ; Fri, 6 Mar 2020 22:37:29 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id h8so1720841pgs.9 for ; Fri, 06 Mar 2020 14:37:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xYner+xGJ/OLjp6iikteBsUyk/HXn0BrO61OmGZSfMY=; b=SBA8jwCIZA5t/QHALYp4jvSO4IOzsjJZpxokXX1Se7nRVj3Ox1qTGvnegOvPPVBC0v pe5HZBMhmEQW859J53Qr43UU3ntwAe4m+2tbt5nojVL+KvAegzNPZ574RNt+tgi1PrVD VZ5VuRezRq+lrtYZZX5xxfpG0JPOgtLUT+adCIweCCBEXRiRWQlOXxDywC9GU+k268MX PfoyEvTPiosvkBqLsOihRJR4zRZCSu2l3gRcyu6+DOxLebWhVZCfoyVTVxVBhmNhxTj2 lt0ZjMacsCsFjArBPmnww2+cel2lmGERDblejC0AnXCiOaaQiF5ovOKyU4fCHkMB8+qm 6Mvg== 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=xYner+xGJ/OLjp6iikteBsUyk/HXn0BrO61OmGZSfMY=; b=ddZOByYwHycPrfAnBx/Sr/fGdn1gzNG7jDve7Tr4jemFsJhJtYNSYwOHkNzXlnMb0C UpBzPJzOqI3n7j+sWgwXnAqGIc0zVMQGqagTqJtg8ggv690gKB6MvQ+fbCZYV3iC1JV9 uxnH3U3cl/IdL/sGunXyCb54s2V8tvLs0MgR6Wik3WIa7uvZV50KM/Inn0LylJoZdawj 8h+EidG7EkaBmZONV5H0Sf7skt8fuXgMWg80zN/HQH2Si+zXDDfRz5NJrirT8HRYwKqz /n6OpcujCZQiMKtLCg/DMVEn6QnkNdVsLLZdQIJMkO52xCSdsDF6RVux7kb1rk5NlqL2 K0ZA== X-Gm-Message-State: ANhLgQ2MdiPBuPljopyUx+c3nwdVqCN34YOR7HNB7v0LLycVW27Ns5kM 7ZLSACGGSm0I2wxpI1//NMRaZ8R/ENQ= X-Google-Smtp-Source: ADFU+vt3/nQPpvsg/GVmXnCEEI+DSoH3NkG0yugPVIzFsiCD+y90u4cFnQB+xGlgcR1Q/XQrIv8qUA== X-Received: by 2002:a62:6842:: with SMTP id d63mr5965524pfc.113.1583534248089; Fri, 06 Mar 2020 14:37:28 -0800 (PST) Received: from gizo.domain (97-115-106-43.ptld.qwest.net. [97.115.106.43]) by smtp.gmail.com with ESMTPSA id k3sm35939602pgh.34.2020.03.06.14.37.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2020 14:37:27 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 6 Mar 2020 14:37:15 -0800 Message-Id: <1583534241-16600-4-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> References: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> Cc: Johannes Berg Subject: [ovs-dev] [PATCH V4 3/9] compat: Move genl_ops policy to genl_family 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: Johannes Berg Upstream commit: commit 3b0f31f2b8c9fb348e4530b88f6b64f9621f83d6 Author: Johannes Berg Date: Thu Mar 21 22:51:02 2019 +0100 genetlink: make policy common to family Since maxattr is common, the policy can't really differ sanely, so make it common as well. The only user that did in fact manage to make a non-common policy is taskstats, which has to be really careful about it (since it's still using a common maxattr!). This is no longer supported, but we can fake it using pre_doit. This reduces the size of e.g. nl80211.o (which has lots of commands): text data bss dec hex filename 398745 14323 2240 415308 6564c net/wireless/nl80211.o (before) 397913 14331 2240 414484 65314 net/wireless/nl80211.o (after) -------------------------------- -832 +8 0 -824 Which is obviously just 8 bytes for each command, and an added 8 bytes for the new policy pointer. I'm not sure why the ops list is counted as .text though. Most of the code transformations were done using the following spatch: @ops@ identifier OPS; expression POLICY; @@ struct genl_ops OPS[] = { ..., { - .policy = POLICY, }, ... }; @@ identifier ops.OPS; expression ops.POLICY; identifier fam; expression M; @@ struct genl_family fam = { .ops = OPS, .maxattr = M, + .policy = POLICY, ... }; This also gets rid of devlink_nl_cmd_region_read_dumpit() accessing the cb->data as ops, which we want to change in a later genl patch. Signed-off-by: Johannes Berg Signed-off-by: David S. Miller Since commit 3b0f31f2b8c9f ("genetlink: make policy common to family") the policy field of the genl_ops structure has been moved into the genl_family structure. Add necessary compat layer infrastructure to still support older kernels. Acked-by: Yi-Hung Wei Signed-off-by: Greg Rose --- V3 - Add policy back to genl_family instead of completely removing it. --- acinclude.m4 | 3 +++ datapath/conntrack.c | 9 +++++++++ datapath/datapath.c | 38 ++++++++++++++++++++++++++++++++++++++ datapath/meter.c | 11 +++++++++++ 4 files changed, 61 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 3a555ad..729d2c6 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1050,6 +1050,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [OVS_DEFINE([HAVE_DST_OPS_CONFIRM_NEIGH])]) OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [fqdir], [OVS_DEFINE([HAVE_INET_FRAG_FQDIR])]) + OVS_FIND_FIELD_IFELSE([$KSRC/include/net/genetlink.h], [genl_ops], + [policy], + [OVS_DEFINE([HAVE_GENL_OPS_POLICY])]) if cmp -s datapath/linux/kcompat.h.new \ datapath/linux/kcompat.h >/dev/null 2>&1; then diff --git a/datapath/conntrack.c b/datapath/conntrack.c index 838cf63..b7eb53f 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -2312,7 +2312,9 @@ static struct genl_ops ct_limit_genl_ops[] = { #endif .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN * privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = ct_limit_policy, +#endif .doit = ovs_ct_limit_cmd_set, }, { .cmd = OVS_CT_LIMIT_CMD_DEL, @@ -2321,7 +2323,9 @@ static struct genl_ops ct_limit_genl_ops[] = { #endif .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN * privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = ct_limit_policy, +#endif .doit = ovs_ct_limit_cmd_del, }, { .cmd = OVS_CT_LIMIT_CMD_GET, @@ -2329,7 +2333,9 @@ static struct genl_ops ct_limit_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = 0, /* OK for unprivileged users. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = ct_limit_policy, +#endif .doit = ovs_ct_limit_cmd_get, }, }; @@ -2343,6 +2349,9 @@ struct genl_family dp_ct_limit_genl_family __ro_after_init = { .name = OVS_CT_LIMIT_FAMILY, .version = OVS_CT_LIMIT_VERSION, .maxattr = OVS_CT_LIMIT_ATTR_MAX, +#ifndef HAVE_GENL_OPS_POLICY + .policy = ct_limit_policy, +#endif .netnsok = true, .parallel_ops = true, .ops = ct_limit_genl_ops, diff --git a/datapath/datapath.c b/datapath/datapath.c index 853bfb5..6f74c8f 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -657,7 +657,9 @@ static struct genl_ops dp_packet_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = packet_policy, +#endif .doit = ovs_packet_cmd_execute } }; @@ -667,6 +669,9 @@ static struct genl_family dp_packet_genl_family __ro_after_init = { .name = OVS_PACKET_FAMILY, .version = OVS_PACKET_VERSION, .maxattr = OVS_PACKET_ATTR_MAX, +#ifndef HAVE_GENL_OPS_POLICY + .policy = packet_policy, +#endif .netnsok = true, .parallel_ops = true, .ops = dp_packet_genl_ops, @@ -1449,7 +1454,9 @@ static const struct genl_ops dp_flow_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = flow_policy, +#endif .doit = ovs_flow_cmd_new }, { .cmd = OVS_FLOW_CMD_DEL, @@ -1457,7 +1464,9 @@ static const struct genl_ops dp_flow_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = flow_policy, +#endif .doit = ovs_flow_cmd_del }, { .cmd = OVS_FLOW_CMD_GET, @@ -1465,7 +1474,9 @@ static const struct genl_ops dp_flow_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = 0, /* OK for unprivileged users. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = flow_policy, +#endif .doit = ovs_flow_cmd_get, .dumpit = ovs_flow_cmd_dump }, @@ -1474,7 +1485,9 @@ static const struct genl_ops dp_flow_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = flow_policy, +#endif .doit = ovs_flow_cmd_set, }, }; @@ -1484,6 +1497,9 @@ static struct genl_family dp_flow_genl_family __ro_after_init = { .name = OVS_FLOW_FAMILY, .version = OVS_FLOW_VERSION, .maxattr = OVS_FLOW_ATTR_MAX, +#ifndef HAVE_GENL_OPS_POLICY + .policy = flow_policy, +#endif .netnsok = true, .parallel_ops = true, .ops = dp_flow_genl_ops, @@ -1853,7 +1869,9 @@ static const struct genl_ops dp_datapath_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = datapath_policy, +#endif .doit = ovs_dp_cmd_new }, { .cmd = OVS_DP_CMD_DEL, @@ -1861,7 +1879,9 @@ static const struct genl_ops dp_datapath_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = datapath_policy, +#endif .doit = ovs_dp_cmd_del }, { .cmd = OVS_DP_CMD_GET, @@ -1869,7 +1889,9 @@ static const struct genl_ops dp_datapath_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = 0, /* OK for unprivileged users. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = datapath_policy, +#endif .doit = ovs_dp_cmd_get, .dumpit = ovs_dp_cmd_dump }, @@ -1878,7 +1900,9 @@ static const struct genl_ops dp_datapath_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = datapath_policy, +#endif .doit = ovs_dp_cmd_set, }, }; @@ -1888,6 +1912,9 @@ static struct genl_family dp_datapath_genl_family __ro_after_init = { .name = OVS_DATAPATH_FAMILY, .version = OVS_DATAPATH_VERSION, .maxattr = OVS_DP_ATTR_MAX, +#ifndef HAVE_GENL_OPS_POLICY + .policy = datapath_policy, +#endif .netnsok = true, .parallel_ops = true, .ops = dp_datapath_genl_ops, @@ -2310,7 +2337,9 @@ static const struct genl_ops dp_vport_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = vport_policy, +#endif .doit = ovs_vport_cmd_new }, { .cmd = OVS_VPORT_CMD_DEL, @@ -2318,7 +2347,9 @@ static const struct genl_ops dp_vport_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = vport_policy, +#endif .doit = ovs_vport_cmd_del }, { .cmd = OVS_VPORT_CMD_GET, @@ -2326,7 +2357,9 @@ static const struct genl_ops dp_vport_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = 0, /* OK for unprivileged users. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = vport_policy, +#endif .doit = ovs_vport_cmd_get, .dumpit = ovs_vport_cmd_dump }, @@ -2335,7 +2368,9 @@ static const struct genl_ops dp_vport_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = vport_policy, +#endif .doit = ovs_vport_cmd_set, }, }; @@ -2345,6 +2380,9 @@ struct genl_family dp_vport_genl_family __ro_after_init = { .name = OVS_VPORT_FAMILY, .version = OVS_VPORT_VERSION, .maxattr = OVS_VPORT_ATTR_MAX, +#ifndef HAVE_GENL_OPS_POLICY + .policy = vport_policy, +#endif .netnsok = true, .parallel_ops = true, .ops = dp_vport_genl_ops, diff --git a/datapath/meter.c b/datapath/meter.c index 7d8f51a..8cecd5a 100644 --- a/datapath/meter.c +++ b/datapath/meter.c @@ -542,7 +542,9 @@ static struct genl_ops dp_meter_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = 0, /* OK for unprivileged users. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = meter_policy, +#endif .doit = ovs_meter_cmd_features }, { .cmd = OVS_METER_CMD_SET, @@ -552,7 +554,9 @@ static struct genl_ops dp_meter_genl_ops[] = { .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN * privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = meter_policy, +#endif .doit = ovs_meter_cmd_set, }, { .cmd = OVS_METER_CMD_GET, @@ -560,7 +564,9 @@ static struct genl_ops dp_meter_genl_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, #endif .flags = 0, /* OK for unprivileged users. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = meter_policy, +#endif .doit = ovs_meter_cmd_get, }, { .cmd = OVS_METER_CMD_DEL, @@ -570,7 +576,9 @@ static struct genl_ops dp_meter_genl_ops[] = { .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN * privilege. */ +#ifdef HAVE_GENL_OPS_POLICY .policy = meter_policy, +#endif .doit = ovs_meter_cmd_del }, }; @@ -584,6 +592,9 @@ struct genl_family dp_meter_genl_family __ro_after_init = { .name = OVS_METER_FAMILY, .version = OVS_METER_VERSION, .maxattr = OVS_METER_ATTR_MAX, +#ifndef HAVE_GENL_OPS_POLICY + .policy = meter_policy, +#endif .netnsok = true, .parallel_ops = true, .ops = dp_meter_genl_ops, From patchwork Fri Mar 6 22:37:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1250651 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=AX5HZgIF; 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 48Z2Z16WD1z9sPg for ; Sat, 7 Mar 2020 09:37:43 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id AC74387942; Fri, 6 Mar 2020 22:37: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 hCC+9VUNtaDz; Fri, 6 Mar 2020 22:37:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id B6438877E3; Fri, 6 Mar 2020 22:37:32 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8264BC1D8E; Fri, 6 Mar 2020 22:37:32 +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 03CD2C1D87 for ; Fri, 6 Mar 2020 22:37:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E542F87881 for ; Fri, 6 Mar 2020 22:37:31 +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 Fc71nZ-Wl8D1 for ; Fri, 6 Mar 2020 22:37:30 +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 F22DA87864 for ; Fri, 6 Mar 2020 22:37:29 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id y30so1709869pga.13 for ; Fri, 06 Mar 2020 14:37:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Tr7NHceyKteaUgZAT+Nbs10x8zVh6qmixM8ACzwivAI=; b=AX5HZgIFiWAm/y0Q30SUc7c/4sEeEjH/h41xjjTNzaj1yLZy2FQJOOJc+EdmGbKDhJ Czr2C6DKE/yAMQDTCMvPBnUJK0OX7wGVug3V3JGsmh0ehdCvUXLHj+iMoclDGK18ytOB yWDWQ8jjQfdp3Sm+HojdU2D4dJDqYY+aP1qHzW6TWmPU2yqVZDwRjMwLzvo3DhiQSmRO PrPGuTfsl0Ok/FkXKckcDL5HFw6LToi2AXzc2I000IjwmGbEbplnDyOuijGj/JbFDEUV 9fq0C8rtN2MwYKL3UMsHo9US66Nbpynw7CSLQ1EbBINDIvRgrCdzaeNGnkAOPqNeHJnA txxQ== 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=Tr7NHceyKteaUgZAT+Nbs10x8zVh6qmixM8ACzwivAI=; b=P5G+Wx8QvV+hFvAapTHi6MswSLwPGOq1BLvMQnGxjQSdqeKdHgXfDTTWaUJtLutjIp zS+e9rbS73nvLoG5junX54b6+Adlo4ut34hjv/6hwtplSAV78EqH3dVcbT6C+t4/qtAI InFDrd0V7by4bFSZpC/pU0G6VdSVYBeXdESqymtBBAPnJyvbbVSQZW9ySNHyJyp9t3uR 8At5IsWLvUvSkwi/yLWuB4lG1HSXOphLReZUEPVoI4HbvcRwentTzNGSVPLn/Q0LSbO9 Z/rCfypcAifNO5188HY6F0TW9OY5FIyrTrpftmLu1gAIEHq/VbfNXHGlNP748RZPStIe Qk/w== X-Gm-Message-State: ANhLgQ2bagfevTRLKPHgbcru7LqCft/r7QLfqS1hAGmj1GINYjtdevhP MUTs+F59IgLJbKTK9H/mOOlafKsXwU8= X-Google-Smtp-Source: ADFU+vvW0RCWb6LXVEivDGASboUHFmSOne20RHVakhm0yDAH65mMU9W9NSXCZ8Bv7xT2u5PYpTYYmw== X-Received: by 2002:a62:7786:: with SMTP id s128mr5928373pfc.34.1583534249204; Fri, 06 Mar 2020 14:37:29 -0800 (PST) Received: from gizo.domain (97-115-106-43.ptld.qwest.net. [97.115.106.43]) by smtp.gmail.com with ESMTPSA id k3sm35939602pgh.34.2020.03.06.14.37.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2020 14:37:28 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 6 Mar 2020 14:37:16 -0800 Message-Id: <1583534241-16600-5-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> References: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 4/9] compat: Remove flex_array code 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" Flex array support is removed since kernel 5.1. Convert to use kvmalloc_array instead. Acked-by: Yi-Hung Wei Signed-off-by: Greg Rose --- datapath/linux/compat/stt.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c index 21fef09..7b46d1a 100644 --- a/datapath/linux/compat/stt.c +++ b/datapath/linux/compat/stt.c @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -136,7 +135,7 @@ struct pkt_frag { }; struct stt_percpu { - struct flex_array *frag_hash; + struct pkt_frag *frag_hash; struct list_head frag_lru; unsigned int frag_mem_used; @@ -1079,8 +1078,7 @@ static struct pkt_frag *lookup_frag(struct net *net, int i; for (i = 0; i < FRAG_HASH_SEGS; i++) { - frag = flex_array_get(stt_percpu->frag_hash, - hash & (FRAG_HASH_ENTRIES - 1)); + frag = &stt_percpu->frag_hash[hash & (FRAG_HASH_ENTRIES - 1)]; if (frag->skbs && time_before(jiffies, frag->timestamp + FRAG_EXP_TIME) && @@ -1533,7 +1531,7 @@ static void clean_percpu(struct work_struct *work) for (j = 0; j < FRAG_HASH_ENTRIES; j++) { struct pkt_frag *frag; - frag = flex_array_get(stt_percpu->frag_hash, j); + frag = &stt_percpu->frag_hash[j]; if (!frag->skbs || time_before(jiffies, frag->timestamp + FRAG_EXP_TIME)) continue; @@ -1631,26 +1629,20 @@ static int stt_start(struct net *net) for_each_possible_cpu(i) { struct stt_percpu *stt_percpu = per_cpu_ptr(stt_percpu_data, i); - struct flex_array *frag_hash; + struct pkt_frag *frag_hash; spin_lock_init(&stt_percpu->lock); INIT_LIST_HEAD(&stt_percpu->frag_lru); get_random_bytes(&per_cpu(pkt_seq_counter, i), sizeof(u32)); - frag_hash = flex_array_alloc(sizeof(struct pkt_frag), - FRAG_HASH_ENTRIES, - GFP_KERNEL | __GFP_ZERO); + frag_hash = kvmalloc_array(sizeof(struct pkt_frag), + FRAG_HASH_ENTRIES, + GFP_KERNEL | __GFP_ZERO); if (!frag_hash) { err = -ENOMEM; goto free_percpu; } stt_percpu->frag_hash = frag_hash; - - err = flex_array_prealloc(stt_percpu->frag_hash, 0, - FRAG_HASH_ENTRIES, - GFP_KERNEL | __GFP_ZERO); - if (err) - goto free_percpu; } schedule_clean_percpu(); n_tunnels++; @@ -1691,7 +1683,7 @@ free_percpu: struct stt_percpu *stt_percpu = per_cpu_ptr(stt_percpu_data, i); if (stt_percpu->frag_hash) - flex_array_free(stt_percpu->frag_hash); + kvfree(stt_percpu->frag_hash); } free_percpu(stt_percpu_data); @@ -1718,11 +1710,11 @@ static void stt_cleanup(struct net *net) for (j = 0; j < FRAG_HASH_ENTRIES; j++) { struct pkt_frag *frag; - frag = flex_array_get(stt_percpu->frag_hash, j); + frag = &stt_percpu->frag_hash[j]; kfree_skb_list(frag->skbs); } - flex_array_free(stt_percpu->frag_hash); + kvfree(stt_percpu->frag_hash); } free_percpu(stt_percpu_data); From patchwork Fri Mar 6 22:37:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1250649 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=Dm8APYqi; 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 48Z2Yw68N4z9sPg for ; Sat, 7 Mar 2020 09:37:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 53B6586FB4; Fri, 6 Mar 2020 22:37:39 +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 OpgKvqBWnKRR; Fri, 6 Mar 2020 22:37:36 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id B3F7786FAF; Fri, 6 Mar 2020 22:37:34 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7D498C1D8E; Fri, 6 Mar 2020 22:37:34 +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 E1DEFC18DA for ; Fri, 6 Mar 2020 22:37:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C72E386F81 for ; Fri, 6 Mar 2020 22:37:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EeOF1bz21VpB for ; Fri, 6 Mar 2020 22:37:31 +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 905D286F55 for ; Fri, 6 Mar 2020 22:37:31 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id h8so1720877pgs.9 for ; Fri, 06 Mar 2020 14:37:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n68Qxlr0uQOdjz0Yk4logFydBsmqVGgcxIaiqYHMk78=; b=Dm8APYqiaBBo+W+srcBHL7kc2KncoiRazY5+Z7U4Jt/8FzVoqrZStpZzsCLMbcEMUg /1jRXs72E/vmQn8Sc9HC32RUdFfTB4O05OHqZxuGjl6ODtyi5637T4rlWTZbC5YAQ+5L nNdh3Bn9Yw9T7SprvW01rB0Ti1yvxAMtVOamwL7s+zIOmFPwr5/CxPeN1V0ujFgT4XO8 oFhaAEysR04Ai+Hkdq9EVZBbEg4iHxhEwp18McClo4zolrH9gfylavID3v/CUoGd4/go tagBkvxAyYmYGtrmit/pafWIQ0J4QCEfV9QHJjSLU5YmGk5H67KvWiNPMjfy/KI+LUDk AV3w== 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=n68Qxlr0uQOdjz0Yk4logFydBsmqVGgcxIaiqYHMk78=; b=HpEdYIaCc7jmmW180dND2SulbJlinr20pu+nXAY/R81nbpkOFcPbTbSjtW4ADEOqgw EGpsxgFudkRA/sYfSUnuyebtwXC7y+Cs1zA6Gt5wJ4mJDI6tE8MWRgeMkM8AOv8s49Fm hUlChkgD7l5/0aOg1qBgBqbLkCTgYu03Oh+9BQkow/WyPk1UpJV3+Ns6yxA5+fMbck6R uUHNvbdEIOWGowJBLBi0txhusiwpBE/C82ZX/LHeY80jQMws4r5qBBTGyszU/Zx/yMOj 0Z2Lv2sfLrnbf2pqfeFuiuKWQ1ai5U/aW2YJAKsfslQZc+PW50lCWR1AgninuVOHASgg vsow== X-Gm-Message-State: ANhLgQ0XQymuON530Q7FhYOlZzFBfmr+f4CZ4d+Ygr9HOJSvmvVo2po/ yNB3+cYhIij5elNdezh9Y9Ki7xD7BOI= X-Google-Smtp-Source: ADFU+vvVnNJYKljmjXHYCBEPHGaC2Wm3TD5OyVYR5kBQ4YwlMQM5NAVXotRuh+3ds1To0qnuCDZSVQ== X-Received: by 2002:a63:1a5b:: with SMTP id a27mr5241708pgm.249.1583534250649; Fri, 06 Mar 2020 14:37:30 -0800 (PST) Received: from gizo.domain (97-115-106-43.ptld.qwest.net. [97.115.106.43]) by smtp.gmail.com with ESMTPSA id k3sm35939602pgh.34.2020.03.06.14.37.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2020 14:37:29 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 6 Mar 2020 14:37:17 -0800 Message-Id: <1583534241-16600-6-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> References: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> Cc: Pankaj Bharadiya Subject: [ovs-dev] [PATCH V4 5/9] datapath: Use sizeof_field macro 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: Pankaj Bharadiya Upstream commit: commit c593642c8be046915ca3a4a300243a68077cd207 Author: Pankaj Bharadiya Date: Mon Dec 9 10:31:43 2019 -0800 treewide: Use sizeof_field() macro Replace all the occurrences of FIELD_SIZEOF() with sizeof_field() except at places where these are defined. Later patches will remove the unused definition of FIELD_SIZEOF(). This patch is generated using following script: EXCLUDE_FILES="include/linux/stddef.h|include/linux/kernel.h" git grep -l -e "\bFIELD_SIZEOF\b" | while read file; do if [[ "$file" =~ $EXCLUDE_FILES ]]; then continue fi sed -i -e 's/\bFIELD_SIZEOF\b/sizeof_field/g' $file; done Signed-off-by: Pankaj Bharadiya Link: https://lore.kernel.org/r/20190924105839.110713-3-pankaj.laxminarayan.bharadiya@intel.com Co-developed-by: Kees Cook Signed-off-by: Kees Cook Acked-by: David Miller # for net Also added a compatibility layer macro for older kernels that still use FIELD_SIZEOF Acked-by: Yi-Hung Wei Signed-off-by: Greg Rose --- V3 - As suggested by Yi-Hung go ahead and just do the sizeof_field backport rather than the cheap and easy way done in previous versions of this patch. V4 - Change SIZEOF_FIELD in commit message to FIELD_SIZEOF, which is actually what we're changing. --- datapath/datapath.c | 2 +- datapath/flow.h | 4 ++-- datapath/linux/compat/geneve.c | 2 +- datapath/linux/compat/gso.c | 2 +- datapath/linux/compat/include/linux/kernel.h | 4 ++++ datapath/linux/compat/include/net/ip_tunnels.h | 4 ++-- datapath/linux/compat/ip6_gre.c | 4 ++-- datapath/linux/compat/ip_gre.c | 4 ++-- datapath/linux/compat/vxlan.c | 4 ++-- 9 files changed, 17 insertions(+), 13 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 6f74c8f..f0c3457 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -2515,7 +2515,7 @@ static int __init dp_init(void) { int err; - BUILD_BUG_ON(sizeof(struct ovs_skb_cb) > FIELD_SIZEOF(struct sk_buff, cb)); + BUILD_BUG_ON(sizeof(struct ovs_skb_cb) > sizeof_field(struct sk_buff, cb)); pr_info("Open vSwitch switching datapath %s\n", VERSION); diff --git a/datapath/flow.h b/datapath/flow.h index 4ad5363..584d9f5 100644 --- a/datapath/flow.h +++ b/datapath/flow.h @@ -50,7 +50,7 @@ enum sw_flow_mac_proto { * matching for small options. */ #define TUN_METADATA_OFFSET(opt_len) \ - (FIELD_SIZEOF(struct sw_flow_key, tun_opts) - opt_len) + (sizeof_field(struct sw_flow_key, tun_opts) - opt_len) #define TUN_METADATA_OPTS(flow_key, opt_len) \ ((void *)((flow_key)->tun_opts + TUN_METADATA_OFFSET(opt_len))) @@ -65,7 +65,7 @@ struct vlan_head { #define OVS_SW_FLOW_KEY_METADATA_SIZE \ (offsetof(struct sw_flow_key, recirc_id) + \ - FIELD_SIZEOF(struct sw_flow_key, recirc_id)) + sizeof_field(struct sw_flow_key, recirc_id)) struct ovs_key_nsh { struct ovs_nsh_key_base base; diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c index c044b14..5b18396 100644 --- a/datapath/linux/compat/geneve.c +++ b/datapath/linux/compat/geneve.c @@ -1407,7 +1407,7 @@ static void geneve_setup(struct net_device *dev) static const struct nla_policy geneve_policy[IFLA_GENEVE_MAX + 1] = { [IFLA_GENEVE_ID] = { .type = NLA_U32 }, - [IFLA_GENEVE_REMOTE] = { .len = FIELD_SIZEOF(struct iphdr, daddr) }, + [IFLA_GENEVE_REMOTE] = { .len = sizeof_field(struct iphdr, daddr) }, [IFLA_GENEVE_REMOTE6] = { .len = sizeof(struct in6_addr) }, [IFLA_GENEVE_TTL] = { .type = NLA_U8 }, [IFLA_GENEVE_TOS] = { .type = NLA_U8 }, diff --git a/datapath/linux/compat/gso.c b/datapath/linux/compat/gso.c index 48a56b9..65da5d8 100644 --- a/datapath/linux/compat/gso.c +++ b/datapath/linux/compat/gso.c @@ -171,7 +171,7 @@ static struct sk_buff *tnl_skb_gso_segment(struct sk_buff *skb, __be16 proto = skb->protocol; char cb[sizeof(skb->cb)]; - BUILD_BUG_ON(sizeof(struct ovs_gso_cb) > FIELD_SIZEOF(struct sk_buff, cb)); + BUILD_BUG_ON(sizeof(struct ovs_gso_cb) > sizeof_field(struct sk_buff, cb)); OVS_GSO_CB(skb)->ipv6 = (sa_family == AF_INET6); /* setup whole inner packet to get protocol. */ __skb_pull(skb, mac_offset); diff --git a/datapath/linux/compat/include/linux/kernel.h b/datapath/linux/compat/include/linux/kernel.h index 2e81abc..106b594 100644 --- a/datapath/linux/compat/include/linux/kernel.h +++ b/datapath/linux/compat/include/linux/kernel.h @@ -32,4 +32,8 @@ #define U32_MAX ((u32)~0U) #endif +#ifndef sizeof_field +#define sizeof_field(t, f) (sizeof(((t*)0)->f)) +#endif + #endif /* linux/kernel.h */ diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h index da64a94..617a753 100644 --- a/datapath/linux/compat/include/net/ip_tunnels.h +++ b/datapath/linux/compat/include/net/ip_tunnels.h @@ -139,8 +139,8 @@ struct tnl_ptk_info { /* Used to memset ipv4 address padding. */ #define IP_TUNNEL_KEY_IPV4_PAD offsetofend(struct ip_tunnel_key, u.ipv4.dst) #define IP_TUNNEL_KEY_IPV4_PAD_LEN \ - (FIELD_SIZEOF(struct ip_tunnel_key, u) - \ - FIELD_SIZEOF(struct ip_tunnel_key, u.ipv4)) + (sizeof_field(struct ip_tunnel_key, u) - \ + sizeof_field(struct ip_tunnel_key, u.ipv4)) struct ip_tunnel_key { __be64 tun_id; diff --git a/datapath/linux/compat/ip6_gre.c b/datapath/linux/compat/ip6_gre.c index 7fd3453..da0fa43 100644 --- a/datapath/linux/compat/ip6_gre.c +++ b/datapath/linux/compat/ip6_gre.c @@ -2311,8 +2311,8 @@ static const struct nla_policy ip6gre_policy[RPL_IFLA_GRE_MAX + 1] = { [IFLA_GRE_OFLAGS] = { .type = NLA_U16 }, [IFLA_GRE_IKEY] = { .type = NLA_U32 }, [IFLA_GRE_OKEY] = { .type = NLA_U32 }, - [IFLA_GRE_LOCAL] = { .len = FIELD_SIZEOF(struct ipv6hdr, saddr) }, - [IFLA_GRE_REMOTE] = { .len = FIELD_SIZEOF(struct ipv6hdr, daddr) }, + [IFLA_GRE_LOCAL] = { .len = sizeof_field(struct ipv6hdr, saddr) }, + [IFLA_GRE_REMOTE] = { .len = sizeof_field(struct ipv6hdr, daddr) }, [IFLA_GRE_TTL] = { .type = NLA_U8 }, [IFLA_GRE_ENCAP_LIMIT] = { .type = NLA_U8 }, [IFLA_GRE_FLOWINFO] = { .type = NLA_U32 }, diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index 04f994f..41379b1 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -1096,8 +1096,8 @@ static const struct nla_policy ipgre_policy[RPL_IFLA_GRE_MAX + 1] = { [IFLA_GRE_OFLAGS] = { .type = NLA_U16 }, [IFLA_GRE_IKEY] = { .type = NLA_U32 }, [IFLA_GRE_OKEY] = { .type = NLA_U32 }, - [IFLA_GRE_LOCAL] = { .len = FIELD_SIZEOF(struct iphdr, saddr) }, - [IFLA_GRE_REMOTE] = { .len = FIELD_SIZEOF(struct iphdr, daddr) }, + [IFLA_GRE_LOCAL] = { .len = sizeof_field(struct iphdr, saddr) }, + [IFLA_GRE_REMOTE] = { .len = sizeof_field(struct iphdr, daddr) }, [IFLA_GRE_TTL] = { .type = NLA_U8 }, [IFLA_GRE_TOS] = { .type = NLA_U8 }, [IFLA_GRE_PMTUDISC] = { .type = NLA_U8 }, diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c index 23118e8..6090f42 100644 --- a/datapath/linux/compat/vxlan.c +++ b/datapath/linux/compat/vxlan.c @@ -1680,10 +1680,10 @@ static void vxlan_raw_setup(struct net_device *dev) static const struct nla_policy vxlan_policy[IFLA_VXLAN_MAX + 1] = { [IFLA_VXLAN_ID] = { .type = NLA_U32 }, - [IFLA_VXLAN_GROUP] = { .len = FIELD_SIZEOF(struct iphdr, daddr) }, + [IFLA_VXLAN_GROUP] = { .len = sizeof_field(struct iphdr, daddr) }, [IFLA_VXLAN_GROUP6] = { .len = sizeof(struct in6_addr) }, [IFLA_VXLAN_LINK] = { .type = NLA_U32 }, - [IFLA_VXLAN_LOCAL] = { .len = FIELD_SIZEOF(struct iphdr, saddr) }, + [IFLA_VXLAN_LOCAL] = { .len = sizeof_field(struct iphdr, saddr) }, [IFLA_VXLAN_LOCAL6] = { .len = sizeof(struct in6_addr) }, [IFLA_VXLAN_TOS] = { .type = NLA_U8 }, [IFLA_VXLAN_TTL] = { .type = NLA_U8 }, From patchwork Fri Mar 6 22:37:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1250650 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=GPc1uoWW; 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 48Z2Yy2R3Gz9sPJ for ; Sat, 7 Mar 2020 09:37:42 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C870722DE3; Fri, 6 Mar 2020 22:37:40 +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 VG1Z4tQ4B2Nu; Fri, 6 Mar 2020 22:37:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id E309E228EF; Fri, 6 Mar 2020 22:37:35 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CA07FC013E; Fri, 6 Mar 2020 22:37:35 +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 19F88C1D8E for ; Fri, 6 Mar 2020 22:37:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6A35B884D0 for ; Fri, 6 Mar 2020 22:37:33 +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 D+Do5x-uCKKh for ; Fri, 6 Mar 2020 22:37:32 +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 8E85488466 for ; Fri, 6 Mar 2020 22:37:32 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id z65so1785131pfz.8 for ; Fri, 06 Mar 2020 14:37:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1LF5tI3AXE/6f0ReR5/nZoEfLXGlNgvB6Gm7+q8TQnA=; b=GPc1uoWWadqB6LQKvka0n0UE3Gnn1BiNsR6gxnbj5JBMEhJaBTps701DIFYseHAoGn hcwfZARv/9X9BA4uvBRY7/7lyBRfO7uFfl+QYvwUVSVfqOkG82iEYKL/ToaEBD4MtBoB 168zHR6EMb3P/Y+0j4IDBpnZ/MEcvTAK92eNJvY8JgTaI2spd4tjdJh2/G/mAxx0oq4G Ey5BshaMnjQmao4PVHI1oo4lRSqN64h/KFRlk4fOobyV1E0CZC/SjP5XYvl+tOUV+qhZ wEQYPqYg/Lg16qqFQUBx9sPKAJSEaLXHCTO+2vqILbmQRiUJXunL+v4gfmpI3Ui+I21S OD8Q== 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=1LF5tI3AXE/6f0ReR5/nZoEfLXGlNgvB6Gm7+q8TQnA=; b=VlZXtVbM1KVnfqcvXCnMYzYWSS20VmO+DnbbPW6FExSO7MpLSe+IBTVB64PiiXo0e+ IxSIGnh3BLo6Xq08l8+JpP01JO4mPFqHEAotbL1c31KmtLlne46U08fGiUHldDcFxgt6 tXHxNifqosRTtZoWi06Tem9vIsNwGhrfnTSkXy2jtWsmVpN8zLdFRRko7NQwD8lhR/4j LrQPqOm3l4bLk2KF3tTW7TZcEj4SmWJJte2hFCUhKOLu34gYu17fRV8AS9P7FpqlLc3k 3lXYq0r0NeTJCgi6LyqhZBvFe/1ElGFGtIAPGUGuISvwpguFMYAqGD081snnATKpwKCy cOLA== X-Gm-Message-State: ANhLgQ3Mo46olcInPaREefILcuNAFyiLVxTgvh1U+Epz4nnOO59tQePs PgxNIw+n62Pzzasu5bQ+MRpZiNI3PEw= X-Google-Smtp-Source: ADFU+vveEmRMNX0zibfRwiQfzFgXancgVbDbJPEtprneLUqKSHIqCtdMUNQWVWyXoQhgF34cH6Czyw== X-Received: by 2002:a63:ce42:: with SMTP id r2mr5632390pgi.106.1583534251792; Fri, 06 Mar 2020 14:37:31 -0800 (PST) Received: from gizo.domain (97-115-106-43.ptld.qwest.net. [97.115.106.43]) by smtp.gmail.com with ESMTPSA id k3sm35939602pgh.34.2020.03.06.14.37.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2020 14:37:31 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 6 Mar 2020 14:37:18 -0800 Message-Id: <1583534241-16600-7-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> References: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> Cc: David Ahern Subject: [ovs-dev] [PATCH V4 6/9] datapath: Kbuild: Add kcompat.h header to front of NOSTDINC 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" Since this commit in the Linux upstream kernel: 'commit 9b9a3f20cbe0 ("kbuild: split final module linking out into Makefile.modfinal")' The openvswitch kernel module fails to build against the upstream Linux kernel. The cause of the build failure is that the include of the KBUILD_EXTMOD variable was dropped in Makefile.modfinal when it was split out from Makefile.modpost. Our Kbuild was setting the ccflags-y variable to include our kcompat.h header as the first header file. The Linux kernel maintainer has said that it is incorrect to rely on the ccflags-y variable for the modfinal phase of the build so that is why KBUILD_EXTMOD is not included. We fix this by breaking a different Linux kernel make rule. We add '-include $(builddir)/kcompat.h' to the front of the NOSTDINC variable setting in our Kbuild makefile. As noted already in the comment for the NOSTDINC setting: \# These include directories have to go before -I$(KSRC)/include. \# NOSTDINC_FLAGS just happens to be a variable that goes in the \# right place, even though it's conceptually incorrect. So we continue the misuse of the NOSTDINC variable to fix this issue as well. The assumption of the Linux kernel maintainers is that any local, out-of-tree build include files can be added to the end of the command line. In our case that is wrong of course, but there is nothing we can do about it that I know of other than using some utility like unifdef to strip out offending chunks of our compatibility layer code before invocation of Makefile.modfinal. That is a big change that would take a lot of work to implement. We could ask the Linux kernel maintainers to provide some way for out-of-tree kernel modules to include their own header files first in a proper manner. I consider that to be a very low probability of success but something we could ask about. For now we cheat and take the easy way out. Reported-by: David Ahern Acked-by: Yi-Hung Wei Signed-off-by: Greg Rose --- datapath/linux/Kbuild.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datapath/linux/Kbuild.in b/datapath/linux/Kbuild.in index 9e3259f..395b0cb 100644 --- a/datapath/linux/Kbuild.in +++ b/datapath/linux/Kbuild.in @@ -16,7 +16,7 @@ ccflags-y += -include $(builddir)/kcompat.h # These include directories have to go before -I$(KSRC)/include. # NOSTDINC_FLAGS just happens to be a variable that goes in the # right place, even though it's conceptually incorrect. -NOSTDINC_FLAGS += -I$(top_srcdir)/include -I$(srcdir)/compat -I$(srcdir)/compat/include +NOSTDINC_FLAGS += -include $(builddir)/kcompat.h -I$(top_srcdir)/include -I$(srcdir)/compat -I$(srcdir)/compat/include obj-m := $(subst _,-,$(patsubst %,%.o,$(build_modules))) From patchwork Fri Mar 6 22:37:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1250652 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=Ldkh9nYY; 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 48Z2Z52PGrz9sPg for ; Sat, 7 Mar 2020 09:37:49 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A46D286FA5; Fri, 6 Mar 2020 22:37:47 +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 ZZhbru-zLnAH; Fri, 6 Mar 2020 22:37:44 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id BD1B686FF1; Fri, 6 Mar 2020 22:37:38 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9AC29C1D90; Fri, 6 Mar 2020 22:37:38 +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 9F7F5C013E for ; Fri, 6 Mar 2020 22:37:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 83E6B22B6D for ; Fri, 6 Mar 2020 22:37:36 +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 aHNdY0x7bViB for ; Fri, 6 Mar 2020 22:37:33 +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 silver.osuosl.org (Postfix) with ESMTPS id CD66522B20 for ; Fri, 6 Mar 2020 22:37:33 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id c144so1779477pfb.10 for ; Fri, 06 Mar 2020 14:37:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KDCslSUiQrKWimbOHpp/23Ikn71O0ns18DszQeiHAZw=; b=Ldkh9nYYyjUa4xb/y0IRkzYLi34HcY/fhjEC3DwnxkuZe39mbuHQu79szBdIbu9M7q rO4FFH2oXkiJJV+VzeA+KSm/FvDo7ttSpNvoM2U9WKyaVMSd36LFsH0UF7xvhX3xnWD3 mzL60yHT+2Bu1Ife+UoMGu51wkMendqOQmTWU6rtdFi0ukcB7v8yGek3jQimB5+mUWqi hRiymv+Fk75Iggcwb4Uc8J0Eg5QSFqReonfs0bn0hulwUDea+xdWCbgiqBHCdYZsN42S hg0xUdbSmw5SWJuXTixE2CtK4WMIdrmF/6Drt52ZB1aCY50htmyRDTOz7mfdzpPSNBDy NhhA== 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=KDCslSUiQrKWimbOHpp/23Ikn71O0ns18DszQeiHAZw=; b=RU/j1Tg3U8/UL+6ZYKkwRrMVyXtgwFcfqWqMTTtE5vBmiKjhh2CufNIwbjMYBq3zsI tor9WAgp2Spvhxr/STluKKPZvboltDnlt2t1hcC9bx6Dzw3fOc+2WvDtHO5QirT/JRsQ +w42tJNsU0cc21o/ULl0998qWyIbcTqCgrwOMX5gEnR9DMHszjV8Y0ya4+rMt+qnq3Oe 5ZewSFtieW2d05HkUI7SvQ/9Xs6aulif3t8vX7Do3MCNtKe3bh5YuDwXDQGt1fWdrJsl 265S2DTVzvpz/XK6d4f3ex97rVE7Aqay6UNkjOfgszfMbDVSlcKniXJXiYsyIkmU4cMw +eBA== X-Gm-Message-State: ANhLgQ3CjlLcHwEpCPv/yEGA+u7wPAHkFqJ/T+/+iBn+G2F2xIlVLSc0 FYe73TRkPg7wSto4LeXk48JJLphahZs= X-Google-Smtp-Source: ADFU+vvy6Gnh0DUs788c32o+OtqVZsp91VEc6QxsPZRqh5R1qswAwXXV0gyoe79A7wKdIMFrm1j9yw== X-Received: by 2002:a63:8342:: with SMTP id h63mr5451075pge.141.1583534252827; Fri, 06 Mar 2020 14:37:32 -0800 (PST) Received: from gizo.domain (97-115-106-43.ptld.qwest.net. [97.115.106.43]) by smtp.gmail.com with ESMTPSA id k3sm35939602pgh.34.2020.03.06.14.37.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2020 14:37:32 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 6 Mar 2020 14:37:19 -0800 Message-Id: <1583534241-16600-8-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> References: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> Cc: Johannes Berg Subject: [ovs-dev] [PATCH V4 7/9] compat: Use nla_parse deprecated functions 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: Johannes Berg Upstream commit: commit 8cb081746c031fb164089322e2336a0bf5b3070c Author: Johannes Berg Date: Fri Apr 26 14:07:28 2019 +0200 netlink: make validation more configurable for future strictness We currently have two levels of strict validation: 1) liberal (default) - undefined (type >= max) & NLA_UNSPEC attributes accepted - attribute length >= expected accepted - garbage at end of message accepted 2) strict (opt-in) - NLA_UNSPEC attributes accepted - attribute length >= expected accepted Split out parsing strictness into four different options: * TRAILING - check that there's no trailing data after parsing attributes (in message or nested) * MAXTYPE - reject attrs > max known type * UNSPEC - reject attributes with NLA_UNSPEC policy entries * STRICT_ATTRS - strictly validate attribute size The default for future things should be *everything*. The current *_strict() is a combination of TRAILING and MAXTYPE, and is renamed to _deprecated_strict(). The current regular parsing has none of this, and is renamed to *_parse_deprecated(). Additionally it allows us to selectively set one of the new flags even on old policies. Notably, the UNSPEC flag could be useful in this case, since it can be arranged (by filling in the policy) to not be an incompatible userspace ABI change, but would then going forward prevent forgetting attribute entries. Similar can apply to the POLICY flag. We end up with the following renames: * nla_parse -> nla_parse_deprecated * nla_parse_strict -> nla_parse_deprecated_strict * nlmsg_parse -> nlmsg_parse_deprecated * nlmsg_parse_strict -> nlmsg_parse_deprecated_strict * nla_parse_nested -> nla_parse_nested_deprecated * nla_validate_nested -> nla_validate_nested_deprecated Using spatch, of course: @@ expression TB, MAX, HEAD, LEN, POL, EXT; @@ -nla_parse(TB, MAX, HEAD, LEN, POL, EXT) +nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT) @@ expression NLH, HDRLEN, TB, MAX, POL, EXT; @@ -nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT) +nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT) @@ expression NLH, HDRLEN, TB, MAX, POL, EXT; @@ -nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT) +nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT) @@ expression TB, MAX, NLA, POL, EXT; @@ -nla_parse_nested(TB, MAX, NLA, POL, EXT) +nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT) @@ expression START, MAX, POL, EXT; @@ -nla_validate_nested(START, MAX, POL, EXT) +nla_validate_nested_deprecated(START, MAX, POL, EXT) @@ expression NLH, HDRLEN, MAX, POL, EXT; @@ -nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT) +nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT) For this patch, don't actually add the strict, non-renamed versions yet so that it breaks compile if I get it wrong. Also, while at it, make nla_validate and nla_parse go down to a common __nla_validate_parse() function to avoid code duplication. Ultimately, this allows us to have very strict validation for every new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the next patch, while existing things will continue to work as is. In effect then, this adds fully strict validation for any new command. Signed-off-by: Johannes Berg Signed-off-by: David S. Miller Backport portions of this commit applicable to openvswitch and added necessary compatibility layer changes to support older kernels. Acked-by: Yi-Hung Wei Signed-off-by: Greg Rose --- V3 - As per Yi-Hung's suggestion just backport the upstream patch to stay in sync with upstream kernel code. --- acinclude.m4 | 3 +++ datapath/datapath.c | 4 ++-- datapath/flow_netlink.c | 9 +++++---- datapath/linux/compat/include/net/netlink.h | 12 ++++++++++-- datapath/meter.c | 8 +++++--- datapath/vport-vxlan.c | 4 ++-- 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 729d2c6..02efea6 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1053,6 +1053,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_FIND_FIELD_IFELSE([$KSRC/include/net/genetlink.h], [genl_ops], [policy], [OVS_DEFINE([HAVE_GENL_OPS_POLICY])]) + OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], + [nla_parse_deprecated_strict], + [OVS_DEFINE([HAVE_NLA_PARSE_DEPRECATED_STRICT])]) if cmp -s datapath/linux/kcompat.h.new \ datapath/linux/kcompat.h >/dev/null 2>&1; then diff --git a/datapath/datapath.c b/datapath/datapath.c index f0c3457..a7af784 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1401,8 +1401,8 @@ static int ovs_flow_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) u32 ufid_flags; int err; - err = genlmsg_parse(cb->nlh, &dp_flow_genl_family, a, - OVS_FLOW_ATTR_MAX, flow_policy, NULL); + err = genlmsg_parse_deprecated(cb->nlh, &dp_flow_genl_family, a, + OVS_FLOW_ATTR_MAX, flow_policy, NULL); if (err) return err; ufid_flags = ovs_nla_get_ufid_flags(a[OVS_FLOW_ATTR_UFID_FLAGS]); diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c index 9fc1a19..d3fd771 100644 --- a/datapath/flow_netlink.c +++ b/datapath/flow_netlink.c @@ -2859,8 +2859,8 @@ static int validate_userspace(const struct nlattr *attr) struct nlattr *a[OVS_USERSPACE_ATTR_MAX + 1]; int error; - error = nla_parse_nested(a, OVS_USERSPACE_ATTR_MAX, attr, - userspace_policy, NULL); + error = nla_parse_nested_deprecated(a, OVS_USERSPACE_ATTR_MAX, attr, + userspace_policy, NULL); if (error) return error; @@ -2891,8 +2891,9 @@ static int validate_and_copy_check_pkt_len(struct net *net, int nested_acts_start; int start, err; - err = nla_parse_nested(a, OVS_CHECK_PKT_LEN_ATTR_MAX, attr, - cpl_policy, NULL); + err = nla_parse_deprecated_strict(a, OVS_CHECK_PKT_LEN_ATTR_MAX, + nla_data(attr), nla_len(attr), + cpl_policy, NULL); if (err) return err; diff --git a/datapath/linux/compat/include/net/netlink.h b/datapath/linux/compat/include/net/netlink.h index 34fc346..84e0739 100644 --- a/datapath/linux/compat/include/net/netlink.h +++ b/datapath/linux/compat/include/net/netlink.h @@ -143,6 +143,11 @@ static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value, #endif +#ifndef HAVE_NLA_PARSE_DEPRECATED_STRICT +#define nla_parse_nested_deprecated nla_parse_nested +#define nla_parse_deprecated_strict nla_parse +#define genlmsg_parse_deprecated genlmsg_parse + #ifndef HAVE_NETLINK_EXT_ACK struct netlink_ext_ack; @@ -153,7 +158,8 @@ static inline int rpl_nla_parse_nested(struct nlattr *tb[], int maxtype, { return nla_parse_nested(tb, maxtype, nla, policy); } -#define nla_parse_nested rpl_nla_parse_nested +#undef nla_parse_nested_deprecated +#define nla_parse_nested_deprecated rpl_nla_parse_nested static inline int rpl_nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, int len, @@ -162,8 +168,10 @@ static inline int rpl_nla_parse(struct nlattr **tb, int maxtype, { return nla_parse(tb, maxtype, head, len, policy); } -#define nla_parse rpl_nla_parse +#undef nla_parse_deprecated_strict +#define nla_parse_deprecated_strict rpl_nla_parse #endif +#endif /* HAVE_NLA_PARSE_DEPRECATED_STRICT */ #ifndef HAVE_NLA_NEST_START_NOFLAG static inline struct nlattr *rpl_nla_nest_start_noflag(struct sk_buff *skb, diff --git a/datapath/meter.c b/datapath/meter.c index 8cecd5a..92c9c36 100644 --- a/datapath/meter.c +++ b/datapath/meter.c @@ -239,9 +239,11 @@ static struct dp_meter *dp_meter_create(struct nlattr **a) struct nlattr *attr[OVS_BAND_ATTR_MAX + 1]; u32 band_max_delta_t; - err = nla_parse((struct nlattr **)&attr, OVS_BAND_ATTR_MAX, - nla_data(nla), nla_len(nla), band_policy, - NULL); + err = nla_parse_deprecated_strict((struct nlattr **)&attr, + OVS_BAND_ATTR_MAX, + nla_data(nla), + nla_len(nla), + band_policy, NULL); if (err) goto exit_free_meter; diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c index 70ed376..79331c9 100644 --- a/datapath/vport-vxlan.c +++ b/datapath/vport-vxlan.c @@ -99,8 +99,8 @@ static int vxlan_configure_exts(struct vport *vport, struct nlattr *attr, if (nla_len(attr) < sizeof(struct nlattr)) return -EINVAL; - err = nla_parse_nested(exts, OVS_VXLAN_EXT_MAX, attr, exts_policy, - NULL); + err = nla_parse_nested_deprecated(exts, OVS_VXLAN_EXT_MAX, attr, + exts_policy, NULL); if (err < 0) return err; From patchwork Fri Mar 6 22:37:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1250653 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=TxnGfuU7; 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 48Z2ZD0q1Qz9sPg for ; Sat, 7 Mar 2020 09:37:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 128268702C; Fri, 6 Mar 2020 22:37:54 +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 M7AX5FgiSNmb; Fri, 6 Mar 2020 22:37:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 013108701E; Fri, 6 Mar 2020 22:37:40 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D90E5C1D91; Fri, 6 Mar 2020 22:37:39 +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 A1094C18DA for ; Fri, 6 Mar 2020 22:37:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8B0AA86F9A for ; Fri, 6 Mar 2020 22:37:37 +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 NCEAgyFqr2hZ for ; Fri, 6 Mar 2020 22:37:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by fraxinus.osuosl.org (Postfix) with ESMTPS id CB83A86FB6 for ; Fri, 6 Mar 2020 22:37:34 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id n24so1712457pgk.11 for ; Fri, 06 Mar 2020 14:37:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZaY/N8CK5/9LvUVkgh0mZwHiAJD4KH9zbrhsgy2tGR8=; b=TxnGfuU7UFORfySwNtb0ikfmE3KmGfwBlwOtoHAOFLpz1+LPdkno1FkJZp3dHS2iMW XlaRudeAyQxoW2wkKrQZ7OdUTmf5+IcAZU3/x8ORzWfT39QC2jp3sOEMcdlQL4D5u3Iz 9x0dzZuyQlGKAfhdlfuLPhblnuN8vQmRtwaYGoOWG9dpJe8k+CUbUzOKemn2Dn8vXlqr 40ngtfeRUaLRMnCG6jYlH9+xMi+lfnJSUl8snWhhxwkxPFZxIkJ7UdbjDwX6eBP11KFQ Rj5Y1Cm9NntPZP+vVGrpbkYeJYoluGrgHO8nu+PQ/MNbT8OgviBtD2wD53tyK72ySFos ViiA== 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=ZaY/N8CK5/9LvUVkgh0mZwHiAJD4KH9zbrhsgy2tGR8=; b=BNP9doxpq0QE0M7ujloe9cSkIIfzaZ6/Q3bmG584Y4Q6FnBFulp6s04XhERfXRkQB9 NMSBwLhydKgltW4WhwytFvxw+pMIJEJr0HixUkGwAITlrYVo/AvoMmqbud0rsu9Nrd5m SXMJuTOHU0SLWZA1mGivSpYaX+nFL9rT3eCfweYd/v9FZ9gGTuX30sSL1zWia5n60Ur7 wWoagalqe1ujft+Mj30CpNFrcnu5U4i4/Q7Jxhh+I4cQmFCRQrRPXPOfKrK2gFN8D+EB /alPYK6chiPN802fU4MfwSdOPjbbMym6j5CO1YtbX6i5SZSZorhC+Mo6PQItsNBnQp8P Wl7g== X-Gm-Message-State: ANhLgQ3NNz73+H0FOe0wu839nTgLl/jcsewcchgGqA1oremH0DyAa8W2 6kgcncJGQ/zaE2KJHk2cZMQgJlEx7yk= X-Google-Smtp-Source: ADFU+vvtVMbUkppMoksDRD2lQz6sB42ep/ZKDA0SiicsQBwDhTebhCMwS5/uup3dTYXcklE6Tagd+w== X-Received: by 2002:a63:42c2:: with SMTP id p185mr5680903pga.268.1583534254179; Fri, 06 Mar 2020 14:37:34 -0800 (PST) Received: from gizo.domain (97-115-106-43.ptld.qwest.net. [97.115.106.43]) by smtp.gmail.com with ESMTPSA id k3sm35939602pgh.34.2020.03.06.14.37.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2020 14:37:33 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 6 Mar 2020 14:37:20 -0800 Message-Id: <1583534241-16600-9-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> References: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> Cc: "Gustavo A. R. Silva" Subject: [ovs-dev] [PATCH V4 8/9] datapath: conntrack: mark expected switch fall-through 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: "Gustavo A. R. Silva" Upstream commit: commit 279badc2a85be83e0187b8c566e3b476b76a87a2 Author: Gustavo A. R. Silva Date: Thu Oct 19 12:55:03 2017 -0500 openvswitch: conntrack: mark expected switch fall-through In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Notice that in this particular case I placed a "fall through" comment on its own line, which is what GCC is expecting to find. Signed-off-by: Gustavo A. R. Silva Signed-off-by: David S. Miller Acked-by: Yi-Hung Wei Signed-off-by: Greg Rose --- datapath/conntrack.c | 1 + 1 file changed, 1 insertion(+) diff --git a/datapath/conntrack.c b/datapath/conntrack.c index b7eb53f..5b4d6cc 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -844,6 +844,7 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct, } } /* Non-ICMP, fall thru to initialize if needed. */ + /* fall through */ case IP_CT_NEW: /* Seen it before? This can happen for loopback, retrans, * or local packets. From patchwork Fri Mar 6 22:37:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1250654 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=o2vtgtby; 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 48Z2ZK50P7z9sPJ for ; Sat, 7 Mar 2020 09:38:01 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 38C93884A1; Fri, 6 Mar 2020 22:38:00 +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 Kj1wghnSQWg8; Fri, 6 Mar 2020 22:37:57 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id C4C60884D4; Fri, 6 Mar 2020 22:37:43 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A0719C1D91; Fri, 6 Mar 2020 22:37:43 +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 F3BCEC013E for ; Fri, 6 Mar 2020 22:37:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D965587053 for ; Fri, 6 Mar 2020 22:37:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S0Zc-FBR-5Km for ; Fri, 6 Mar 2020 22:37:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by fraxinus.osuosl.org (Postfix) with ESMTPS id DE1FF86ED4 for ; Fri, 6 Mar 2020 22:37:35 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id m15so1715828pgv.12 for ; Fri, 06 Mar 2020 14:37:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BVJ11f3X6+xDDfVTG+I4ClcwV7JMv69zUQVUl5UpPkg=; b=o2vtgtbyCmeG6dyUHE/6PDu52RqqudM0cBkGvzvXK6/GZrem6AxjDtQmwm0fIrkrjK zVpmVGcHRwLbSwsVubFqHVgf9U3pUmEXZgZoWn3RNs5u3EbVkmY9sJIPI55Tr+J9jEgo NbakNK/xNxDT+Bfr0qk4XfIuzHqed8lRxhIvG/nW0DpAS5+Opae0brh4uCioj4ivjfmT yjZHI7Q+oF25zeaBiefIodX/ay8Q6Vd0e4TQqWH9pQm22wvqA2LkqdGhMB89PZo3haWH nW0v3sFfpZjbOEdw8HQEQfv5qsDRq5lO/3EiPkM5dX4xMvGqFKfjtRfciA/iq8atvn+d WFeQ== 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=BVJ11f3X6+xDDfVTG+I4ClcwV7JMv69zUQVUl5UpPkg=; b=MC4apoc/0qxMovFS7ccBkZO5i5Q7mbLYKB1q4XmUMV8sSl6zUAUvTSBlFT25QchLmM 0nGn7EI9N4sNOoOakNEXDbVXwnfFX5PlmJtnG71Z5/MKv3FZTX1t3ckwo49+nCPu4tr1 YTApVlGc36Aym7F96VRHndkzaOZbbqCaQqsON0/0HyMO4IXFtgMlw1jGJcjo9ZgWkPbs 7a0HVsgQzLrfNrUBKvH1bxvh5JUVzh/QRO13B/JVcIHJOovY40rcv6epLz3IL+2mNbTC m0Tdjl2T+2W1AnIIpHAlsmjhQGX6oaEQdjFUS2YRkrs634glND6CGnLy6Ry+budwJPVP mVMA== X-Gm-Message-State: ANhLgQ1glKNQQEw070MzSlUgeRN+yiJN+2nTn4cf7c8XMTcs7gf8n7tU 1vbp7CN5ejUqsBq47EFXjounsYQPnFA= X-Google-Smtp-Source: ADFU+vvxHeXenF/ODGEvNLPmTqu3OB3+SXFL/FBCq/l53ST/bjpgF0fCYAENyaZK+9NMF38743KONQ== X-Received: by 2002:aa7:8501:: with SMTP id v1mr5955190pfn.73.1583534255212; Fri, 06 Mar 2020 14:37:35 -0800 (PST) Received: from gizo.domain (97-115-106-43.ptld.qwest.net. [97.115.106.43]) by smtp.gmail.com with ESMTPSA id k3sm35939602pgh.34.2020.03.06.14.37.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2020 14:37:34 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 6 Mar 2020 14:37:21 -0800 Message-Id: <1583534241-16600-10-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> References: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 9/9] datapath: Update kernel test list, news and FAQ 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" We are adding support for Linux kernels up to 5.5 so update the Travis test list, NEWS and FAQ. Signed-off-by: Greg Rose --- V4 -- Fix up release note to state the 5.5 support is added to branch 2.14. --- .travis.yml | 2 +- Documentation/faq/releases.rst | 1 + NEWS | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index abd2a91..ef9f867 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,7 @@ env: - TESTSUITE=1 OPTS="--enable-shared" - TESTSUITE=1 DPDK=1 - TESTSUITE=1 LIBS=-ljemalloc - - KERNEL_LIST="5.0 4.20 4.19 4.18 4.17 4.16" + - 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" - AFXDP=1 KERNEL=5.3 - M32=1 OPTS="--disable-ssl" diff --git a/Documentation/faq/releases.rst b/Documentation/faq/releases.rst index 6ff47d7..748540b 100644 --- a/Documentation/faq/releases.rst +++ b/Documentation/faq/releases.rst @@ -70,6 +70,7 @@ Q: What Linux kernel versions does each Open vSwitch release work with? 2.10.x 3.10 to 4.17 2.11.x 3.10 to 4.18 2.12.x 3.10 to 5.0 + 2.14.x 3.10 to 5.5 ============ ============== Open vSwitch userspace should also work with the Linux kernel module built diff --git a/NEWS b/NEWS index 872e186..32ca2e0 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ Post-v2.13.0 - DPDK: * Deprecated DPDK pdump packet capture support removed. * Deprecated DPDK ring ports (dpdkr) are no longer supported. + - Linux datapath: + * Support for kernel versions up to 5.5.x. v2.13.0 - 14 Feb 2020