From patchwork Tue Jan 30 23:40:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867714 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="q1ql4Lsb"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNDh47MFz9s75 for ; Wed, 31 Jan 2018 10:41:08 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 40709F23; Tue, 30 Jan 2018 23:40:36 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 6F1E9EB8 for ; Tue, 30 Jan 2018 23:40:34 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 21F452F6 for ; Tue, 30 Jan 2018 23:40:34 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id e76so10687742pfk.1 for ; Tue, 30 Jan 2018 15:40: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=itJEjix1S6jHlqBref7rhz5IZXoReuqLnxI1sIjiC08=; b=q1ql4Lsb+AUnPy7k3rVdAJtS12yTxWZEBkyvh3dGXRCdcTvmlMVwHFAjIHqIBzCBEv YyqAGAjBYpjMh0WIN/86veAYqQAnT9TkK3jeYpYY+fXP04Tq5TKOPybXEa5FpXBIGBYo LCPJXILKiZWrhmOjs9MA64O7smGfXEYA5p75+WwENYPWuDe2PrrIaQkIuwXipoT5klc/ bnpsqYiJR8ACO2DgkFKT/nzwARcYRQ0YXZT4FmuRwpWRvTdmZeyG6I40hV6uqNa7WlU/ UUEcZiFwqwkTMDSnk+7yN0YHhfvgU6VScWPfGNWFsA3UG5oyqQTfn8cbyhW2lxW+2XXV si8g== 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=itJEjix1S6jHlqBref7rhz5IZXoReuqLnxI1sIjiC08=; b=gxRT6WeZDCy1iM0XQ0DDSikG/Ovy0/Rrid0HQlQ3payxzd0EvHE1G0EHxOUzjwTw2e +gQ6rV34gfb0Rl8LRonzUr4v6AI4+a5Nawb49KGy3zcpWU08lrtyL8dZPMtLFAOiT/XD UPwL7hVHiPnXnrfjb1PxtOTVzGmKZtB9FBgw1xPhjJqNVO2BSjhWXtl69B1Cy0VNdpsz SJNxNpYjAQSt8ttYVpou65axG6dMIau2NLwTeqCkPAbmV9qBOtelbipErLqvFM50Skhl DSmQXAEHUlHMXFTQFjLyFVRINoK14maUVEkSdqe4Cerl+WW/+2Qdilx7+9Nled55wOj8 y2Zg== X-Gm-Message-State: AKwxytet/oZBGnFj3z7mapmhJAZWHORvoMfU2O/Xdk04mgtTNJedi95z oP2/mWDlkOEsv2XXmu7UWlXblA== X-Google-Smtp-Source: AH8x224i7w9WleCLHJkSHLoYz0enfiVCkDdyuZatZIYq8XID/Wiv/39JAEmSHRN9nhLvOpQcR/Ajdw== X-Received: by 10.98.8.86 with SMTP id c83mr31913173pfd.84.1517355633371; Tue, 30 Jan 2018 15:40:33 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:32 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:03 -0800 Message-Id: <1517355622-26114-2-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 01/20] datapath: Fix netdev_master_upper_dev_link for 4.14 X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org An extended netlink ack has been added for 4.14 - add compat layer changes so that it compiles for all kernels up to and including 4.14. Signed-off-by: Greg Rose --- acinclude.m4 | 3 +++ datapath/linux/compat/include/linux/netdevice.h | 15 ++++++++++++++- datapath/vport-netdev.c | 9 ++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index c04c2c6..768c20c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -795,6 +795,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [OVS_DEFINE([HAVE_LIST_IN_NF_HOOK_OPS])]) OVS_GREP_IFELSE([$KSRC/include/uapi/linux/netfilter/nf_conntrack_common.h], [IP_CT_UNTRACKED]) + OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h], + [netdev_master_upper_dev_link], [extack], + [OVS_DEFINE([HAVE_UPPER_DEV_LINK_EXTACK])]) if cmp -s datapath/linux/kcompat.h.new \ datapath/linux/kcompat.h >/dev/null 2>&1; then diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h index 3c3cf42..c460332 100644 --- a/datapath/linux/compat/include/linux/netdevice.h +++ b/datapath/linux/compat/include/linux/netdevice.h @@ -101,13 +101,26 @@ static inline bool netif_needs_gso(struct sk_buff *skb, #ifndef HAVE_NETDEV_MASTER_UPPER_DEV_LINK_RH static inline int rpl_netdev_master_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, - void *upper_priv, void *upper_info) + void *upper_priv, + void *upper_info, void *extack) { return netdev_master_upper_dev_link(dev, upper_dev); } #define netdev_master_upper_dev_link rpl_netdev_master_upper_dev_link #endif +#else +#ifndef HAVE_UPPER_DEV_LINK_EXTACK +static inline int rpl_netdev_master_upper_dev_link(struct net_device *dev, + struct net_device *upper_dev, + void *upper_priv, + void *upper_info, void *extack) +{ + return netdev_master_upper_dev_link(dev, upper_dev, upper_priv, + upper_info); +} +#define netdev_master_upper_dev_link rpl_netdev_master_upper_dev_link +#endif #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index 697c442..e2d8eaf 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -112,8 +112,15 @@ struct vport *ovs_netdev_link(struct vport *vport, const char *name) } rtnl_lock(); +#ifdef HAVE_NETDEV_MASTER_UPPER_DEV_LINK_RH err = netdev_master_upper_dev_link(vport->dev, - get_dpdev(vport->dp), NULL, NULL); + get_dpdev(vport->dp), + NULL, NULL); +#else + err = netdev_master_upper_dev_link(vport->dev, + get_dpdev(vport->dp), + NULL, NULL, NULL); +#endif if (err) goto error_unlock; From patchwork Tue Jan 30 23:40:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867715 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fO1Yjpj4"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNFV6pqYz9s75 for ; Wed, 31 Jan 2018 10:41:50 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 66568F63; Tue, 30 Jan 2018 23:40:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id CD71BE4B for ; Tue, 30 Jan 2018 23:40:35 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 89F5B2F6 for ; Tue, 30 Jan 2018 23:40:35 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id e76so10687793pfk.1 for ; Tue, 30 Jan 2018 15:40: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=+JNsr8BN2rVSh25YRG2EMvI/THXkRubNpMg9V3QYNLI=; b=fO1Yjpj4vmjWaXz/kZnRFbYFefZKt6+pHDRPH9kLCN623U8KEp6LteWNO938nT/yTG KiffT31Z9HHrSe/WKJwtFvUzz5sCTqxh9LfNxIaB6cqwVlXdaTiZV7iEio+GxFyslGbO 1glLY0CsCnCZNEv9M7ijEuknZMAiysFl6p+Qj0ExqXPd65nR89V/mohV00fdFU+8AuLz PWukCCknZ48bFie4G8MNzbKxHNIX4W8VbtoZ+shUH+crwM3GfVOhgl6XrBACy0sPoN/E 51RpxhCiylv2jwPV2R75HJ60He4bLolzupWdB+iABFdfxsK6W4vOm6hviIxJA4jhSX7k jHXg== 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=+JNsr8BN2rVSh25YRG2EMvI/THXkRubNpMg9V3QYNLI=; b=R87SBBBQF+UVNiwJ9HDpev4v/9PKVqGA/1Nfc0tl4ujlZw99kptIjqio40niddvvY4 umQje01XCJKHr37QLrzeRzBIOUHj6KDhWBvXnlkIcO52NYe98wGCh3ICPPFgStZ93EOX Y9YaQQrab31Lc9vqEyQfXcbUcro9FJ/Hiq8IP45CMNHSrLuWhmFmNqj7s+bctikkRGYF SvfL7qPFGN60CiaWMiH5LSFPFcpEqQQZCuwbXlCgQsioyotoFkqZHT2lDvnXu9pMJYo6 m923WBff9ZA4V6xYlbU5L4IGLe1AHMqvc5GQWkY1WsOF0FgNsrWKgF5cA8LA00y9Vqmr ZwoA== X-Gm-Message-State: AKwxyteM7mJsB007zQhKkppwenrGyAxfUdPKRGReQF5J4dF7telLg22h BkOvU1tzO8g75/rwrs8b/GQFlA== X-Google-Smtp-Source: AH8x227hRnC6eBYPn0hkORJpaZ8ZvIQKIL5LQmCtv+cALVF66zS1p6HEs6vDDUG2939ziHCQLcoW6g== X-Received: by 10.99.51.133 with SMTP id z127mr25186662pgz.324.1517355634767; Tue, 30 Jan 2018 15:40:34 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:33 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:04 -0800 Message-Id: <1517355622-26114-3-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 02/20] compat: Do not include headers when not compiling X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org If the entire file is not going to be compiled because OVS is using upstream tunnel support then also don't bother pulling in the headers. Signed-off-by: Greg Rose --- datapath/linux/compat/ip_gre.c | 2 +- datapath/linux/compat/ip_output.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index 94fdaa9..4e32591 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -12,6 +12,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#ifndef USE_UPSTREAM_TUNNEL #include #include #include @@ -52,7 +53,6 @@ #include #include -#ifndef USE_UPSTREAM_TUNNEL #if IS_ENABLED(CONFIG_IPV6) #include #include diff --git a/datapath/linux/compat/ip_output.c b/datapath/linux/compat/ip_output.c index edca340..e2f869f 100644 --- a/datapath/linux/compat/ip_output.c +++ b/datapath/linux/compat/ip_output.c @@ -45,6 +45,7 @@ * Hirokazu Takahashi: sendfile() on UDP works now. */ +#ifndef HAVE_CORRECT_MRU_HANDLING #include #include #include @@ -82,7 +83,6 @@ #include #include -#ifndef HAVE_CORRECT_MRU_HANDLING static inline void rpl_ip_options_fragment(struct sk_buff *skb) { unsigned char *optptr = skb_network_header(skb) + sizeof(struct iphdr); From patchwork Tue Jan 30 23:40:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867716 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tyiLQuU1"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNG64VpZz9s75 for ; Wed, 31 Jan 2018 10:42:22 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 49BB2F5D; Tue, 30 Jan 2018 23:40:41 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id B6E18F46 for ; Tue, 30 Jan 2018 23:40:37 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id EB8782F6 for ; Tue, 30 Jan 2018 23:40:36 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id e76so10687856pfk.1 for ; Tue, 30 Jan 2018 15:40:36 -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=q+oJqWUt+36aa3PdyrtuHLdgJ6/Q1/1mTd4hpGFHmhE=; b=tyiLQuU1ZGDb1ijsGMok7wtM8hu+5puGQbyxRJsq8DGD2tw06NIV2RVBBGlKOLAMlD wse8rZjJpGenp6wFSSrRpLk3xesYWnZw8dFFh35JrlHeMGeqqLNxihxYK0El0rkf8HXk QxFpw7VCF6sBHNqg6hydxKcWNmNh5xRROBbJjVqooC3Qrvpp+LuYPAM8tUhKitzr9k6N bU4UMiQyMsBM5E0dFrRS30X9g4rMEkWfLLhM9fa9JgUDB049gryOCBAdKzbw/ZWjIftv W8O4iOC/CiR5ImlYYPzPe1UHkG/ni8hWzh6aggjktO1to586ZgDRfZ9mSqVzpef1vooN v2dQ== 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=q+oJqWUt+36aa3PdyrtuHLdgJ6/Q1/1mTd4hpGFHmhE=; b=fTQj77N9ZnsiG62Cmdhsh6pMiSCYwv1tXYg9TBGisyuZ6ihd3+lOe4oKxUthiPSAZt A7Frs7dDFOSNKgMJn1nDWk6RTYtXZ8WEb8TTY3eG0bWjVlx+s0YvhqtKgxuGrk3++5bs fgYRpDIuFSseMEYpBocgYCBuurXPOcy+DyCo7OfWT5xKVsTljeAOSwUY4tPmheGEcDtX W5gpqhqyrFugxa+suHOGPcFFcpvEmxdK/wNIkbTQr8TNWtfdLyhpiQ2GVN24JDLCJW2V WLDZ325QA7HBrg7UpPuqhL04d7vZkHkmv+aCT1ep4292cy9AVNK66II9sqIJpHhxuo3k L8sA== X-Gm-Message-State: AKwxytdLgaQG4/YU3nLyPu9ngDAcr5hW7zGfEmQ0CYF64NT79wClAqpB YNAkez+c+WQf+WgFfi+yYolyKg== X-Google-Smtp-Source: AH8x227Ju04eY5nF3PS2jR8/z0M5cHi3i03Z3WvE8QAG0n666/y2oy4p4Lu7Qwt4o0nN/sc4QmgH3w== X-Received: by 10.98.66.152 with SMTP id h24mr31679074pfd.13.1517355636195; Tue, 30 Jan 2018 15:40:36 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:35 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:05 -0800 Message-Id: <1517355622-26114-4-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Florian Westphal Subject: [ovs-dev] [PATCH 03/20] datapath: conntrack: make protocol tracker pointers const X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Florian Westphal Upstream commit: commit b3480fe059ac9121b5714205b4ddae14b59ef4be Author: Florian Westphal Date: Sat Aug 12 00:57:08 2017 +0200 netfilter: conntrack: make protocol tracker pointers const Doesn't change generated code, but will make it easier to eventually make the actual trackers themselvers const. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Rose --- datapath/conntrack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datapath/conntrack.c b/datapath/conntrack.c index 3f79433..a75ae3c 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -613,8 +613,8 @@ static struct nf_conn * ovs_ct_find_existing(struct net *net, const struct nf_conntrack_zone *zone, u8 l3num, struct sk_buff *skb, bool natted) { - struct nf_conntrack_l3proto *l3proto; - struct nf_conntrack_l4proto *l4proto; + const struct nf_conntrack_l3proto *l3proto; + const struct nf_conntrack_l4proto *l4proto; struct nf_conntrack_tuple tuple; struct nf_conntrack_tuple_hash *h; struct nf_conn *ct; From patchwork Tue Jan 30 23:40:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867717 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="pBGNLZK5"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNGk0Kyfz9s75 for ; Wed, 31 Jan 2018 10:42:54 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 3E5F1F6D; Tue, 30 Jan 2018 23:40:42 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C65BBF30 for ; Tue, 30 Jan 2018 23:40:38 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 7799B2F6 for ; Tue, 30 Jan 2018 23:40:38 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id k19so10667446pfj.5 for ; Tue, 30 Jan 2018 15:40:38 -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=g+vzTWQ6n1On+HtcTZ9+cQlxh0C8VU224aZTsIOCIwk=; b=pBGNLZK51ljjv1NDn7I9F63GRwJgnVUBv4IGHO4ng2hmvs6uxr/djVtlsmNGIwyrOl OcWxKStFjo4/61njFpCLStaKID1SVNUJLJYIQJO405n1BM9bV/Jq4eIs5/TETIMUJZcY GL0iBKjRFROWy75ZH+VXEO7UOicbW4NctTLLLrj74AmrfC+zts48qTYH68MNAjyWgQwm x9Uv82EwXxmJlHKhBd+tezXmwBRQwGOzOWshDa0erKB9l8Zec7Rxd0h0Uy6lsJMFcSWU 7SYld7FDEW3De9vn/q/5FU9QvLN/tSEjcM+mixYM3TqMc2tZ3hWquA11hgxydQK2jiCK 4g6g== 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=g+vzTWQ6n1On+HtcTZ9+cQlxh0C8VU224aZTsIOCIwk=; b=M6WEdUsQ3ubZekB8mM617ZoraX22mfn8xzySDSHYDvd61Yf+pgBN0GYHshxXsncWlZ tk3hIuhLTPqF97pE2iVF61DJtfNGUwKwXVRKs8T7vzapDfakXQl/lxtYrxgwMJZgVms/ Ttkf+aki/+OdJm7MiQO+Uh72Li7AztbFUg5hCsUuHjGdh8ll3NY/pfzDkndy3qDxw7eN dYeNg/5xKl0KO5jfb2kC2usDnsN37L28YbLFxwtu1z+Me64lEDV7l2qadPKAfMnZu3cl 9MG+2M8v4pUCeKm04p4ja/DMfkz3YUN2VBEX7B5/GJKJj0gCcnUsjaALDCMWEKuJTOGD 0FqA== X-Gm-Message-State: AKwxyteXs/2sDDyC9G8rNqN19vB3QoCvePBFd8MC28q180NnnrBcaV83 velIOKVlCuhP3gp9ja7yJrCGEg== X-Google-Smtp-Source: AH8x227B8A7dtGt9LRth/TnTGjxOYgN/i8fI0/hozUY29xT5hgjQ5AeiVhWnoEqUNAJYH15vTRFLPg== X-Received: by 2002:a17:902:9044:: with SMTP id w4-v6mr26922850plz.354.1517355637667; Tue, 30 Jan 2018 15:40:37 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:36 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:06 -0800 Message-Id: <1517355622-26114-5-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 04/20] datapath: Fix SKB_GSO_UDP usage X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Using SKB_GSO_UDP breaks the compilation on Linux 4.14. Check for the HAVE_SKB_GSO_UDP compiler #define. Signed-off-by: Greg Rose --- datapath/datapath.c | 9 ++++++--- datapath/linux/compat/stt.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 1780819..a3fdd8f 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -339,8 +339,10 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, const struct dp_upcall_info *upcall_info, uint32_t cutlen) { +#ifdef HAVE_SKB_GSO_UDP unsigned short gso_type = skb_shinfo(skb)->gso_type; struct sw_flow_key later_key; +#endif struct sk_buff *segs, *nskb; struct ovs_skb_cb ovs_cb; int err; @@ -352,7 +354,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, return PTR_ERR(segs); if (segs == NULL) return -EINVAL; - +#ifdef HAVE_SKB_GSO_UDP if (gso_type & SKB_GSO_UDP) { /* The initial flow key extracted by ovs_flow_key_extract() * in this case is for a first fragment, so we need to @@ -361,14 +363,15 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, later_key = *key; later_key.ip.frag = OVS_FRAG_TYPE_LATER; } - +#endif /* Queue all of the segments. */ skb = segs; do { *OVS_CB(skb) = ovs_cb; +#ifdef HAVE_SKB_GSO_UDP if (gso_type & SKB_GSO_UDP && skb != segs) key = &later_key; - +#endif err = queue_userspace_packet(dp, skb, key, upcall_info, cutlen); if (err) break; diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c index 37d5f4b..66a97f2 100644 --- a/datapath/linux/compat/stt.c +++ b/datapath/linux/compat/stt.c @@ -81,8 +81,13 @@ struct stt_dev { #define STT_PROTO_TCP BIT(3) #define STT_PROTO_TYPES (STT_PROTO_IPV4 | STT_PROTO_TCP) +#ifdef HAVE_SKB_GSO_UDP #define SUPPORTED_GSO_TYPES (SKB_GSO_TCPV4 | SKB_GSO_UDP | SKB_GSO_DODGY | \ SKB_GSO_TCPV6) +#else +#define SUPPORTED_GSO_TYPES (SKB_GSO_TCPV4 | SKB_GSO_DODGY | \ + SKB_GSO_TCPV6) +#endif /* The length and offset of a fragment are encoded in the sequence number. * STT_SEQ_LEN_SHIFT is the left shift needed to store the length. @@ -1310,7 +1315,7 @@ static bool validate_checksum(struct sk_buff *skb) static bool set_offloads(struct sk_buff *skb) { struct stthdr *stth = stt_hdr(skb); - unsigned short gso_type; + unsigned short gso_type = 0; int l3_header_size; int l4_header_size; u16 csum_offset; @@ -1351,7 +1356,9 @@ static bool set_offloads(struct sk_buff *skb) case STT_PROTO_IPV4: /* UDP/IPv4 */ csum_offset = offsetof(struct udphdr, check); +#ifdef HAVE_SKB_GSO_UDP gso_type = SKB_GSO_UDP; +#endif l3_header_size = sizeof(struct iphdr); l4_header_size = sizeof(struct udphdr); skb->protocol = htons(ETH_P_IP); @@ -1359,7 +1366,9 @@ static bool set_offloads(struct sk_buff *skb) default: /* UDP/IPv6 */ csum_offset = offsetof(struct udphdr, check); +#ifdef HAVE_SKB_GSO_UDP gso_type = SKB_GSO_UDP; +#endif l3_header_size = sizeof(struct ipv6hdr); l4_header_size = sizeof(struct udphdr); skb->protocol = htons(ETH_P_IPV6); From patchwork Tue Jan 30 23:40:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Whu9oSQH"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNHJ6hbgz9s75 for ; Wed, 31 Jan 2018 10:43:24 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2BC9DF77; Tue, 30 Jan 2018 23:40:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 469C3E33 for ; Tue, 30 Jan 2018 23:40:40 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 03B702F6 for ; Tue, 30 Jan 2018 23:40:40 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id 23so10681041pfp.3 for ; Tue, 30 Jan 2018 15:40:40 -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=H72bzzI7FALis+Zr/WFa5qrWSREzbsn9mmJriJygh40=; b=Whu9oSQHBkb8aVaQ4uLT8vzfHzya7a5Co50lu0n/m7/Y80IANEIRS6WWFTgA552Sle RSTxcrcKHACMNpw1IjGs0D6cO23zMx5+2tqNgz4RnsxqjDqFU9L7MTykCW/QfvXRodgb EXR13U4boP9gazqN4S2ImORWV4q3KMHVx+o1IM8Y1K7nWw/7eQ8FG+P7/JNnNu9M1FrB ya6BlyUenuPoEUMHTN93PU0nGIdmRYew7WK0yQRtpPU3vJLvgtHZ24Kt67hxvbTbvqSf Vz5N1vL5d1opmv4x08IWkm0hKmRO4AyiiywZqgBW0RiKmcvj8+2zUt74/w5RTO60JMMk uVwg== 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=H72bzzI7FALis+Zr/WFa5qrWSREzbsn9mmJriJygh40=; b=kraTyVBzwFFeyfcY4Jwieg1gmM5zMusZf7ub1pK3Mnpswq5iG2Sdiy18LJvZS/O4jW T2vd6Imvm6SSBJq5Q+zhrV0nL5uL0kXIYmcYuIdF2sW9HkeB+1ElgGQePJHg/QNCB4vy b5Gyv5e+vVAa0MvOkPUYY7JrGQvSj4KVh5FrAefKsO1FGM50msIjPomO22NoA76nWlNL kNaexDWDJSyiqGlW42gr18Pr0pGXcCjvDvgrXTho5OwkoOV2gbrM695136Fm0YyOoVZ9 C+rcgKAeoE/bw0vaqsAneRthZuNMMIRFkiG40G7KvVftYrT5Io+I7WQC5d94GB3uCotg jU/Q== X-Gm-Message-State: AKwxytf358SDFUc2q4vAdX8kWXIyAgrM+eW4pZI1muCYeiQDwuClb042 +C6aWCd0WI91Qfs+rKDELR6I6g== X-Google-Smtp-Source: AH8x227CoGL8VU7Bkro/osbcRTaAeC2N2+e8KXLY+NQtIaaLmIOBdsqO1eOcRnJ2uEx+AvTtp9Zm2w== X-Received: by 10.99.66.68 with SMTP id p65mr24225347pga.384.1517355639257; Tue, 30 Jan 2018 15:40:39 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:38 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:07 -0800 Message-Id: <1517355622-26114-6-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 05/20] acinclude.m4: Enable Linux 4.14 X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Signed-off-by: Greg Rose --- acinclude.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 768c20c..d0f9d82 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -151,10 +151,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [ AC_MSG_RESULT([$kversion]) if test "$version" -ge 4; then - if test "$version" = 4 && test "$patchlevel" -le 13; then + if test "$version" = 4 && test "$patchlevel" -le 14; then : # Linux 4.x else - AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.13.x is not supported (please refer to the FAQ for advice)]) + AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.14.x is not supported (please refer to the FAQ for advice)]) fi elif test "$version" = 3 && test "$patchlevel" -ge 10; then : # Linux 3.x From patchwork Tue Jan 30 23:40:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867719 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TwvOta/p"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNHv4xqpz9s75 for ; Wed, 31 Jan 2018 10:43:55 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 30056F7B; Tue, 30 Jan 2018 23:40:47 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9B194F68 for ; Tue, 30 Jan 2018 23:40:41 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6C739306 for ; Tue, 30 Jan 2018 23:40:41 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id j16so7133045pgn.9 for ; Tue, 30 Jan 2018 15:40:41 -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=vcX/iWiQHx+GPKkCWq54xbXetwatJAyIrEWu/JxvBBg=; b=TwvOta/pUZrJ+8I0PX3XOYetMx1FC3qi0ZgW2KNh3TUhD4LAiWffgihV1YD66UbVG9 QKjbu7V93t1QbfuLkK46txILKeMBIFJno5JZB6BbwsFYofifeVBtgB9AcX6BXbCEltvd BVF3Q4I+buRDUuLlntLJ+szJXbxNLs/eV+aj2Ot5wbwOeUjT07r9RMoesZ2mFX+yX1oE HNyPAWo5ET0fTWLkEP0W7KELRQ++wGaQ5N0jAF9BI9OqDObfaOHlCoiRYHi2PSBGSoUo VwApvFnPFGc3HWdG1vEet3uAm/7xw1eX4hm4vN247Y7ctKIMsikFAn8iO9K3aTpLiMN4 a+Nw== 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=vcX/iWiQHx+GPKkCWq54xbXetwatJAyIrEWu/JxvBBg=; b=bt3A+H2cbCxgj7p9d6bw8niSvtYTPGOtCtYUSxjpSKgzkc3HOrMXKURM5jDJIiyoWt Qst0MMzUj+DM3s2sJcbTVEPtMNltR0em2k6P5KSvAg56UzuSwwBrFAgBG9vGki4XNf3q 1TpLfRmzDbkGiUfRujoOkYwDV5u4EnU1OV0terXgVbk14U+Cf3yNdpF51rwPeTXfu56o 1dDdEM3LYqcPMX7qqJKGHbyA2iDyWZ0ZNYF/aT7Sh+LRSRD88ShHuu7c93Tc31BReB0j UFJoOVVbNKctg3VfYw+Fzs3K3MGH2GNGzvEOb/CK2BtCuBVXJuUKJ15leWKmIcUqVscA ue5Q== X-Gm-Message-State: AKwxytc/5mxgmLaQJGEcQ0qoeBOQyxjovKerdhPBw0daOgpwhOCXQsON MnJnzjlhQfSfxZNyt0QHCS2Iww== X-Google-Smtp-Source: AH8x226Yn26q/kROCMC38MkYUaqVH0mzZO558/imaSVLb4ogX5qJmgeLK5nEYZsWdPR4nUdBy7URTQ== X-Received: by 2002:a17:902:52cb:: with SMTP id a69-v6mr21001277pli.143.1517355640579; Tue, 30 Jan 2018 15:40:40 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:39 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:08 -0800 Message-Id: <1517355622-26114-7-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 06/20] travis: Update kernel test list from kernel.org X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Signed-off-by: Greg Rose --- .travis.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 48acc8e..88bdda2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,17 +26,16 @@ sudo: false env: - OPTS="--disable-ssl" - - TESTSUITE=1 KERNEL=3.16.47 + - TESTSUITE=1 KERNEL=3.16.53 - TESTSUITE=1 OPTS="--enable-shared" - BUILD_ENV="-m32" OPTS="--disable-ssl" - - KERNEL=3.16.47 DPDK=1 - - KERNEL=3.16.47 DPDK=1 OPTS="--enable-shared" - - KERNEL=4.13 - - KERNEL=4.12.11 - - KERNEL=4.9.48 - - KERNEL=4.4.87 - - KERNEL=4.1.43 - - KERNEL=3.10.107 + - KERNEL=3.16.53 DPDK=1 + - KERNEL=3.16.53 DPDK=1 OPTS="--enable-shared" + - KERNEL=4.14.15 + - KERNEL=4.9.78 + - KERNEL=4.4.113 + - KERNEL=4.1.49 + - KERNEL=3.10.108 - TESTSUITE=1 LIBS=-ljemalloc matrix: From patchwork Tue Jan 30 23:40:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867720 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="EAOqgZ6s"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNJX5t2pz9s82 for ; Wed, 31 Jan 2018 10:44:28 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 188F0F81; Tue, 30 Jan 2018 23:40:48 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 67436F30 for ; Tue, 30 Jan 2018 23:40:43 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 227D5334 for ; Tue, 30 Jan 2018 23:40:43 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id a88so10669360pfe.12 for ; Tue, 30 Jan 2018 15:40:43 -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=3cKP0blPIlKfHFLw7XOX0r7TmGQohKMDllKcaZB+5Dg=; b=EAOqgZ6sT3PKyncZml5vFnrObKg8HxxFczQRM/LFbzK/r/SVQ8kPpwWv8HMpcjQ2wm NBKHlJonsBLduoK5VzhhST3+otbgfc9fldcVXONtq6dS2yvs5fsKRfflU/ko2NmGfKjb 1uAz0FKPxNbGLe9+oXZPNL3i043W6Ge1r+cBkzdq1fdPq1bsVXqGiZ14/juaS6J6sxbN Z7PQ+8lR3RA6xFvaAJ1PBpCss8aDwnIPspokReHpeDlbb68shY0le+VVqj2UB78VAyqV RrZcwHE24lFa4k5Ohy9+RlBXF4lg4jLn6TMrBLXML9W1HRd2VxmOAbxx4csD87+9y3qI fllQ== 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=3cKP0blPIlKfHFLw7XOX0r7TmGQohKMDllKcaZB+5Dg=; b=NaZhAdBifQEgzgYfx+ohHuZMPhkaTjlfXVH4u6r124jXneoX7EY1c8ErA7Juz+7U9i XRFCgG2i/vGdRw8SPd37moUNivA9E6V4q9BCqdLpCNGKkn83xsry+qZY6Ao9kt7rs8ZP EoWopNr8ZMgvHRfLyePt0AW3S5wiSR91X0zEy/4fZhJG63l00ELdhAmDvFpWcsB7/PzX tuhzVFSzXWfarJGSN4UUj7/0YM1/MzkL8ZdAIm8/Dxu5gm24HsSzLjqlHKHpUu2fM02J FwDc9tpCAHoKwrzTDfL6ZGtcQZyWVY7/3SmlhV0FpUJ6url+w23gt7/W1fczxXd+rMnu rQnw== X-Gm-Message-State: AKwxytfa1QozbMIvcOIavoX66I/MKlelVhPbw/Ro3MYgya8EdCGcOqlH xW0bkLs+/IEJeSn5nGJI8uLdOw== X-Google-Smtp-Source: AH8x2264lMKDkzTbHR0JKi4mRQkhmCGFW/vB9URJxSXt2jPdM7LZUdZcM+GsNivuLqrmE9G3FP+URQ== X-Received: by 10.101.101.144 with SMTP id u16mr24566025pgv.73.1517355642365; Tue, 30 Jan 2018 15:40:42 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:41 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:09 -0800 Message-Id: <1517355622-26114-8-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 07/20] compat: Fix compiler headers X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Since Linux kernel upstream commit d15155824c50 ("linux/compiler.h: Split into compiler.h and compiler_types.h") this error check for the gcc compiler header is no longer valid. Remove so that openvswitch builds for linux kernels 4.14.8 and since. Signed-off-by: Greg Rose --- acinclude.m4 | 3 +++ datapath/linux/compat/include/linux/compiler-gcc.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index d0f9d82..a838a46 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -798,6 +798,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h], [netdev_master_upper_dev_link], [extack], [OVS_DEFINE([HAVE_UPPER_DEV_LINK_EXTACK])]) + OVS_GREP_IFELSE([$KSRC/include/linux/compiler_types.h], + [__LINUX_COMPILER_TYPES_H], + [OVS_DEFINE([HAVE_LINUX_COMPILER_TYPES_H])]) if cmp -s datapath/linux/kcompat.h.new \ datapath/linux/kcompat.h >/dev/null 2>&1; then diff --git a/datapath/linux/compat/include/linux/compiler-gcc.h b/datapath/linux/compat/include/linux/compiler-gcc.h index bf057f7..bfcd531 100644 --- a/datapath/linux/compat/include/linux/compiler-gcc.h +++ b/datapath/linux/compat/include/linux/compiler-gcc.h @@ -1,6 +1,8 @@ #ifndef __LINUX_COMPILER_H +#ifndef HAVE_LINUX_COMPILER_TYPES_H #error "Please don't include directly, include instead." #endif +#endif #include_next From patchwork Tue Jan 30 23:40:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867722 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Aq+Ctzre"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNK94vwgz9s75 for ; Wed, 31 Jan 2018 10:45:01 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2DF32F87; Tue, 30 Jan 2018 23:40:49 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 1B42BE67 for ; Tue, 30 Jan 2018 23:40:45 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 73CE32F6 for ; Tue, 30 Jan 2018 23:40:44 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id a88so10669413pfe.12 for ; Tue, 30 Jan 2018 15:40:44 -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=/JwnnjTGvgxZeNTHu03TKkaOzSwKSRCutAR4i3DtimY=; b=Aq+CtzreXt1lWlBb+GewqvmVwjq6Kw/KgFkGurxLNUWR9wnK0bWvI08EoWcd5yvFyb U4humEHfwftOlBeT1HdEC2wK/xc4mN33pruBJeaO6mzlB26L0S3YFROO3RfzQKqjFGMl ms+0A70xE/v4IweOTUR14N9up1XTfSESsuLB69lP61144ElPixpYEr2J+5HqVXDF05J1 8fQ3vOl6N6Z5PqjPqyZVoYvy1pQ/b1YF45VnnrCDkMAKRjRIEwBh3ehdRUGaCL+rtyrD Y1QOpCfkRxCgnIRdZFtmGbwxYEDVpiGj3EUxn1R42WNb5x0mmSPjIQDX1p7ceSJfKrO9 tj0w== 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=/JwnnjTGvgxZeNTHu03TKkaOzSwKSRCutAR4i3DtimY=; b=hlGvVdhOCiPWU39ejiWvd3uugAYEIVjh8v/9ve14Jm/jwK6KzqTK/u7F9m2aQNk1YF BJLqVXsdnnYGptWK7GAWC+qBjdh4IsGZcnhCLdB5azS//sOF7fF3iam0SljMGxfDLmqa M97qdqj6UFT+VRyCJKJkhQLiskRETUwjkraAwbQ/GcJZ57+M9L/rVIsnRMt2bGTLHZBr T8eF0p/aGKNNzu1nUPaVSdpFoeUZZa5aoydaEPmJDrApyv2ZRY+sqzgtoqp96qt2aFi9 U7r0lNpxsYZvfyr/znk3426/31DU3VrVes6PRBY+evlGS7plicG3kcyH7IOEIhbddTFr 3Q0Q== X-Gm-Message-State: AKwxytd9959+UIFFC3GLBIb5NOutLzq+xtKFPbax3mv/dhZ5l9GQs7IC 8FfgPSAcd++2FcMaZPILabYl9g== X-Google-Smtp-Source: AH8x225ThCkO1nSV3uYi/od8GPw/nIe1rcjaGhMMAv/mGytPoNbu5IHhxR3ax8eSAB+wE7zB9GS7pw== X-Received: by 2002:a17:902:b406:: with SMTP id x6-v6mr17630739plr.150.1517355643675; Tue, 30 Jan 2018 15:40:43 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:42 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:10 -0800 Message-Id: <1517355622-26114-9-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Christophe JAILLET Subject: [ovs-dev] [PATCH 08/20] datapath: Fix an error handling path in 'ovs_nla_init_match_and_action() X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Christophe JAILLET Upstream commit: commit 5829e62ac17a40ab08c1b905565604a4b5fa7af6 Author: Christophe JAILLET Date: Mon Sep 11 21:56:20 2017 +0200 openvswitch: Fix an error handling path in 'ovs_nla_init_match_and_action()' All other error handling paths in this function go through the 'error' label. This one should do the same. Fixes: 9cc9a5cb176c ("datapath: Avoid using stack larger than 1024.") Signed-off-by: Christophe JAILLET Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: Christophe JAILLET Fixes: 850c2a4d1a ("datapath: Avoid using stack larger than 1024.") Signed-off-by: Greg Rose --- datapath/datapath.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index a3fdd8f..38a453b 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1139,7 +1139,8 @@ static int ovs_nla_init_match_and_action(struct net *net, if (!a[OVS_FLOW_ATTR_KEY]) { OVS_NLERR(log, "Flow key attribute not present in set flow."); - return -EINVAL; + error = -EINVAL; + goto error; } *acts = get_flow_actions(net, a[OVS_FLOW_ATTR_ACTIONS], key, From patchwork Tue Jan 30 23:40:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LoqW0Ws/"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNKy1nBTz9s75 for ; Wed, 31 Jan 2018 10:45:41 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 70EA4F8C; Tue, 30 Jan 2018 23:40:53 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id BC6D4F7B for ; Tue, 30 Jan 2018 23:40:46 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 24D922F6 for ; Tue, 30 Jan 2018 23:40:46 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id c6so10674172pfi.8 for ; Tue, 30 Jan 2018 15:40:46 -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=w0SgKv9gC1EyzZUac839FlmNS3xhAIK2Vh3BBqRnq1M=; b=LoqW0Ws/M/NyktxGHpWhnsV6V0jraPoFgJtsW3hEAeFdEa9fuuwLU7qeJQg41/dUIp VMmhJULbywTPoNZla0/C7E+0FwlME1nd636HdUwAQxt5kxz2kAWOO94v1HbrLqkKbXcr v64U2BzJ3mQAH/cLIzbbqh8qRsH825RaSS34zMamSApx8cCV/mgfdjbxO8vY0ml9U61q KAmJ4D86UTCCtAdk7hE9dfn5OUc4jvEZRdzO4s7Gm2iJZDpejRqwCg0YWv/rTMXbDrTl +leS7tTgKXRo/xN7BFpesdQVo4azYOEclBvQCqFSIitD91tzpT6HH/7e7ktKhVsm72uH kmQQ== 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=w0SgKv9gC1EyzZUac839FlmNS3xhAIK2Vh3BBqRnq1M=; b=BwkBf27Rnkuk52VpfyqCv8/dPafRTqgKpyBOwDcGk1Np982iQD2EBhmFc7HQcpTpTz SQX5i7/F6pfoBRoyfV9nIL8VyN+PG9qQSilkc2Mjp3CUHHArAn/9q7ODtGlckm3aIcx0 SCRUbJ7r0xmnglx57ZyQ3f1kVBkNDYZK2CkZADaH+UunqrmWYjHN+yeyXUPpJi8xxUCd Fq+LE3obQLugSztULv+doiiJ6+Yc5411ORMq5bjkKQddPIZ47yHXT17Vrunfsswpo29G ZJCa0xcfIwRJQ+TqzNZCyF2JqNew4Z3sgf2jiBCDl32LeKfxEovaTJQquiYqb1zCd7pi b/wA== X-Gm-Message-State: AKwxytcImCsebMK7/UlWcEoOx0SlBRKbqJNbmcWeMm2e784H9EnJlCAF 4cB9fTGiDeyLmRPT8Fgnua0yyA== X-Google-Smtp-Source: AH8x225j1e3RT48X69mV0QqTwJR5E4adg5aVAzeV2oyuLQLnL1ph25bacB0H2gFo1AAqDTyQ2OgExQ== X-Received: by 10.98.41.68 with SMTP id p65mr9846448pfp.86.1517355645263; Tue, 30 Jan 2018 15:40:45 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:44 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:11 -0800 Message-Id: <1517355622-26114-10-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Jiri Benc Subject: [ovs-dev] [PATCH 09/20] datapath: reliable interface indentification in port dumps X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Jiri Benc Upstream commit: commit 9354d452034273a50a4fd703bea31e5d6b1fc20b Author: Jiri Benc Date: Thu Nov 2 17:04:37 2017 -0200 openvswitch: reliable interface indentification in port dumps This patch allows reliable identification of netdevice interfaces connected to openvswitch bridges. In particular, user space queries the netdev interfaces belonging to the ports for statistics, up/down state, etc. Datapath dump needs to provide enough information for the user space to be able to do that. Currently, only interface names are returned. This is not sufficient, as openvswitch allows its ports to be in different name spaces and the interface name is valid only in its name space. What is needed and generally used in other netlink APIs, is the pair ifindex+netnsid. The solution is addition of the ifindex+netnsid pair (or only ifindex if in the same name space) to vport get/dump operation. On request side, ideally the ifindex+netnsid pair could be used to get/set/del the corresponding vport. This is not implemented by this patch and can be added later if needed. Signed-off-by: Jiri Benc Signed-off-by: David S. Miller Added compat fixup for peernet2id. Cc: Jiri Benc Signed-off-by: Greg Rose --- acinclude.m4 | 3 ++ datapath/datapath.c | 49 +++++++++++++++++------ datapath/datapath.h | 4 +- datapath/dp_notify.c | 3 +- datapath/linux/compat/include/linux/openvswitch.h | 2 + 5 files changed, 45 insertions(+), 16 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index a838a46..1f0b592 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -801,6 +801,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/linux/compiler_types.h], [__LINUX_COMPILER_TYPES_H], [OVS_DEFINE([HAVE_LINUX_COMPILER_TYPES_H])]) + OVS_GREP_IFELSE([$KSRC/include/net/net_namespace.h], + [EXPORT_SYMBOL_GPL(peernet2id_alloc)], + [OVS_DEFINE([HAVE_PEERNET2ID_ALLOC])]) 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 38a453b..ebe5d20 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1876,7 +1876,8 @@ 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, - u32 portid, u32 seq, u32 flags, u8 cmd) + struct net *net, u32 portid, u32 seq, + u32 flags, u8 cmd) { struct ovs_header *ovs_header; struct ovs_vport_stats vport_stats; @@ -1892,9 +1893,19 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, if (nla_put_u32(skb, OVS_VPORT_ATTR_PORT_NO, vport->port_no) || nla_put_u32(skb, OVS_VPORT_ATTR_TYPE, vport->ops->type) || nla_put_string(skb, OVS_VPORT_ATTR_NAME, - ovs_vport_name(vport))) + ovs_vport_name(vport)) || + nla_put_u32(skb, OVS_VPORT_ATTR_IFINDEX, vport->dev->ifindex)) goto nla_put_failure; +#ifdef HAVE_PEERNET2ID_ALLOC + if (!net_eq(net, dev_net(vport->dev))) { + int id = peernet2id_alloc(net, dev_net(vport->dev)); + + if (nla_put_s32(skb, OVS_VPORT_ATTR_NETNSID, id)) + goto nla_put_failure; + } + +#endif ovs_vport_get_stats(vport, &vport_stats); if (nla_put_64bit(skb, OVS_VPORT_ATTR_STATS, sizeof(struct ovs_vport_stats), &vport_stats, @@ -1924,8 +1935,8 @@ static struct sk_buff *ovs_vport_cmd_alloc_info(void) } /* Called with ovs_mutex, only via ovs_dp_notify_wq(). */ -struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 portid, - u32 seq, u8 cmd) +struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, struct net *net, + u32 portid, u32 seq, u8 cmd) { struct sk_buff *skb; int retval; @@ -1934,7 +1945,7 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 portid, if (!skb) return ERR_PTR(-ENOMEM); - retval = ovs_vport_cmd_fill_info(vport, skb, portid, seq, 0, cmd); + retval = ovs_vport_cmd_fill_info(vport, skb, net, portid, seq, 0, cmd); BUG_ON(retval < 0); return skb; @@ -1948,6 +1959,8 @@ static struct vport *lookup_vport(struct net *net, struct datapath *dp; struct vport *vport; + if (a[OVS_VPORT_ATTR_IFINDEX]) + return ERR_PTR(-EOPNOTSUPP); if (a[OVS_VPORT_ATTR_NAME]) { vport = ovs_vport_locate(net, nla_data(a[OVS_VPORT_ATTR_NAME])); if (!vport) @@ -1972,6 +1985,7 @@ static struct vport *lookup_vport(struct net *net, return vport; } else return ERR_PTR(-EINVAL); + } /* Called with ovs_mutex */ @@ -2011,6 +2025,8 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info) if (!a[OVS_VPORT_ATTR_NAME] || !a[OVS_VPORT_ATTR_TYPE] || !a[OVS_VPORT_ATTR_UPCALL_PID]) return -EINVAL; + if (a[OVS_VPORT_ATTR_IFINDEX]) + return -EOPNOTSUPP; port_no = a[OVS_VPORT_ATTR_PORT_NO] ? nla_get_u32(a[OVS_VPORT_ATTR_PORT_NO]) : 0; @@ -2060,8 +2076,9 @@ restart: goto exit_unlock_free; } - err = ovs_vport_cmd_fill_info(vport, reply, info->snd_portid, - info->snd_seq, 0, OVS_VPORT_CMD_NEW); + err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), + info->snd_portid, info->snd_seq, 0, + OVS_VPORT_CMD_NEW); BUG_ON(err < 0); if (netdev_get_fwd_headroom(vport->dev) > dp->max_headroom) @@ -2117,8 +2134,9 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) goto exit_unlock_free; } - err = ovs_vport_cmd_fill_info(vport, reply, info->snd_portid, - info->snd_seq, 0, OVS_VPORT_CMD_NEW); + err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), + info->snd_portid, info->snd_seq, 0, + OVS_VPORT_CMD_NEW); BUG_ON(err < 0); ovs_unlock(); @@ -2155,8 +2173,9 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info) goto exit_unlock_free; } - err = ovs_vport_cmd_fill_info(vport, reply, info->snd_portid, - info->snd_seq, 0, OVS_VPORT_CMD_DEL); + err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), + info->snd_portid, info->snd_seq, 0, + OVS_VPORT_CMD_DEL); BUG_ON(err < 0); /* the vport deletion may trigger dp headroom update */ @@ -2197,8 +2216,9 @@ static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info) err = PTR_ERR(vport); if (IS_ERR(vport)) goto exit_unlock_free; - err = ovs_vport_cmd_fill_info(vport, reply, info->snd_portid, - info->snd_seq, 0, OVS_VPORT_CMD_NEW); + err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), + info->snd_portid, info->snd_seq, 0, + OVS_VPORT_CMD_NEW); BUG_ON(err < 0); rcu_read_unlock(); @@ -2230,6 +2250,7 @@ static int ovs_vport_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node) { if (j >= skip && ovs_vport_cmd_fill_info(vport, skb, + sock_net(skb->sk), NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, NLM_F_MULTI, @@ -2256,6 +2277,8 @@ static const struct nla_policy vport_policy[OVS_VPORT_ATTR_MAX + 1] = { [OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 }, [OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_U32 }, [OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED }, + [OVS_VPORT_ATTR_IFINDEX] = { .type = NLA_U32 }, + [OVS_VPORT_ATTR_NETNSID] = { .type = NLA_S32 }, }; static struct genl_ops dp_vport_genl_ops[] = { diff --git a/datapath/datapath.h b/datapath/datapath.h index 70ad0ac..1c73fb4 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -208,8 +208,8 @@ int ovs_dp_upcall(struct datapath *, struct sk_buff *, uint32_t cutlen); const char *ovs_dp_name(const struct datapath *dp); -struct sk_buff *ovs_vport_cmd_build_info(struct vport *, u32 pid, u32 seq, - u8 cmd); +struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, struct net *net, + u32 portid, u32 seq, u8 cmd); int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, const struct sw_flow_actions *, struct sw_flow_key *); diff --git a/datapath/dp_notify.c b/datapath/dp_notify.c index 424f35d..932a37e 100644 --- a/datapath/dp_notify.c +++ b/datapath/dp_notify.c @@ -31,7 +31,8 @@ static void dp_detach_port_notify(struct vport *vport) struct datapath *dp; dp = vport->dp; - notify = ovs_vport_cmd_build_info(vport, 0, 0, OVS_VPORT_CMD_DEL); + notify = ovs_vport_cmd_build_info(vport, ovs_dp_get_net(dp), + 0, 0, OVS_VPORT_CMD_DEL); ovs_dp_detach_port(vport); if (IS_ERR(notify)) { genl_set_err(&dp_vport_genl_family, ovs_dp_get_net(dp), 0, diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h index 3deaba6..6081a29 100644 --- a/datapath/linux/compat/include/linux/openvswitch.h +++ b/datapath/linux/compat/include/linux/openvswitch.h @@ -283,6 +283,8 @@ enum ovs_vport_attr { /* receiving upcalls */ OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ OVS_VPORT_ATTR_PAD, + OVS_VPORT_ATTR_IFINDEX, + OVS_VPORT_ATTR_NETNSID, __OVS_VPORT_ATTR_MAX }; From patchwork Tue Jan 30 23:40:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867726 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="B3v4umNd"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNLX1wK0z9sBW for ; Wed, 31 Jan 2018 10:46:12 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 90473F93; Tue, 30 Jan 2018 23:40:54 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 85F06F84 for ; Tue, 30 Jan 2018 23:40:48 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 3435A37D for ; Tue, 30 Jan 2018 23:40:48 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id a88so10669542pfe.12 for ; Tue, 30 Jan 2018 15:40:48 -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=y78L8Sd+3NOzhP8i3rvY4StJB9XkpdhuxNSu5aX8XRk=; b=B3v4umNdqwkPOlTUh85rCPBWiLMJQLDS1hw522+j7w15bSptv8rNNMCgYk0donGzdQ YB0oa/bddC/Qu7w5MAWvVnarruqtp9Pr5MdoAaIw/OcpFjkBMaHjjsHSS1DBs9ClVGlQ NsUv+pXeg/XIi1K5THEbAaMFYxWSyerRcFilse5rhhhy0wtSD6P5yM86pCpC6rBQ5QcQ DWR//Y6z6K7yQmD4uXqYZVft3qYbRO+rSF/agihoUrGF11y6bh8lVsKZIWVmKIraaLQ4 SqGROjQtBHM9kMzNQEj6v70L2WX6vUI7BI90SeMuA9purniPSkTlLgRMDSR5JGEUjpey tOqA== 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=y78L8Sd+3NOzhP8i3rvY4StJB9XkpdhuxNSu5aX8XRk=; b=YJaqWXZnJzMvaXkwzjaHVN+DhU/uIOnryZbpQltJgHoB275oZ5b6UvSE0Xs+qAhLr3 /w4cvnzkbJPHu+9+oaEMyOwdAKFxJW6aMHUc+E87YgU1ALoVB4wyfzhK+121SpYSeo9n UdigFRCU2zQgnFDFhmxghOOcaf4WPc6UBm8Kgf2qTjQk7qMyd9mMP6pQjSK7B1pj0Tg3 tnntOSezyRBHire0nIqQwr1+rSpHxBmmup57dkJt0oP21851YC4vfUnTo6q9o9HsWagj jB8qHIvD7I7sjekbXw1SKsd7PDkgFTgelntI/u+9W+OgjKQ7pumJ+9QEtcR4eTeKt2b6 +WzA== X-Gm-Message-State: AKwxytenSvl+QW8RAhETPpnHSk1topfOcL5Bhg2T5c7LH5jLWhHlBXaR AcpRt1FyHpC0HPm9hW4+dv27yw== X-Google-Smtp-Source: AH8x225zeyxpBbYryw+NYipAf+F2TFuyiIG8SbTVS48ykdcUI9XiPzCAE0qBWRgxrm7EkzX1g8NK2w== X-Received: by 2002:a17:902:570f:: with SMTP id k15-v6mr6880645pli.321.1517355647270; Tue, 30 Jan 2018 15:40:47 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:46 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:12 -0800 Message-Id: <1517355622-26114-11-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 10/20] datapath: export get_dp() API X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Andy Zhou Upstream commit: commit 9602c01e57f7b868d748c2ba2aef0efa64b71ffc Author: Andy Zhou Date: Fri Nov 10 12:09:41 2017 -0800 openvswitch: export get_dp() API. Later patches will invoke get_dp() outside of datapath.c. Export it. Signed-off-by: Andy Zhou Signed-off-by: David S. Miller Cc: Andy Zhou Signed-off-by: Greg Rose --- datapath/datapath.c | 29 ----------------------------- datapath/datapath.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index ebe5d20..13b055a 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -145,35 +145,6 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *, const struct dp_upcall_info *, uint32_t cutlen); -/* Must be called with rcu_read_lock. */ -static struct datapath *get_dp_rcu(struct net *net, int dp_ifindex) -{ - struct net_device *dev = dev_get_by_index_rcu(net, dp_ifindex); - - if (dev) { - struct vport *vport = ovs_internal_dev_get_vport(dev); - if (vport) - return vport->dp; - } - - return NULL; -} - -/* The caller must hold either ovs_mutex or rcu_read_lock to keep the - * returned dp pointer valid. - */ -static inline struct datapath *get_dp(struct net *net, int dp_ifindex) -{ - struct datapath *dp; - - WARN_ON_ONCE(!rcu_read_lock_held() && !lockdep_ovsl_is_held()); - rcu_read_lock(); - dp = get_dp_rcu(net, dp_ifindex); - rcu_read_unlock(); - - return dp; -} - /* Must be called with rcu_read_lock or ovs_mutex. */ const char *ovs_dp_name(const struct datapath *dp) { diff --git a/datapath/datapath.h b/datapath/datapath.h index 1c73fb4..7481d6d 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -31,6 +31,7 @@ #include "compat.h" #include "flow.h" #include "flow_table.h" +#include "vport-internal_dev.h" #define DP_MAX_PORTS USHRT_MAX #define DP_VPORT_HASH_BUCKETS 1024 @@ -197,6 +198,36 @@ static inline struct vport *ovs_vport_ovsl(const struct datapath *dp, int port_n return ovs_lookup_vport(dp, port_no); } +/* Must be called with rcu_read_lock. */ +static inline struct datapath *get_dp_rcu(struct net *net, int dp_ifindex) +{ + struct net_device *dev = dev_get_by_index_rcu(net, dp_ifindex); + + if (dev) { + struct vport *vport = ovs_internal_dev_get_vport(dev); + + if (vport) + return vport->dp; + } + + return NULL; +} + +/* The caller must hold either ovs_mutex or rcu_read_lock to keep the + * returned dp pointer valid. + */ +static inline struct datapath *get_dp(struct net *net, int dp_ifindex) +{ + struct datapath *dp; + + WARN_ON_ONCE(!rcu_read_lock_held() && !lockdep_ovsl_is_held()); + rcu_read_lock(); + dp = get_dp_rcu(net, dp_ifindex); + rcu_read_unlock(); + + return dp; +} + extern struct notifier_block ovs_dp_device_notifier; extern struct genl_family dp_vport_genl_family; extern struct genl_multicast_group ovs_dp_vport_multicast_group; From patchwork Tue Jan 30 23:40:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867727 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FrmklAr0"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNM42YTZz9s72 for ; Wed, 31 Jan 2018 10:46:40 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8653FF8D; Tue, 30 Jan 2018 23:40:55 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 794E1F88 for ; Tue, 30 Jan 2018 23:40:50 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B444D306 for ; Tue, 30 Jan 2018 23:40:49 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id i66so10669877pfd.7 for ; Tue, 30 Jan 2018 15:40:49 -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=7lsYNPbIJRxPYsUnqigz3L5zDVXOmIBrfOHdPA40q1o=; b=FrmklAr09me5lZfBoJ/CvOpesOolZ+klltKF0MzraGySUgTpTFyJ2BvlSrH4ZpYsHV 2/Ul0aia4C7F3+V5L+JPXw8Yh7SppDv49uyObu4GCl7e6uwVVMHhQGCbfOdZEfonvpxJ 7TnghgHJH7/qh+rRTAGhbk0ht0J9q6SJWIcIQiCCorgoZh0EVJxE8lNj67dQ3prigYvX eHNaLUlwXho3oKG3hct/msTQicqBhOxXxdAyFr8/B6jkAAEG44BIeCrOFJtt3ogizW08 rexMzQzqPS/NLYuKYi1As2k9jaN0krBCKr4UquYas+uQ2Osuf+Jh8PQBsMhVtnsc9jzx TvOQ== 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=7lsYNPbIJRxPYsUnqigz3L5zDVXOmIBrfOHdPA40q1o=; b=lTbQhW2zEgS7ekEJLj1/YL/2PXOr/Ria9LHHvRnamMuZvfYrXC9hZg2d8yp0o9FDAc FG9LM4lGLKO3ds9mjQNtEOl1Kaz0rMLjmhFaHbOHLmRCKm1+efrjSi8pR2TdEEgcP2MJ cz8Mezx8hbba3PWUTmmdPYSWQe/QoZCgjRZj3tyb8V8JddYgeVCEoiYrFy2ihBx5ux4M kappM7O/acwgk090Ac+G4MG4FoxEEmCR69E4c72tX/Z/hCRKKwnk+hCykjGENrWy5uUM MpZiExsvVZqTB/0Bqq9YgNnyzBDK27JdhJlwqd0Uz88zEELkWg+J5TUZWVbngqVeFTGj U9fA== X-Gm-Message-State: AKwxytcbF2P/+mNeAb5DUG5vFu1RlXFVzv5sQkk0h1pDCa/kIJ/JAkMJ DUNmgnYF+sEncNL61v3ZrAfzmA== X-Google-Smtp-Source: AH8x227dORRWm9DkC+VPQwT5xOrGRRxJeCQT38+VD7wUSFsH1q7BRGjIXaDgTVQP37gWwadCYdE8hg== X-Received: by 10.98.54.71 with SMTP id d68mr31546036pfa.173.1517355648980; Tue, 30 Jan 2018 15:40:48 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:47 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:13 -0800 Message-Id: <1517355622-26114-12-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 11/20] datapath: Add meter netlink definitions X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Andy Zhou Upstream commit: commit 5794040647de4011598a6d005fdad95d24fd385b Author: Andy Zhou Date: Fri Nov 10 12:09:40 2017 -0800 openvswitch: Add meter netlink definitions Meter has its own netlink family. Define netlink messages and attributes for communicating with the user space programs. Signed-off-by: Andy Zhou Signed-off-by: David S. Miller Cc: Andy Zhou Signed-off-by: Greg Rose --- datapath/linux/compat/include/linux/openvswitch.h | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h index 6081a29..164f57d 100644 --- a/datapath/linux/compat/include/linux/openvswitch.h +++ b/datapath/linux/compat/include/linux/openvswitch.h @@ -945,4 +945,55 @@ enum ovs_action_attr { #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) +/* Meters. */ +#define OVS_METER_FAMILY "ovs_meter" +#define OVS_METER_MCGROUP "ovs_meter" +#define OVS_METER_VERSION 0x1 + +enum ovs_meter_cmd { + OVS_METER_CMD_UNSPEC, + OVS_METER_CMD_FEATURES, /* Get features supported by the datapath. */ + OVS_METER_CMD_SET, /* Add or modify a meter. */ + OVS_METER_CMD_DEL, /* Delete a meter. */ + OVS_METER_CMD_GET /* Get meter stats. */ +}; + +enum ovs_meter_attr { + OVS_METER_ATTR_UNSPEC, + OVS_METER_ATTR_ID, /* u32 meter ID within datapath. */ + OVS_METER_ATTR_KBPS, /* No argument. If set, units in kilobits + * per second. Otherwise, units in + * packets per second. + */ + OVS_METER_ATTR_STATS, /* struct ovs_flow_stats for the meter. */ + OVS_METER_ATTR_BANDS, /* Nested attributes for meter bands. */ + OVS_METER_ATTR_USED, /* u64 msecs last used in monotonic time. */ + OVS_METER_ATTR_CLEAR, /* Flag to clear stats, used. */ + OVS_METER_ATTR_MAX_METERS, /* u32 number of meters supported. */ + OVS_METER_ATTR_MAX_BANDS, /* u32 max number of bands per meter. */ + OVS_METER_ATTR_PAD, + __OVS_METER_ATTR_MAX +}; + +#define OVS_METER_ATTR_MAX (__OVS_METER_ATTR_MAX - 1) + +enum ovs_band_attr { + OVS_BAND_ATTR_UNSPEC, + OVS_BAND_ATTR_TYPE, /* u32 OVS_METER_BAND_TYPE_* constant. */ + OVS_BAND_ATTR_RATE, /* u32 band rate in meter units (see above). */ + OVS_BAND_ATTR_BURST, /* u32 burst size in meter units. */ + OVS_BAND_ATTR_STATS, /* struct ovs_flow_stats for the band. */ + __OVS_BAND_ATTR_MAX +}; + +#define OVS_BAND_ATTR_MAX (__OVS_BAND_ATTR_MAX - 1) + +enum ovs_meter_band_type { + OVS_METER_BAND_TYPE_UNSPEC, + OVS_METER_BAND_TYPE_DROP, /* Drop exceeding packets. */ + __OVS_METER_BAND_TYPE_MAX +}; + +#define OVS_METER_BAND_TYPE_MAX (__OVS_METER_BAND_TYPE_MAX - 1) + #endif /* _LINUX_OPENVSWITCH_H */ From patchwork Tue Jan 30 23:40:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kbeCu18Q"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNMn0Vcsz9s82 for ; Wed, 31 Jan 2018 10:47:16 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D78C6FAA; Tue, 30 Jan 2018 23:40:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 29D54F8C for ; Tue, 30 Jan 2018 23:40:53 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id BDB51315 for ; Tue, 30 Jan 2018 23:40:51 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id k19so10667907pfj.5 for ; Tue, 30 Jan 2018 15:40:51 -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=IFH0mHJLQ2VoE+8Snm45EOwFaTXY9/l4s+xtEPn0NcU=; b=kbeCu18Qe00owk+PKLFi1Rfl9o6z+Gwo8XUMoKiruNEjgoGnYVEb4qNwDi1WMhSnX4 sAdMcAnoLXZq9/gk8JWqViyZ0M+lesDkwUVMC8M5zxR+mgu8p7JTP+p8NYvxFTTu+QJI vsfL8xRWKDaJUdt2ghQ+3N4uqy9xzXz72zWYo4Gfm5+HFvP08r7u0R+YBIXtlLbA6gPf tp6pMddk8Z7abpSg4CWuhKHY2mRbyXDaUgmw265KWvKClGEn/axHws5TkweaHrLAC9jp xYm2MmVGp9Pt5gAGf6EPCsJtnJgyxKGak76aiL6fPrNkHendq5gu4XpDFd6oABk1bNmr bhnQ== 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=IFH0mHJLQ2VoE+8Snm45EOwFaTXY9/l4s+xtEPn0NcU=; b=LmoJ9lMG59HwG1VP1FCCjUVCGlltI+Y5Ug0/JbmS/igG/bUzxOh+u6J2f+rrRM4P0p OTKOtlBJBjGHmJEQ0l5fv8A2O3wi2KHIdA33+gEDKgjcE4Ne/urJ3o7kwpp+AHHuMoir K8h/PmTzDEFl9wzjueIyqixpSE8w0HvtX9KlLvY8dvWkyIagBCllgHyGczT/WDeG9hF5 /RubUeuvLUvenH//Ey3BtZAg6ebOmQ9YbSufNrtBLDmmHVlckgiqQXwoZuviW9UO5CIQ 1Xx4v0BPxeMaM8LpB9PvvaA7/ytQecZ6oNRyRSuBzzy4nd62mo/NDDpw3UHwrXhinSNA Tv9Q== X-Gm-Message-State: AKwxytfYgbL1GhSRPijAAXOzrAsk4ISQmaEnEl5/pxFuxB2ZQ5dfgz88 /d50I6BCjhzcBwbnda5aRhLrIA== X-Google-Smtp-Source: AH8x227UV/BKpmmjNoLKsbrWrIjq1q2dizvXmTM3f5JQyEgPSNb9F+qC6amqsIyF7jcBkBjrKOhbVg== X-Received: by 10.98.103.209 with SMTP id t78mr32094706pfj.53.1517355650555; Tue, 30 Jan 2018 15:40:50 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:49 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:14 -0800 Message-Id: <1517355622-26114-13-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 12/20] datapath: Add meter infrastructure X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Andy Zhou Upstream commit: commit 96fbc13d7e770b542d2d1fcf700d0baadc6e8063 Author: Andy Zhou Date: Fri Nov 10 12:09:42 2017 -0800 openvswitch: Add meter infrastructure OVS kernel datapath so far does not support Openflow meter action. This is the first stab at adding kernel datapath meter support. This implementation supports only drop band type. Signed-off-by: Andy Zhou Signed-off-by: David S. Miller Added a compat layer fixup for nla_parse. Added another compat fixup for ktime_get_ns. Cc: Andy Zhou Signed-off-by: Greg Rose --- acinclude.m4 | 3 + datapath/Modules.mk | 6 +- datapath/datapath.c | 14 +- datapath/datapath.h | 3 + datapath/linux/compat/include/net/netlink.h | 9 + datapath/meter.c | 614 ++++++++++++++++++++++++++++ datapath/meter.h | 54 +++ 7 files changed, 699 insertions(+), 4 deletions(-) create mode 100644 datapath/meter.c create mode 100644 datapath/meter.h diff --git a/acinclude.m4 b/acinclude.m4 index 1f0b592..bc1ec72 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -804,6 +804,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/net/net_namespace.h], [EXPORT_SYMBOL_GPL(peernet2id_alloc)], [OVS_DEFINE([HAVE_PEERNET2ID_ALLOC])]) + OVS_GREP_IFELSE([$KSRC/include/linux/timekeeping.h], + [ktime_get_ns], + [OVS_DEFINE([HAVE_KTIME_GET_NS])]) if cmp -s datapath/linux/kcompat.h.new \ datapath/linux/kcompat.h >/dev/null 2>&1; then diff --git a/datapath/Modules.mk b/datapath/Modules.mk index 21f04a0..a9e2880 100644 --- a/datapath/Modules.mk +++ b/datapath/Modules.mk @@ -26,7 +26,8 @@ openvswitch_sources = \ flow_table.c \ vport.c \ vport-internal_dev.c \ - vport-netdev.c + vport-netdev.c \ + meter.c vport_geneve_sources = vport-geneve.c vport_vxlan_sources = vport-vxlan.c @@ -43,7 +44,8 @@ openvswitch_headers = \ flow_table.h \ vport.h \ vport-internal_dev.h \ - vport-netdev.h + vport-netdev.h \ + meter.h dist_sources = $(foreach module,$(dist_modules),$($(module)_sources)) dist_headers = $(foreach module,$(dist_modules),$($(module)_headers)) diff --git a/datapath/datapath.c b/datapath/datapath.c index 13b055a..07b6c71 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -57,6 +57,7 @@ #include "flow.h" #include "flow_table.h" #include "flow_netlink.h" +#include "meter.h" #include "gso.h" #include "vport-internal_dev.h" #include "vport-netdev.h" @@ -177,6 +178,7 @@ static void destroy_dp_rcu(struct rcu_head *rcu) ovs_flow_tbl_destroy(&dp->table); free_percpu(dp->stats_percpu); kfree(dp->ports); + ovs_meters_exit(dp); kfree(dp); } @@ -1601,6 +1603,10 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) INIT_HLIST_HEAD(&dp->ports[i]); + err = ovs_meters_init(dp); + if (err) + goto err_destroy_ports_array; + /* Set up our datapath device. */ parms.name = nla_data(a[OVS_DP_ATTR_NAME]); parms.type = OVS_VPORT_TYPE_INTERNAL; @@ -1629,7 +1635,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) ovs_dp_reset_user_features(skb, info); } - goto err_destroy_ports_array; + goto err_destroy_meters; } err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, @@ -1644,8 +1650,10 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) ovs_notify(&dp_datapath_genl_family, &ovs_dp_datapath_multicast_group, reply, info); return 0; -err_destroy_ports_array: +err_destroy_meters: ovs_unlock(); + ovs_meters_exit(dp); +err_destroy_ports_array: kfree(dp->ports); err_destroy_percpu: free_percpu(dp->stats_percpu); @@ -2295,6 +2303,7 @@ static struct genl_family *dp_genl_families[] = { &dp_vport_genl_family, &dp_flow_genl_family, &dp_packet_genl_family, + &dp_meter_genl_family, }; static void dp_unregister_genl(int n_families) @@ -2488,3 +2497,4 @@ MODULE_ALIAS_GENL_FAMILY(OVS_DATAPATH_FAMILY); MODULE_ALIAS_GENL_FAMILY(OVS_VPORT_FAMILY); MODULE_ALIAS_GENL_FAMILY(OVS_FLOW_FAMILY); MODULE_ALIAS_GENL_FAMILY(OVS_PACKET_FAMILY); +MODULE_ALIAS_GENL_FAMILY(OVS_METER_FAMILY); diff --git a/datapath/datapath.h b/datapath/datapath.h index 7481d6d..93c9ed5 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -93,6 +93,9 @@ struct datapath { u32 user_features; u32 max_headroom; + + /* Switch meters. */ + struct hlist_head *meters; }; /** diff --git a/datapath/linux/compat/include/net/netlink.h b/datapath/linux/compat/include/net/netlink.h index 4325b9b..ba24a34 100644 --- a/datapath/linux/compat/include/net/netlink.h +++ b/datapath/linux/compat/include/net/netlink.h @@ -169,6 +169,15 @@ 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 + +static inline int rpl_nla_parse(struct nlattr **tb, int maxtype, + const struct nlattr *head, int len, + const struct nla_policy *policy, + struct netlink_ext_ack *extack) +{ + return nla_parse(tb, maxtype, head, len, policy); +} +#define nla_parse rpl_nla_parse #endif #endif /* net/netlink.h */ diff --git a/datapath/meter.c b/datapath/meter.c new file mode 100644 index 0000000..1ab965d --- /dev/null +++ b/datapath/meter.c @@ -0,0 +1,614 @@ +/* + * Copyright (c) 2017 Nicira, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "datapath.h" +#include "meter.h" + +#define METER_HASH_BUCKETS 1024 + +static const struct nla_policy meter_policy[OVS_METER_ATTR_MAX + 1] = { + [OVS_METER_ATTR_ID] = { .type = NLA_U32, }, + [OVS_METER_ATTR_KBPS] = { .type = NLA_FLAG }, + [OVS_METER_ATTR_STATS] = { .len = sizeof(struct ovs_flow_stats) }, + [OVS_METER_ATTR_BANDS] = { .type = NLA_NESTED }, + [OVS_METER_ATTR_USED] = { .type = NLA_U64 }, + [OVS_METER_ATTR_CLEAR] = { .type = NLA_FLAG }, + [OVS_METER_ATTR_MAX_METERS] = { .type = NLA_U32 }, + [OVS_METER_ATTR_MAX_BANDS] = { .type = NLA_U32 }, +}; + +static const struct nla_policy band_policy[OVS_BAND_ATTR_MAX + 1] = { + [OVS_BAND_ATTR_TYPE] = { .type = NLA_U32, }, + [OVS_BAND_ATTR_RATE] = { .type = NLA_U32, }, + [OVS_BAND_ATTR_BURST] = { .type = NLA_U32, }, + [OVS_BAND_ATTR_STATS] = { .len = sizeof(struct ovs_flow_stats) }, +}; + +static void rcu_free_ovs_meter_callback(struct rcu_head *rcu) +{ + struct dp_meter *meter = container_of(rcu, struct dp_meter, rcu); + + kfree(meter); +} + +static void ovs_meter_free(struct dp_meter *meter) +{ + if (!meter) + return; + + call_rcu(&meter->rcu, rcu_free_ovs_meter_callback); +} + +static struct hlist_head *meter_hash_bucket(const struct datapath *dp, + u32 meter_id) +{ + return &dp->meters[meter_id & (METER_HASH_BUCKETS - 1)]; +} + +/* Call with ovs_mutex or RCU read lock. */ +static struct dp_meter *lookup_meter(const struct datapath *dp, + u32 meter_id) +{ + struct dp_meter *meter; + struct hlist_head *head; + + head = meter_hash_bucket(dp, meter_id); + hlist_for_each_entry_rcu(meter, head, dp_hash_node) { + if (meter->id == meter_id) + return meter; + } + return NULL; +} + +static void attach_meter(struct datapath *dp, struct dp_meter *meter) +{ + struct hlist_head *head = meter_hash_bucket(dp, meter->id); + + hlist_add_head_rcu(&meter->dp_hash_node, head); +} + +static void detach_meter(struct dp_meter *meter) +{ + ASSERT_OVSL(); + if (meter) + hlist_del_rcu(&meter->dp_hash_node); +} + +static struct sk_buff * +ovs_meter_cmd_reply_start(struct genl_info *info, u8 cmd, + struct ovs_header **ovs_reply_header) +{ + struct sk_buff *skb; + struct ovs_header *ovs_header = info->userhdr; + + skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); + if (!skb) + return ERR_PTR(-ENOMEM); + + *ovs_reply_header = genlmsg_put(skb, info->snd_portid, + info->snd_seq, + &dp_meter_genl_family, 0, cmd); + if (!ovs_reply_header) { + nlmsg_free(skb); + return ERR_PTR(-EMSGSIZE); + } + (*ovs_reply_header)->dp_ifindex = ovs_header->dp_ifindex; + + return skb; +} + +static int ovs_meter_cmd_reply_stats(struct sk_buff *reply, u32 meter_id, + struct dp_meter *meter) +{ + struct nlattr *nla; + struct dp_meter_band *band; + u16 i; + + if (nla_put_u32(reply, OVS_METER_ATTR_ID, meter_id)) + goto error; + + if (!meter) + return 0; + + if (nla_put(reply, OVS_METER_ATTR_STATS, + sizeof(struct ovs_flow_stats), &meter->stats) || + nla_put_u64_64bit(reply, OVS_METER_ATTR_USED, meter->used, + OVS_METER_ATTR_PAD)) + goto error; + + nla = nla_nest_start(reply, OVS_METER_ATTR_BANDS); + if (!nla) + goto error; + + band = meter->bands; + + for (i = 0; i < meter->n_bands; ++i, ++band) { + struct nlattr *band_nla; + + band_nla = nla_nest_start(reply, OVS_BAND_ATTR_UNSPEC); + if (!band_nla || nla_put(reply, OVS_BAND_ATTR_STATS, + sizeof(struct ovs_flow_stats), + &band->stats)) + goto error; + nla_nest_end(reply, band_nla); + } + nla_nest_end(reply, nla); + + return 0; +error: + return -EMSGSIZE; +} + +static int ovs_meter_cmd_features(struct sk_buff *skb, struct genl_info *info) +{ + struct sk_buff *reply; + struct ovs_header *ovs_reply_header; + struct nlattr *nla, *band_nla; + int err; + + reply = ovs_meter_cmd_reply_start(info, OVS_METER_CMD_FEATURES, + &ovs_reply_header); + if (!reply) + return PTR_ERR(reply); + + if (nla_put_u32(reply, OVS_METER_ATTR_MAX_METERS, U32_MAX) || + nla_put_u32(reply, OVS_METER_ATTR_MAX_BANDS, DP_MAX_BANDS)) + goto nla_put_failure; + + nla = nla_nest_start(reply, OVS_METER_ATTR_BANDS); + if (!nla) + goto nla_put_failure; + + band_nla = nla_nest_start(reply, OVS_BAND_ATTR_UNSPEC); + if (!band_nla) + goto nla_put_failure; + /* Currently only DROP band type is supported. */ + if (nla_put_u32(reply, OVS_BAND_ATTR_TYPE, OVS_METER_BAND_TYPE_DROP)) + goto nla_put_failure; + nla_nest_end(reply, band_nla); + nla_nest_end(reply, nla); + + genlmsg_end(reply, ovs_reply_header); + return genlmsg_reply(reply, info); + +nla_put_failure: + nlmsg_free(reply); + err = -EMSGSIZE; + return err; +} + +#ifndef HAVE_KTIME_GET_NS +#ifndef ktime_to_ns +#define ktime_to_ns(kt) ((kt).tv64) +#endif +static inline u64 ktime_get_ns(void) +{ + return ktime_to_ns(ktime_get()); +} +#endif + +static struct dp_meter *dp_meter_create(struct nlattr **a) +{ + struct nlattr *nla; + int rem; + u16 n_bands = 0; + struct dp_meter *meter; + struct dp_meter_band *band; + int err; + + /* Validate attributes, count the bands. */ + if (!a[OVS_METER_ATTR_BANDS]) + return ERR_PTR(-EINVAL); + + nla_for_each_nested(nla, a[OVS_METER_ATTR_BANDS], rem) + if (++n_bands > DP_MAX_BANDS) + return ERR_PTR(-EINVAL); + + /* Allocate and set up the meter before locking anything. */ + meter = kzalloc(n_bands * sizeof(struct dp_meter_band) + + sizeof(*meter), GFP_KERNEL); + if (!meter) + return ERR_PTR(-ENOMEM); + + meter->used = div_u64(ktime_get_ns(), 1000 * 1000); + meter->kbps = a[OVS_METER_ATTR_KBPS] ? 1 : 0; + meter->keep_stats = !a[OVS_METER_ATTR_CLEAR]; + spin_lock_init(&meter->lock); + if (meter->keep_stats && a[OVS_METER_ATTR_STATS]) { + meter->stats = *(struct ovs_flow_stats *) + nla_data(a[OVS_METER_ATTR_STATS]); + } + meter->n_bands = n_bands; + + /* Set up meter bands. */ + band = meter->bands; + nla_for_each_nested(nla, a[OVS_METER_ATTR_BANDS], rem) { + 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); + if (err) + goto exit_free_meter; + + if (!attr[OVS_BAND_ATTR_TYPE] || + !attr[OVS_BAND_ATTR_RATE] || + !attr[OVS_BAND_ATTR_BURST]) { + err = -EINVAL; + goto exit_free_meter; + } + + band->type = nla_get_u32(attr[OVS_BAND_ATTR_TYPE]); + band->rate = nla_get_u32(attr[OVS_BAND_ATTR_RATE]); + band->burst_size = nla_get_u32(attr[OVS_BAND_ATTR_BURST]); + /* Figure out max delta_t that is enough to fill any bucket. + * Keep max_delta_t size to the bucket units: + * pkts => 1/1000 packets, kilobits => bits. + */ + band_max_delta_t = (band->burst_size + band->rate) * 1000; + /* Start with a full bucket. */ + band->bucket = band_max_delta_t; + if (band_max_delta_t > meter->max_delta_t) + meter->max_delta_t = band_max_delta_t; + band++; + } + + return meter; + +exit_free_meter: + kfree(meter); + return ERR_PTR(err); +} + +static int ovs_meter_cmd_set(struct sk_buff *skb, struct genl_info *info) +{ + struct nlattr **a = info->attrs; + struct dp_meter *meter, *old_meter; + struct sk_buff *reply; + struct ovs_header *ovs_reply_header; + struct ovs_header *ovs_header = info->userhdr; + struct datapath *dp; + int err; + u32 meter_id; + bool failed; + + meter = dp_meter_create(a); + if (IS_ERR_OR_NULL(meter)) + return PTR_ERR(meter); + + reply = ovs_meter_cmd_reply_start(info, OVS_METER_CMD_SET, + &ovs_reply_header); + if (IS_ERR(reply)) { + err = PTR_ERR(reply); + goto exit_free_meter; + } + + ovs_lock(); + dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); + if (!dp) { + err = -ENODEV; + goto exit_unlock; + } + + if (!a[OVS_METER_ATTR_ID]) { + err = -ENODEV; + goto exit_unlock; + } + + meter_id = nla_get_u32(a[OVS_METER_ATTR_ID]); + + /* Cannot fail after this. */ + old_meter = lookup_meter(dp, meter_id); + detach_meter(old_meter); + attach_meter(dp, meter); + ovs_unlock(); + + /* Build response with the meter_id and stats from + * the old meter, if any. + */ + failed = nla_put_u32(reply, OVS_METER_ATTR_ID, meter_id); + WARN_ON(failed); + if (old_meter) { + spin_lock_bh(&old_meter->lock); + if (old_meter->keep_stats) { + err = ovs_meter_cmd_reply_stats(reply, meter_id, + old_meter); + WARN_ON(err); + } + spin_unlock_bh(&old_meter->lock); + ovs_meter_free(old_meter); + } + + genlmsg_end(reply, ovs_reply_header); + return genlmsg_reply(reply, info); + +exit_unlock: + ovs_unlock(); + nlmsg_free(reply); +exit_free_meter: + kfree(meter); + return err; +} + +static int ovs_meter_cmd_get(struct sk_buff *skb, struct genl_info *info) +{ + struct nlattr **a = info->attrs; + u32 meter_id; + struct ovs_header *ovs_header = info->userhdr; + struct ovs_header *ovs_reply_header; + struct datapath *dp; + int err; + struct sk_buff *reply; + struct dp_meter *meter; + + if (!a[OVS_METER_ATTR_ID]) + return -EINVAL; + + meter_id = nla_get_u32(a[OVS_METER_ATTR_ID]); + + reply = ovs_meter_cmd_reply_start(info, OVS_METER_CMD_GET, + &ovs_reply_header); + if (IS_ERR(reply)) + return PTR_ERR(reply); + + ovs_lock(); + + dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); + if (!dp) { + err = -ENODEV; + goto exit_unlock; + } + + /* Locate meter, copy stats. */ + meter = lookup_meter(dp, meter_id); + if (!meter) { + err = -ENOENT; + goto exit_unlock; + } + + spin_lock_bh(&meter->lock); + err = ovs_meter_cmd_reply_stats(reply, meter_id, meter); + spin_unlock_bh(&meter->lock); + if (err) + goto exit_unlock; + + ovs_unlock(); + + genlmsg_end(reply, ovs_reply_header); + return genlmsg_reply(reply, info); + +exit_unlock: + ovs_unlock(); + nlmsg_free(reply); + return err; +} + +static int ovs_meter_cmd_del(struct sk_buff *skb, struct genl_info *info) +{ + struct nlattr **a = info->attrs; + u32 meter_id; + struct ovs_header *ovs_header = info->userhdr; + struct ovs_header *ovs_reply_header; + struct datapath *dp; + int err; + struct sk_buff *reply; + struct dp_meter *old_meter; + + if (!a[OVS_METER_ATTR_ID]) + return -EINVAL; + meter_id = nla_get_u32(a[OVS_METER_ATTR_ID]); + + reply = ovs_meter_cmd_reply_start(info, OVS_METER_CMD_DEL, + &ovs_reply_header); + if (IS_ERR(reply)) + return PTR_ERR(reply); + + ovs_lock(); + + dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); + if (!dp) { + err = -ENODEV; + goto exit_unlock; + } + + old_meter = lookup_meter(dp, meter_id); + if (old_meter) { + spin_lock_bh(&old_meter->lock); + err = ovs_meter_cmd_reply_stats(reply, meter_id, old_meter); + WARN_ON(err); + spin_unlock_bh(&old_meter->lock); + detach_meter(old_meter); + } + ovs_unlock(); + ovs_meter_free(old_meter); + genlmsg_end(reply, ovs_reply_header); + return genlmsg_reply(reply, info); + +exit_unlock: + ovs_unlock(); + nlmsg_free(reply); + return err; +} + +/* Meter action execution. + * + * Return true 'meter_id' drop band is triggered. The 'skb' should be + * dropped by the caller'. + */ +bool ovs_meter_execute(struct datapath *dp, struct sk_buff *skb, + struct sw_flow_key *key, u32 meter_id) +{ + struct dp_meter *meter; + struct dp_meter_band *band; + long long int now_ms = div_u64(ktime_get_ns(), 1000 * 1000); + long long int long_delta_ms; + u32 delta_ms; + u32 cost; + int i, band_exceeded_max = -1; + u32 band_exceeded_rate = 0; + + meter = lookup_meter(dp, meter_id); + /* Do not drop the packet when there is no meter. */ + if (!meter) + return false; + + /* Lock the meter while using it. */ + spin_lock(&meter->lock); + + long_delta_ms = (now_ms - meter->used); /* ms */ + + /* Make sure delta_ms will not be too large, so that bucket will not + * wrap around below. + */ + delta_ms = (long_delta_ms > (long long int)meter->max_delta_t) + ? meter->max_delta_t : (u32)long_delta_ms; + + /* Update meter statistics. + */ + meter->used = now_ms; + meter->stats.n_packets += 1; + meter->stats.n_bytes += skb->len; + + /* Bucket rate is either in kilobits per second, or in packets per + * second. We maintain the bucket in the units of either bits or + * 1/1000th of a packet, correspondingly. + * Then, when rate is multiplied with milliseconds, we get the + * bucket units: + * msec * kbps = bits, and + * msec * packets/sec = 1/1000 packets. + * + * 'cost' is the number of bucket units in this packet. + */ + cost = (meter->kbps) ? skb->len * 8 : 1000; + + /* Update all bands and find the one hit with the highest rate. */ + for (i = 0; i < meter->n_bands; ++i) { + long long int max_bucket_size; + + band = &meter->bands[i]; + max_bucket_size = (band->burst_size + band->rate) * 1000; + + band->bucket += delta_ms * band->rate; + if (band->bucket > max_bucket_size) + band->bucket = max_bucket_size; + + if (band->bucket >= cost) { + band->bucket -= cost; + } else if (band->rate > band_exceeded_rate) { + band_exceeded_rate = band->rate; + band_exceeded_max = i; + } + } + + if (band_exceeded_max >= 0) { + /* Update band statistics. */ + band = &meter->bands[band_exceeded_max]; + band->stats.n_packets += 1; + band->stats.n_bytes += skb->len; + + /* Drop band triggered, let the caller drop the 'skb'. */ + if (band->type == OVS_METER_BAND_TYPE_DROP) { + spin_unlock(&meter->lock); + return true; + } + } + + spin_unlock(&meter->lock); + return false; +} + +static struct genl_ops dp_meter_genl_ops[] = { + { .cmd = OVS_METER_CMD_FEATURES, + .flags = 0, /* OK for unprivileged users. */ + .policy = meter_policy, + .doit = ovs_meter_cmd_features + }, + { .cmd = OVS_METER_CMD_SET, + .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN + * privilege. + */ + .policy = meter_policy, + .doit = ovs_meter_cmd_set, + }, + { .cmd = OVS_METER_CMD_GET, + .flags = 0, /* OK for unprivileged users. */ + .policy = meter_policy, + .doit = ovs_meter_cmd_get, + }, + { .cmd = OVS_METER_CMD_DEL, + .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN + * privilege. + */ + .policy = meter_policy, + .doit = ovs_meter_cmd_del + }, +}; + +static const struct genl_multicast_group ovs_meter_multicast_group = { + .name = OVS_METER_MCGROUP, +}; + +struct genl_family dp_meter_genl_family __ro_after_init = { + .hdrsize = sizeof(struct ovs_header), + .name = OVS_METER_FAMILY, + .version = OVS_METER_VERSION, + .maxattr = OVS_METER_ATTR_MAX, + .netnsok = true, + .parallel_ops = true, + .ops = dp_meter_genl_ops, + .n_ops = ARRAY_SIZE(dp_meter_genl_ops), + .mcgrps = &ovs_meter_multicast_group, + .n_mcgrps = 1, + .module = THIS_MODULE, +}; + +int ovs_meters_init(struct datapath *dp) +{ + int i; + + dp->meters = kmalloc_array(METER_HASH_BUCKETS, + sizeof(struct hlist_head), GFP_KERNEL); + + if (!dp->meters) + return -ENOMEM; + + for (i = 0; i < METER_HASH_BUCKETS; i++) + INIT_HLIST_HEAD(&dp->meters[i]); + + return 0; +} + +void ovs_meters_exit(struct datapath *dp) +{ + int i; + + for (i = 0; i < METER_HASH_BUCKETS; i++) { + struct hlist_head *head = &dp->meters[i]; + struct dp_meter *meter; + struct hlist_node *n; + + hlist_for_each_entry_safe(meter, n, head, dp_hash_node) + kfree(meter); + } + + kfree(dp->meters); +} diff --git a/datapath/meter.h b/datapath/meter.h new file mode 100644 index 0000000..964ace2 --- /dev/null +++ b/datapath/meter.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2017 Nicira, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + */ + +#ifndef METER_H +#define METER_H 1 + +#include +#include +#include +#include +#include +#include +#include + +#include "flow.h" +struct datapath; + +#define DP_MAX_BANDS 1 + +struct dp_meter_band { + u32 type; + u32 rate; + u32 burst_size; + u32 bucket; /* 1/1000 packets, or in bits */ + struct ovs_flow_stats stats; +}; + +struct dp_meter { + spinlock_t lock; /* Per meter lock */ + struct rcu_head rcu; + struct hlist_node dp_hash_node; /*Element in datapath->meters + * hash table. + */ + u32 id; + u16 kbps:1, keep_stats:1; + u16 n_bands; + u32 max_delta_t; + u64 used; + struct ovs_flow_stats stats; + struct dp_meter_band bands[]; +}; + +extern struct genl_family dp_meter_genl_family; +int ovs_meters_init(struct datapath *dp); +void ovs_meters_exit(struct datapath *dp); +bool ovs_meter_execute(struct datapath *dp, struct sk_buff *skb, + struct sw_flow_key *key, u32 meter_id); + +#endif /* meter.h */ From patchwork Tue Jan 30 23:40:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867729 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="q9DGtdWH"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNNH1fp5z9s82 for ; Wed, 31 Jan 2018 10:47:43 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2FA50FAE; Tue, 30 Jan 2018 23:41:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 3AF1CF8D for ; Tue, 30 Jan 2018 23:40:53 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C2105334 for ; Tue, 30 Jan 2018 23:40:52 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id i66so10670011pfd.7 for ; Tue, 30 Jan 2018 15:40:52 -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=jnnmodkOQX0qwsZsAVAUiJ86cBNPBaN7dUJCbBCp3v8=; b=q9DGtdWHIMKpwRMtEAH2i2ODH40AL0bK4x6QqAvpSY/YGj+IoD1JYtyNkNIXoWAmN1 zVvIfRoxYjcODik/uaEPrS9DhUuIScoK7/GiJQD89XU/A8Vr2HXEuWzL3C5aAsFPUACP ATW45tHwgbaPMbYaF/40HL19MXDqNtOw3Aqznc3rDg97JXFM7PyNMhTnty9JYwLCH0Mc CZwLjxLptxbTQZjlhr5445wUN2sWXz+9H84MWd47FjZi4pYQEHmAPJOCs3PO2MiGdJS8 GSqk7H0Qh3wOiup52Nli8LM9NsM+Il4Z0kwUsDx83h9KDLH46JhG54SZ+I7RSH3mp9zA mjdA== 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=jnnmodkOQX0qwsZsAVAUiJ86cBNPBaN7dUJCbBCp3v8=; b=V/QoJzdbqY9LfG6kGi5BL9I6Ac+65BjBw9PvQyN/bI6WKZJ0A2IwY2eMsIbn8EuJJ2 bkJzcrA8tPPaPUFLhmoBr2/+ME/18/uNN4oehYZNTuz8+Q5OZ+96eWVGpbT1sN67auOt 5o299+uJFZDDCvkCcbSHZCYOt/N7fjkgnhcMPGxujmkFJwjfIVILqrPY73sVmGE7jBp7 J8oEVNnErLkqMS+D2DX8RDvg8ErmrXRK/c66SkuPXjq6DUR2KJ+82RB39bJlR+Xf9N/8 PpodVReeYAjqetI37qFbaDU0z8SwlcRzz5Q9q6NfYsK+9w1RZRMOvOx3rNhLtEzrb/RN MSuA== X-Gm-Message-State: AKwxytcOQrmXBE8SUilGeWAPpWxsZNtRjVsVObfUr1bpX/oy4iM71UFZ m2heQdH/poQUuvrv1hxO7ZfRvg== X-Google-Smtp-Source: AH8x225CoEcd/k1ZRbDdwsA78Tl/qCMQ9uaKq3btnKstruHKG2Y4JVXVyf6JTrKeGiuSmu4/kuVIkg== X-Received: by 10.98.225.7 with SMTP id q7mr31314996pfh.22.1517355652023; Tue, 30 Jan 2018 15:40:52 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:51 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:15 -0800 Message-Id: <1517355622-26114-14-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Wei Yongjun Subject: [ovs-dev] [PATCH 13/20] datapath: Fix return value check in ovs_meter_cmd_features() X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Wei Yongjun Upstream commit: commit 8a860c2bcc84a8e4fbcabb928cd97e4c51b17d93 Author: Wei Yongjun Date: Tue Nov 14 06:20:16 2017 +0000 openvswitch: Fix return value check in ovs_meter_cmd_features() In case of error, the function ovs_meter_cmd_reply_start() returns ERR_PTR() not NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure") Signed-off-by: Wei Yongjun Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: Wei Yongjun Signed-off-by: Greg Rose --- datapath/meter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datapath/meter.c b/datapath/meter.c index 1ab965d..bc940ae 100644 --- a/datapath/meter.c +++ b/datapath/meter.c @@ -166,7 +166,7 @@ static int ovs_meter_cmd_features(struct sk_buff *skb, struct genl_info *info) reply = ovs_meter_cmd_reply_start(info, OVS_METER_CMD_FEATURES, &ovs_reply_header); - if (!reply) + if (IS_ERR(reply)) return PTR_ERR(reply); if (nla_put_u32(reply, OVS_METER_ATTR_MAX_METERS, U32_MAX) || From patchwork Tue Jan 30 23:40:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867731 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="H9/UKqdP"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNNq3xlBz9s82 for ; Wed, 31 Jan 2018 10:48:11 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9560DF73; Tue, 30 Jan 2018 23:41:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id A8505F92 for ; Tue, 30 Jan 2018 23:40:55 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 159EB2F6 for ; Tue, 30 Jan 2018 23:40:55 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id 17so9231649pfw.11 for ; Tue, 30 Jan 2018 15:40:55 -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=dVzje0Wii/OJHeBFc6bTiF3Y4cDSfh+A31vTsBTNGgI=; b=H9/UKqdPFNHAMwW5ctYYVfm8wNFnRxqQ1KeIf3gW6+8m8I+pstAlOnCqJ6mXT+Gc1S bJWcv71b66HlZZzq9X3gkpBmWIU8oIEaJOQvugzUKo5L3cKc8mq1K7qoWjWKKUF167PC L3EaRSQN2fegG50M9Rnk6j7K9tpiOiGVai/UeM1BjvvHHAY+MZygGeAcSE6AaCQqEw0A FmpJTS0U9OYrID4RLUWYbFd7fRmY+ejx3wTgWkD8f2iskwCKiT999bb5VRhGVGKx1DuT Kf3tklwFErM6wCMM/qwT9t0oYL5JyFTZP6dcZb+SaylQmXGn+vKVp0yYP3JnxTJbgQzO GVuw== 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=dVzje0Wii/OJHeBFc6bTiF3Y4cDSfh+A31vTsBTNGgI=; b=RVOsZXWfwmB3/LFzhdCrr4XH5a+fe76CJ+N/Z4BLbpBNRYvUJKV5tD7ch6PNJ/r7YL aO2GUTi12P5SviAaRyz7jI/GTLhGuSv8554noSET/FDk1K0qrg4IJfnqAu0psg5+XbDH V8PMhPz791U0x1VlcJ7VxiN7w+sS80SZ8gz0JZ0srQU16sdwOrfqzCfwyUxb5wdaR/wP zlj3e/xuk1HEkib2lY+ao/Ce+ocRp2IVN5quVieeznGH3kCgqj+PTsQTxh4mNvDxAmEq fH9dr1gxxZcl+fpUoRPCBqKAMfIWJTKvZe5NiW6x8yWnQoRqVhXQ6aPNblZiFsgXWANy 2YOA== X-Gm-Message-State: AKwxytfPpweWPqIvV9BwIK3LZerQw2S1kLnLQ0H2cs1qiqemw0dOLABu RbSFlobK/hdft/QeTsmjKBkMWA== X-Google-Smtp-Source: AH8x225Zcr49fd46x8ipcd7y/4NxYz8gd9lsWNQA8rbdjRr2ylFQe75BMSttAotH3Njw/cIxvMVZpQ== X-Received: by 10.99.37.193 with SMTP id l184mr15340299pgl.30.1517355653386; Tue, 30 Jan 2018 15:40:53 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:52 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:16 -0800 Message-Id: <1517355622-26114-15-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Wei Yongjun Subject: [ovs-dev] [PATCH 14/20] datapath: Using kfree_rcu() to simplify the code X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Wei Yongjun Upstream commit: commit 6dc14dc40a1d1dafd8491c349b5f3e15aabc4edb Author: Wei Yongjun Date: Tue Nov 14 06:27:12 2017 +0000 openvswitch: Using kfree_rcu() to simplify the code The callback function of call_rcu() just calls a kfree(), so we can use kfree_rcu() instead of call_rcu() + callback function. Signed-off-by: Wei Yongjun Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: Wei Yongjun Signed-off-by: Greg Rose --- datapath/meter.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/datapath/meter.c b/datapath/meter.c index bc940ae..7b9391d 100644 --- a/datapath/meter.c +++ b/datapath/meter.c @@ -42,19 +42,12 @@ static const struct nla_policy band_policy[OVS_BAND_ATTR_MAX + 1] = { [OVS_BAND_ATTR_STATS] = { .len = sizeof(struct ovs_flow_stats) }, }; -static void rcu_free_ovs_meter_callback(struct rcu_head *rcu) -{ - struct dp_meter *meter = container_of(rcu, struct dp_meter, rcu); - - kfree(meter); -} - static void ovs_meter_free(struct dp_meter *meter) { if (!meter) return; - call_rcu(&meter->rcu, rcu_free_ovs_meter_callback); + kfree_rcu(meter, rcu); } static struct hlist_head *meter_hash_bucket(const struct datapath *dp, From patchwork Tue Jan 30 23:40:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867732 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dGpK4LX5"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNPJ1NbTz9s82 for ; Wed, 31 Jan 2018 10:48:36 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id BD071FAF; Tue, 30 Jan 2018 23:41:03 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 0F755F92 for ; Tue, 30 Jan 2018 23:40:56 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9BDF6306 for ; Tue, 30 Jan 2018 23:40:55 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id o13so8540841pgs.2 for ; Tue, 30 Jan 2018 15:40:55 -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=41cCc0GXSXiUinBF8S9H1Q8BVZKOntriBhT0OOWa2eY=; b=dGpK4LX5eM12NfDMFz/giWPTmP4IDMlthtLZAP8rId7B+jOYO65pgwya9Y88miuTk9 tGR0wBnBXD7D2O00DWYVuO+QZn3Rs9CzSis35FDkm/zZUGNXrvNR5RtmqVNKRiNyxNIP ZTE4DsNp7kOR3AnpntdgQe/Ruq5smFIKD868POAr+PosBbSaekXhyfFRDnhD3zp6VVEJ R+uvzFkOg+tXjqTSZfMHH+sg6Qb07LBtO57/mU5vASpjNcJCNCyX29QW0kc4PhX23aZz n1BjV3nHBBoZdzCtYquQb6l/XCiEpz3N4Yd6v1w5JD9ZS1C4q6BNLYu1eITS32oWdgHZ Gy5Q== 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=41cCc0GXSXiUinBF8S9H1Q8BVZKOntriBhT0OOWa2eY=; b=lnOQyhcKaReJ0Jgzn+tz9juQL2cv7N+/u5I6yPijCluJOE0++xE6iJbmGq2pKj96+e ujFUmMNChkXxTT4AAL22kuiixuU21SHrrPEi/J/hcn3+mRP56HpTEbUfhzOoj/y26Dw7 kNl9FXocI+5UYF7doSYNS7eP5pFPynbdk+F6Y3jfVfjJ/8owQUCHDPcyJejH6Vknpp+T DQSDRSJi0W7qfSzyb9Vg+hpK9WPdSR3PXxwV6ujzD3kzJMR1GUxhu20mMeqGqru9V6Xv jqNMBUS6PSruDEIm6H1IgaOdjRTxcp0x0s1p1Gi4OY7I/+6p9lCBXOVxrbJm49neJY5c YXUA== X-Gm-Message-State: AKwxytfYAqytgouvm0Os47qRKhnLUDA3rQ9UQlQmd9d03c54Z6RKRdEb sSm2AdO7D5zjvoRULazJZ8pA4g== X-Google-Smtp-Source: AH8x227GtWB8yF2IWnyqVaTVhWKY6CzXa+Snum8jxnUx94u8eiAhzz/IuLYV3ja6KZOfnhyAAO8MIg== X-Received: by 10.99.97.210 with SMTP id v201mr26245898pgb.344.1517355654801; Tue, 30 Jan 2018 15:40:54 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:53 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:17 -0800 Message-Id: <1517355622-26114-16-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: "Gustavo A. R. Silva" Subject: [ovs-dev] [PATCH 15/20] datapath: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: "Gustavo A. R. Silva" Upstream commit: commit b74912a2fdae9aadd20da502644aa8848c861954 Author: Gustavo A. R. Silva Date: Tue Nov 14 14:26:16 2017 -0600 openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_star It seems that the intention of the code is to null check the value returned by function genlmsg_put. But the current code is null checking the address of the pointer that holds the value returned by genlmsg_put. Fix this by properly null checking the value returned by function genlmsg_put in order to avoid a pontential null pointer dereference. Addresses-Coverity-ID: 1461561 ("Dereference before null check") Addresses-Coverity-ID: 1461562 ("Dereference null return value") Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure") Signed-off-by: Gustavo A. R. Silva Signed-off-by: David S. Miller Cc: Gustavo A. R. Silva Signed-off-by: Greg Rose --- datapath/meter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datapath/meter.c b/datapath/meter.c index 7b9391d..d36870b 100644 --- a/datapath/meter.c +++ b/datapath/meter.c @@ -99,7 +99,7 @@ ovs_meter_cmd_reply_start(struct genl_info *info, u8 cmd, *ovs_reply_header = genlmsg_put(skb, info->snd_portid, info->snd_seq, &dp_meter_genl_family, 0, cmd); - if (!ovs_reply_header) { + if (!*ovs_reply_header) { nlmsg_free(skb); return ERR_PTR(-EMSGSIZE); } From patchwork Tue Jan 30 23:40:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fJ4+Mm/v"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNPr5S9tz9s72 for ; Wed, 31 Jan 2018 10:49:04 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A03DEFB8; Tue, 30 Jan 2018 23:41:04 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 90B03F71 for ; Tue, 30 Jan 2018 23:40:57 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1A0FC334 for ; Tue, 30 Jan 2018 23:40:57 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id n17so8527611pgf.10 for ; Tue, 30 Jan 2018 15:40:57 -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=rZGR2fe3JIi1J+QTA3YBvxj7x0oIo2x/5EQYU0VqSfw=; b=fJ4+Mm/vUMatphTDMoPLq1MPpeWJNQs4np9BHG3H8SIgm/TSKzV/FNxNmOFrh/LMjv 526lcY3mFZyYLPtTaQGRar9PURwplIbJNdPVLNYSsad/1vrP+JKO9TMIKWXRBZJCYafU 1tLxCg5SP3RTQ5pCWcbtntMqOXdo2aS32B7NOYwdq06RMehxw2dJZikjxvYtSaRA2/nZ pTqAVVI8iddEe1jmSUaSq+VMNAhY6VWFTDu7rGBlXJoGkXSic6TJAFOxs5c+ZDQ8OVgJ xgH6Zpq55NwaeDeUfbH8Oi1Uo7RSnbg+OJhqxu6alJOCCCaq8fgsrUzofIl+8BT/qDFq 55FA== 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=rZGR2fe3JIi1J+QTA3YBvxj7x0oIo2x/5EQYU0VqSfw=; b=r3rPTzGU7k4aBJ/NBAdyGGyqYsmnXD8PTGsEJ+w3pIBqnrRIMRJTlh6/cHN02rmtar EDifC80++oN8kflSK6gJd+ZMynolTYkZKWm0NRxJD8kYc7jCYG7Ak3pBs9tM5mxtXLkB X+6VZ8+JZe52+qrA2aYt/tKyP+JhqaUxPMyknOa4Zlz9d6owOUzHYpjmDliwAzunhwhn uvaq2A3shRFcKilJ6TFp1T91bi0ptGGXMUc+Y+vCwtqMZYinroJNykzJgoE1Tottgft+ wnKeAQQHm36Xy0j/G1r6Ciz41fZv9Rq79tOlBfNKu0dkOzKCmyz0nstnTMZZdpPfFt5G xUZQ== X-Gm-Message-State: AKwxyte005utceVQGm9QqAHerPTOJbZHTG0+bpPgBiNT3r2Yod9oamI6 HyvkLedmsS9uEMVgKWp5D6Mxcg== X-Google-Smtp-Source: AH8x2250ZbyU2YUx9ypy7KP70byrZXOZJ0jgefhAOEpPkyZPC8kME9Sq0UM+G8NS3zYBtYlH0sBudQ== X-Received: by 10.101.87.195 with SMTP id q3mr24680420pgr.428.1517355656264; Tue, 30 Jan 2018 15:40:56 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:55 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:18 -0800 Message-Id: <1517355622-26114-17-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: "Gustavo A. R. Silva" Subject: [ovs-dev] [PATCH 16/20] datapath: fix data type in queue_gso_packets X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: "Gustavo A. R. Silva" Upstream commit: commit 2734166e89639c973c6e125ac8bcfc2d9db72b70 Author: Gustavo A. R. Silva Date: Sat Nov 25 13:14:40 2017 -0600 net: openvswitch: datapath: fix data type in queue_gso_packets gso_type is being used in binary AND operations together with SKB_GSO_UDP. The issue is that variable gso_type is of type unsigned short and SKB_GSO_UDP expands to more than 16 bits: SKB_GSO_UDP = 1 << 16 this makes any binary AND operation between gso_type and SKB_GSO_UDP to be always zero, hence making some code unreachable and likely causing undesired behavior. Fix this by changing the data type of variable gso_type to unsigned int. Addresses-Coverity-ID: 1462223 Fixes: 0c19f846d582 ("net: accept UFO datagrams from tuntap and packet") Signed-off-by: Gustavo A. R. Silva Acked-by: Willem de Bruijn Signed-off-by: David S. Miller While backporting this I found another couple of instances of the same issue so I fixed them up as well. Cc: Gustavo A. R. Silva Signed-off-by: Greg Rose --- datapath/datapath.c | 2 +- datapath/linux/compat/stt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 07b6c71..e90177c 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -313,7 +313,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, uint32_t cutlen) { #ifdef HAVE_SKB_GSO_UDP - unsigned short gso_type = skb_shinfo(skb)->gso_type; + unsigned int gso_type = skb_shinfo(skb)->gso_type; struct sw_flow_key later_key; #endif struct sk_buff *segs, *nskb; diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c index 66a97f2..2189476 100644 --- a/datapath/linux/compat/stt.c +++ b/datapath/linux/compat/stt.c @@ -1315,7 +1315,7 @@ static bool validate_checksum(struct sk_buff *skb) static bool set_offloads(struct sk_buff *skb) { struct stthdr *stth = stt_hdr(skb); - unsigned short gso_type = 0; + unsigned int gso_type = 0; int l3_header_size; int l4_header_size; u16 csum_offset; From patchwork Tue Jan 30 23:40:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HqF/JA4C"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNQV3zt0z9s72 for ; Wed, 31 Jan 2018 10:49:38 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8BAF0FBE; Tue, 30 Jan 2018 23:41:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id A8BD3F71 for ; Tue, 30 Jan 2018 23:40:58 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 5136C334 for ; Tue, 30 Jan 2018 23:40:58 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id g16so8531284pgn.7 for ; Tue, 30 Jan 2018 15:40:58 -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=fD2ukvzoH3qpi8xtlJTkK/y9qekoDZ7S+00J6QA/Mo0=; b=HqF/JA4CHL3CYpHByqq8mu3pToCPRC72dd0zai6tbmFqpWCrbZIi0mKaoAdGwo7T7n 9jgMNUQH+dJAWlDLTCRD0efEI60bGtL5L1wJEMMc/BTxEV5sYufaplNpMPjhR8e7QKFL SnYwxLylS0F6Xc5u4PrPaLdrqn3GxhsGdguIG6JY+7b5D/67SuMZZoAMUj08bSKFz62I DlzmBf5c8OO6tvgmBJQffJHfObi8JqJ1UQC068TNlPJm+AEKZCgZD5+KAjxBGTicZpX2 qWglBTUYN/6W7RxQRfdUBH4Q2Q0e0bw9K78hE9TE7BAvmE460VIacpDMgQXwaiUwV9d8 FAZg== 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=fD2ukvzoH3qpi8xtlJTkK/y9qekoDZ7S+00J6QA/Mo0=; b=bR82MTChDda0LGQ7AK3L0WvJ7NqOWY+GvaG9q2t3c0mqnILl386oQqrOgqZK5cm8qu RcsNBvBVwjssH3chfhpnVLzXBqW3Cb8+eI0B0qCnEQAT0yMQDHZ+sUSD7RPRlaKGYX9Z ihZJSZeTrVNZTEpugZY7rL+FOVR8ZEC+6dNKVXK9HYor8jInpbQm2hWXjwBJOOAyh2fh KPT6LtH0rpCbGS8PEAZMXJiow9YONt8Hzxt0N+6zUkrLWoYw6BDUF9J+KiVBsc1tOEl4 +JJ67X+WEVQyuOCbnZIqtBUQ5Zq1VIYQ0HzWue6zLCKlOMyaHp9PV/pa9pE8Vbt0NMp9 SIOQ== X-Gm-Message-State: AKwxytcB55GTiiIqN9YUcw1uITADjzDxxPvLkk9KgajqW0cC0dYPKcd/ RXPSEY2esDAuWHyMkQCHFO9oTg== X-Google-Smtp-Source: AH8x224MHzJvEK79E0zAu3t2pH51cTMt0Auc4rYRs52/P0vh2Vlno1n43DjnBNsC5qccu77wzGTVqg== X-Received: by 2002:a17:902:a4:: with SMTP id a33-v6mr26755065pla.257.1517355657621; Tue, 30 Jan 2018 15:40:57 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:56 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:19 -0800 Message-Id: <1517355622-26114-18-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: zhangliping Subject: [ovs-dev] [PATCH 17/20] datapath: fix the incorrect flow action alloc size X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: zhangliping Upstream commit: commit 67c8d22a73128ff910e2287567132530abcf5b71 Author: zhangliping Date: Sat Nov 25 22:02:12 2017 +0800 openvswitch: fix the incorrect flow action alloc size If we want to add a datapath flow, which has more than 500 vxlan outputs' action, we will get the following error reports: openvswitch: netlink: Flow action size 32832 bytes exceeds max openvswitch: netlink: Flow action size 32832 bytes exceeds max openvswitch: netlink: Actions may not be safe on all matching packets ... ... It seems that we can simply enlarge the MAX_ACTIONS_BUFSIZE to fix it, but this is not the root cause. For example, for a vxlan output action, we need about 60 bytes for the nlattr, but after it is converted to the flow action, it only occupies 24 bytes. This means that we can still support more than 1000 vxlan output actions for a single datapath flow under the the current 32k max limitation. So even if the nla_len(attr) is larger than MAX_ACTIONS_BUFSIZE, we shouldn't report EINVAL and keep it move on, as the judgement can be done by the reserve_sfa_size. Signed-off-by: zhangliping Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Cc: zhangliping Signed-off-by: Greg Rose --- datapath/flow_netlink.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c index 303337c..80c57bd 100644 --- a/datapath/flow_netlink.c +++ b/datapath/flow_netlink.c @@ -1909,14 +1909,11 @@ int ovs_nla_put_mask(const struct sw_flow *flow, struct sk_buff *skb) #define MAX_ACTIONS_BUFSIZE (32 * 1024) #endif -static struct sw_flow_actions *nla_alloc_flow_actions(int size, bool log) +static struct sw_flow_actions *nla_alloc_flow_actions(int size) { struct sw_flow_actions *sfa; - if (size > MAX_ACTIONS_BUFSIZE) { - OVS_NLERR(log, "Flow action size %u bytes exceeds max", size); - return ERR_PTR(-EINVAL); - } + WARN_ON_ONCE(size > MAX_ACTIONS_BUFSIZE); sfa = kmalloc(sizeof(*sfa) + size, GFP_KERNEL); if (!sfa) @@ -1989,12 +1986,15 @@ static struct nlattr *reserve_sfa_size(struct sw_flow_actions **sfa, new_acts_size = ksize(*sfa) * 2; if (new_acts_size > MAX_ACTIONS_BUFSIZE) { - if ((MAX_ACTIONS_BUFSIZE - next_offset) < req_size) + if ((MAX_ACTIONS_BUFSIZE - next_offset) < req_size) { + OVS_NLERR(log, "Flow action size exceeds max %u", + MAX_ACTIONS_BUFSIZE); return ERR_PTR(-EMSGSIZE); + } new_acts_size = MAX_ACTIONS_BUFSIZE; } - acts = nla_alloc_flow_actions(new_acts_size, log); + acts = nla_alloc_flow_actions(new_acts_size); if (IS_ERR(acts)) return (void *)acts; @@ -2673,7 +2673,7 @@ int ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, { int err; - *sfa = nla_alloc_flow_actions(nla_len(attr), log); + *sfa = nla_alloc_flow_actions(min(nla_len(attr), MAX_ACTIONS_BUFSIZE)); if (IS_ERR(*sfa)) return PTR_ERR(*sfa); From patchwork Tue Jan 30 23:40:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867735 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="pgE5U/iS"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNRK5tmrz9s72 for ; Wed, 31 Jan 2018 10:50:21 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id C360FFC3; Tue, 30 Jan 2018 23:41:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 4F805FAE for ; Tue, 30 Jan 2018 23:41:00 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id CD0A02F6 for ; Tue, 30 Jan 2018 23:40:59 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id i66so10670243pfd.7 for ; Tue, 30 Jan 2018 15:40:59 -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=Uzf9hMLkIjou+QkQzYw52xvPFdOhz8zg7ATXt9voDf8=; b=pgE5U/iSuSIl1mkOeG5nKgOWN2N/3yUTruiK34lfhuLPHC39Ir4Tt9wHu5HZfq+4S/ FpzZB8QtsVTVt02D2qt/qdfsbVeSNP1KdLk5N3d95OPu3AH6bJWCnTBOB5srg2Tv74+C HjZ0t1OpmCBYXtNuqeX1zQpPkmI1NcOiq0KLBV/Uyz0u9GTTkrlu4cinQ/ryXjdXyayK H9vW3NLam5TEYlxdZl3jEJzxa22hzSRqPuCN83sgIk39Qvoey64h7n9nFIGB/g1G5tum E9+kphCd2P8FeNlEQi74T8MStVNKi2BYgK1fPjIGj0s1t2J1mY1q7QRlrLLMAyyB+WpA IyUg== 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=Uzf9hMLkIjou+QkQzYw52xvPFdOhz8zg7ATXt9voDf8=; b=ZFEJANes/bxiMD7IL2Tk8n9A217SMWHJ+GakiJICPEGs/RMKO81vsT5gTML6ZBzS6V htb7v+CLwf17z3haiGVXtaiK0Ccxqx035mKRBFI8sUS9uQFkBN4pt9jdEoU7UVcDFCzr OAvXTj6a7qGDd4wTrGXoOu5pa2eWxCU7mhp9ZG/CjFc5JjVKzX161hPg7f4PIG0vvFn/ mIyiqRkkgOoOOV29rbt5hbpCEOXzPeX5rC+UgLZp91benjjaF00b0oXfmmf1u1GSNMJZ hr8KTmDlzSn3bkxjF02uefAdB+yml6Xm8bVrDXal9MDLjpR4QzIN6SXACFSlQGbXJbpS x8UQ== X-Gm-Message-State: AKwxytfcsbLn3BqhGmJrWTd3aOYdvW5wreVg2xiqMrBrGQq80Uc64hPV LEVlvx83X95wYG9Y5x6PHE+3mg== X-Google-Smtp-Source: AH8x227Rco/Ds0MeQeZtL3h2UvTtW/x7SEVk6CQj0MG83kn0xFK4q1BwvObLzgoloD10dod2jrhy9g== X-Received: by 2002:a17:902:32a2:: with SMTP id z31-v6mr27154738plb.345.1517355659042; Tue, 30 Jan 2018 15:40:59 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:58 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:20 -0800 Message-Id: <1517355622-26114-19-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Arnd Bergmann Subject: [ovs-dev] [PATCH 18/20] datapath: use ktime_get_ts64() instead of ktime_get_ts() X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Arnd Bergmann Upstream commit: commit 311af51dcb5629f04976a8e451673f77e3301041 Author: Arnd Bergmann Date: Mon Nov 27 12:41:38 2017 +0100 openvswitch: use ktime_get_ts64() instead of ktime_get_ts() timespec is deprecated because of the y2038 overflow, so let's convert this one to ktime_get_ts64(). The code is already safe even on 32-bit architectures, since it uses monotonic times. On 64-bit architectures, nothing changes, while on 32-bit architectures this avoids one type conversion. Signed-off-by: Arnd Bergmann Signed-off-by: David S. Miller Additional compatability check for ktime_get_ts64() exists or not. If not, then just continue using ktime_get_ts(). Cc: Arnd Bergmann Signed-off-by: Greg Rose --- datapath/flow.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/datapath/flow.c b/datapath/flow.c index 5da7e3e..385e481 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -52,14 +52,19 @@ #include "flow_netlink.h" #include "vport.h" +#ifndef ktime_get_ts64 +#define ktime_get_ts64 ktime_get_ts +#define timespec64 timespec +#endif + u64 ovs_flow_used_time(unsigned long flow_jiffies) { - struct timespec cur_ts; + struct timespec64 cur_ts; u64 cur_ms, idle_ms; - ktime_get_ts(&cur_ts); + ktime_get_ts64(&cur_ts); idle_ms = jiffies_to_msecs(jiffies - flow_jiffies); - cur_ms = (u64)cur_ts.tv_sec * MSEC_PER_SEC + + cur_ms = (u64)(u32)cur_ts.tv_sec * MSEC_PER_SEC + cur_ts.tv_nsec / NSEC_PER_MSEC; return cur_ms - idle_ms; From patchwork Tue Jan 30 23:40:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ODwEo/S0"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNRq73D2z9ryT for ; Wed, 31 Jan 2018 10:50:47 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id C93FDFC9; Tue, 30 Jan 2018 23:41:12 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 93CA3F71 for ; Tue, 30 Jan 2018 23:41:01 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 52F3A306 for ; Tue, 30 Jan 2018 23:41:01 +0000 (UTC) Received: by mail-pg0-f65.google.com with SMTP id o13so8541016pgs.2 for ; Tue, 30 Jan 2018 15:41:01 -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=zul/IE+BxA1AFOQtOkxZ032s5B36DzsMRDIgwClEavM=; b=ODwEo/S0REDgAqzSrOkmTEyY3SxNc3a9LLG/LtkDVY+pm+JZqEvDvtwTeENxLLUoSR 7W0CS2iELEdSO6PIESYZeCPHS28YGGJUufMr22nh3hoX2ow340vif7LlZYJtNgbPmADZ KdYfOxFp+O0j1BXYRXvme6kXlt1MEtJQhqfNIk2JnHONPdhnm5YF/D8CeE/tSlSvm4gP Sk6FShdZzJfoMvJVaC/EEpLdbcyuWAfEmfGEf4ZkJyF/9mIAy+8LIgrGUE+dEwJbNATM 6+wLmRX/OLl2YBPeqwVwBE4jt+USxXXOBVDnE1q1NPJ1L4iuKKFQu/kYqqJFKDJinL+a F2wA== 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=zul/IE+BxA1AFOQtOkxZ032s5B36DzsMRDIgwClEavM=; b=uDSwKRSaVaEO91C02m2rLW7Gt7S5QvfsC12o6eN6oBRJXmSS/mw6J6oxXr/j/dbKbt sSu/S17nSZYE7gPjQ6ZAhkbMr324rJ/HxRJuhKenV1aSlOtFlL7r+EdzjZ2QvAc1yGOh j8QSl5TOgZAB0MGmbRIJP2KYun4lOBkV3lOqjnFk7OmFtCaYLETKrU+ZHjY+iS40bigk zp/yPUS/ldDVaGhZQN1Q1mj/jEEhIqrHmzXrqvndHVBFxyj7mB000aD+thHJjtZgogww ezSerz4swtFFiNdU1CxBXqRLceiJahiEv1H1u0tZSZskWF2solh0eXzsd0ofSQjQGEGU kPdg== X-Gm-Message-State: AKwxytcEBHSvCH1HZHXAb1LUTW9dBmQOKgi1evWE8ZCUr8aJwzdDHDl9 9UgY9gjMlAh0jCKQj7sOn9hVpA== X-Google-Smtp-Source: AH8x226iqFBSr8HpS1Y33aPUgUcnGJm30uruj7BWBblUU+p5NwSq/d1ZDB2tCB8sfnb+BB252j2M7A== X-Received: by 2002:a17:902:9044:: with SMTP id w4-v6mr26923499plz.354.1517355660405; Tue, 30 Jan 2018 15:41:00 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.40.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:40:59 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:21 -0800 Message-Id: <1517355622-26114-20-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 19/20] compat:inet_frag.h: Check for frag_percpu_counter_batch X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Fix up the compat layer to check for frag_percpu_counter_batch and if not present then use atomic_sub and atomic_add as per the backport in the 3.16.50 LTS kernel. Fixes compile errors on 3.16 series kernels from 3.16.50 on. Signed-off-by: Greg Rose --- datapath/linux/compat/include/net/inet_frag.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/datapath/linux/compat/include/net/inet_frag.h b/datapath/linux/compat/include/net/inet_frag.h index 34078c8..c98c3a4 100644 --- a/datapath/linux/compat/include/net/inet_frag.h +++ b/datapath/linux/compat/include/net/inet_frag.h @@ -30,6 +30,7 @@ static inline bool inet_frag_evicting(struct inet_frag_queue *q) #endif #ifndef HAVE_SUB_FRAG_MEM_LIMIT_ARG_STRUCT_NETNS_FRAGS +#ifdef frag_percpu_counter_batch static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i) { __percpu_counter_add(&nf->mem, -i, frag_percpu_counter_batch); @@ -41,6 +42,19 @@ static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i) __percpu_counter_add(&nf->mem, i, frag_percpu_counter_batch); } #define add_frag_mem_limit rpl_add_frag_mem_limit +#else /* frag_percpu_counter_batch */ +static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i) +{ + atomic_sub(i, &nf->mem); +} +#define sub_frag_mem_limit rpl_sub_frag_mem_limit + +static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i) +{ + atomic_add(i, &nf->mem); +} +#define add_frag_mem_limit rpl_add_frag_mem_limit +#endif /* frag_percpu_counter_batch */ #endif #ifdef HAVE_VOID_INET_FRAGS_INIT From patchwork Tue Jan 30 23:40:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 867738 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SZlMWLYC"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zWNSK6vVkz9ryT for ; Wed, 31 Jan 2018 10:51:13 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D7505FBF; Tue, 30 Jan 2018 23:41:13 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id E73E3FAF for ; Tue, 30 Jan 2018 23:41:02 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B59322F6 for ; Tue, 30 Jan 2018 23:41:02 +0000 (UTC) Received: by mail-pg0-f67.google.com with SMTP id z17so8537036pgc.4 for ; Tue, 30 Jan 2018 15:41:02 -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=BQ0TMhY1hN9uXDIT+1M0nupVcvdbSRMl3GedanCLJc4=; b=SZlMWLYCioNZSLCefHbTKKHmE03PsROYBJS5lsg93FR3z6VSu257vsvd8QYRy7yWau fGEdMeWZP5CFB/QDgm5SXoEInx5sKc30BqeQXQOFBjuRrRVoArL9NTjpvSKBeVHJ9ALy N8Moda1EdSmPniViW2D/vULDVMloVKAtraGMNrK8XBNe9Qg3P63HmJQzKBwNOWWryTCl LFBEnRtcHZ7+XShXF9FNvfjasMoyxZliRkq+a3UJaA/WDHaAJ/ZjtYJbMcAvgYvKtM6a IKUOiMBo1+X127eQS+VIZcp7cq0nBsFTU7tKJB6mA4Jxu/QxjkrfMsF4DPaPrfLWOHes PpZg== 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=BQ0TMhY1hN9uXDIT+1M0nupVcvdbSRMl3GedanCLJc4=; b=EIwGwXWsQI+VvME2K0gaLcXIcqVGanvzRbK6Kw3RFJPhCHe2W3U0950qbtC0pl60ZL 4H/4eaVggjriOHs+kO3lGmTo6nl/nGMr9pzpf0/S7Tgjf6na6o0X2XgB6jmtdWQZAEZr 3TgXsH6efDxhdhK1MantWNlGMrF/dpiYSH7hrSprVZlZczySyvPqfbCeuPvtuLXbJ31f mTDfzvaIFgN4PI7ORTKsNa4HBchrIAdEJudc4QaVk1AX0TzruQJQxV0Lsyb7aY4PZiIY HHv217cH8UKLYiecS2jp8RG2N124nZFGEmGPHm06KW8D5TUkVDkYljTdZr3IUzJPHwdM fZbA== X-Gm-Message-State: AKwxytdpqQn4x9etb0D6a1RsNMTIRcSs/5I3Eu+u7P2TwkmXIwajypK6 M6mrzJzoRTnTYErWUYx1ZjtEow== X-Google-Smtp-Source: AH8x22683ouGCi8Ik2UgJ52l3eJD84X9XiQshTp0rdaBjnwYFQnVU08D7tntK45fscV9OVzl6YxGMA== X-Received: by 2002:a17:902:904b:: with SMTP id w11-v6mr26908633plz.41.1517355661903; Tue, 30 Jan 2018 15:41:01 -0800 (PST) Received: from gizo.domain (184-100-240-187.ptld.qwest.net. [184.100.240.187]) by smtp.gmail.com with ESMTPSA id q16sm41403851pfg.124.2018.01.30.15.41.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 15:41:00 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Tue, 30 Jan 2018 15:40:22 -0800 Message-Id: <1517355622-26114-21-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> References: <1517355622-26114-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 20/20] Documentation: Update NEWS and faq X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 62a1957..2f03c89 100644 --- a/Documentation/faq/releases.rst +++ b/Documentation/faq/releases.rst @@ -67,6 +67,7 @@ Q: What Linux kernel versions does each Open vSwitch release work with? 2.7.x 3.10 to 4.9 2.8.x 3.10 to 4.12 2.9.x 3.10 to 4.13 + 2.10.x 3.10 to 4.14 ============ ============== Open vSwitch userspace should also work with the Linux kernel module built diff --git a/NEWS b/NEWS index 726589c..38989bd 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ Post-v2.9.0 -------------------- - ovs-vswitchd: * New options --l7 and --l7-len to "ofproto/trace" command. + - Linux kernel 4.14 + * Add support for compiling OVS with the latest Linux 4.14 kernel v2.9.0 - xx xxx xxxx