From patchwork Fri Nov 27 06:07:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 549307 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 512CE1402D4 for ; Fri, 27 Nov 2015 17:08:00 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b=PdZ5twGS; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 01F3C10DD8; Thu, 26 Nov 2015 22:07:54 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 50BDF10DD8 for ; Thu, 26 Nov 2015 22:07:53 -0800 (PST) Received: from bar3.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 6D3A9161B9B for ; Thu, 26 Nov 2015 23:07:52 -0700 (MST) X-ASG-Debug-ID: 1448604471-03dd7b0fbc1e3850001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar3.cudamail.com with ESMTP id Nh5Ozt75Qb4sLW4E (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 26 Nov 2015 23:07:51 -0700 (MST) X-Barracuda-Envelope-From: simon.horman@netronome.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO mail-pa0-f44.google.com) (209.85.220.44) by mx3-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 27 Nov 2015 06:07:46 -0000 Received-SPF: none (mx3-pf2.cudamail.com: domain at netronome.com does not designate permitted sender hosts) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.44 Received: by pacej9 with SMTP id ej9so105057128pac.2 for ; Thu, 26 Nov 2015 22:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X2ttUU49NigBF/DWZA3L33O7g0bFtgaa5D/6AVnA7To=; b=PdZ5twGSGuAdhXhH8itrVUuWAAvNb2iE18EDDp0s4RrfcI2tLRHnn/w8MjgsTeKsIR loc31w+mEPukUxl5t8/6P9qev1FZdzHwo9XDEcfxY6RS7gMRp2i7sUmrXWB2my4l9WbH E/TYvMU58dxSXF/w54+BK8MujZkePNlq6FmOd5NCP1sXOWHYkiZRQfcrr5CfrNkyWatR R+DITHsbaP38qdM6jH2JIuKPdb6/mLG9QkZ4I+H84jUWNjn0XHi3Sfut9FG5ieQMUTg2 K7ieZRe2cejPnGVbA4NA1I7cpC8Y5rwQeULJqANr4wBrJ1RczNXlRjF9Zu11XE8YRQ0J RIew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X2ttUU49NigBF/DWZA3L33O7g0bFtgaa5D/6AVnA7To=; b=HgxMZyRYsDQZfwg/wgD/ydq6JIeWphYpZOQm+4jSlGWQ3jsLQIKD2X7+DqRK+/XJhX ucnddNCubUbNy7QgaQUDVjAzCQs39b4o3+xxEFgGVPhE1U/0AELs/RhNNxbvcYMxS8XD s/FUgvtZfCNpW4HU1M8HIajrSMiCy6VfzB98h8Sls6Q3OWToXjPcHZ1gShbwiiC5uCaq 3qu3sarelTfafKNAn3DwX44YBfNjod+h6lkXp2gSjRthMGg+5rjLNFvVLbw3sZsya++2 osNktmZJ5sgsAAbSK9Fo1DgoDKHth16ctXy98jMmJYke9nsZLrxOkG4wCrG7IpBgaexu l2RQ== X-Gm-Message-State: ALoCoQliQLvFZkhtdhqvZtfnCMK/8DIy3vGrLjVyyrN2hpGbnAD9Pu+1OcBbxpwDFEZmqsRRRFx+ X-Received: by 10.66.90.194 with SMTP id by2mr65148180pab.2.1448604465676; Thu, 26 Nov 2015 22:07:45 -0800 (PST) Received: from reginn.isobedori.kobe.vergenet.net (p5254-ipbfp1403kobeminato.hyogo.ocn.ne.jp. [114.152.48.254]) by smtp.gmail.com with ESMTPSA id v2sm31182899pfi.44.2015.11.26.22.07.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Nov 2015 22:07:44 -0800 (PST) X-CudaMail-Envelope-Sender: simon.horman@netronome.com X-Barracuda-Apparent-Source-IP: 114.152.48.254 From: Simon Horman To: dev@openvswitch.org, Pravin B Shelar X-CudaMail-MID: CM-V2-1125046076 X-CudaMail-DTE: 112615 X-CudaMail-Originating-IP: 209.85.220.44 Date: Fri, 27 Nov 2015 15:07:22 +0900 X-ASG-Orig-Subj: [##CM-V2-1125046076##][PATCH 1/2] datapath: Provide this_cpu_{read, inc, dec} wrappers for v2.6.33 Message-Id: <1448604443-12224-2-git-send-email-simon.horman@netronome.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1448604443-12224-1-git-send-email-simon.horman@netronome.com> References: <1448604443-12224-1-git-send-email-simon.horman@netronome.com> X-GBUdb-Analysis: 0, 209.85.220.44, Ugly c=0.428574 p=-0.375 Source Normal X-MessageSniffer-Rules: 0-0-0-8526-c X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1448604471 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 1.10 X-Barracuda-Spam-Status: No, SCORE=1.10 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_RULE7568M, BSF_SC5_MJ1963, DKIM_SIGNED, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.24761 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.50 BSF_RULE7568M Custom Rule 7568M 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Cc: Simon Horman Subject: [ovs-dev] [PATCH 1/2] datapath: Provide this_cpu_{read, inc, dec} wrappers for v2.6.33 X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" My understanding is that prior to linux kernel commit dd17c8f72993 ("percpu: remove per_cpu__ prefix.") per_cpu_var(), which was included in v2.6.34, was used to wrap per cpu variables In order to allow Open vSwitch to compile against v2.6.33 and earlier use per_cpu_var() and in order to allow compilation with latter kernels provide a per_cpu_var() which performs an identity map. In the case of v2.6.32 the kernel does not supply this_cpu_{read,inc,dec} and the compat code for RHEL6 in datapath/linux/compat/include/linux/percpu.h is used. Fixes: 60759b2b9d0c ("datapath: Remove recirc stack depth limit check") Signed-off-by: Simon Horman --- * Also applicable to branch-2.4, please consider backporting to that branch. v2 * Add kernel version to test to .travis.yml --- .travis.yml | 1 + datapath/actions.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea1d7e7ebea4..141359b76c1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ env: - KERNEL=3.10.92 - KERNEL=3.4.110 - KERNEL=3.2.72 + - KERNEL=2.6.33.20 - KERNEL=2.6.32.68 script: ./.travis/build.sh $OPTS diff --git a/datapath/actions.c b/datapath/actions.c index c529bbb9b6ee..e8ca114beec2 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -982,12 +982,22 @@ static void process_deferred_actions(struct datapath *dp) action_fifo_init(fifo); } +#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,33) +#define ovs_this_cpu_read(ptr) this_cpu_read(per_cpu_var(ptr)) +#define ovs_this_cpu_inc(ptr) this_cpu_inc(per_cpu_var(ptr)) +#define ovs_this_cpu_dec(ptr) this_cpu_dec(per_cpu_var(ptr)) +#else +#define ovs_this_cpu_read(ptr) this_cpu_read(ptr) +#define ovs_this_cpu_inc(ptr) this_cpu_inc(ptr) +#define ovs_this_cpu_dec(ptr) this_cpu_dec(ptr) +#endif + /* Execute a list of actions against 'skb'. */ int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, const struct sw_flow_actions *acts, struct sw_flow_key *key) { - int level = this_cpu_read(exec_actions_level); + int level = ovs_this_cpu_read(exec_actions_level); int err; if (unlikely(level >= EXEC_ACTIONS_LEVEL_LIMIT)) { @@ -999,14 +1009,14 @@ int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, return -ELOOP; } - this_cpu_inc(exec_actions_level); + ovs_this_cpu_inc(exec_actions_level); err = do_execute_actions(dp, skb, key, acts->actions, acts->actions_len); if (!level) process_deferred_actions(dp); - this_cpu_dec(exec_actions_level); + ovs_this_cpu_dec(exec_actions_level); /* This return status currently does not reflect the errors * encounted during deferred actions execution. Probably needs to