From patchwork Fri Jan 5 19:30:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 856157 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="vYves4L8"; 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 3zCvwB49Hxz9t8K for ; Sat, 6 Jan 2018 06:31:51 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8F3CAD18; Fri, 5 Jan 2018 19:30: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 1DA5CCF4 for ; Fri, 5 Jan 2018 19:30:35 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl0-f65.google.com (mail-pl0-f65.google.com [209.85.160.65]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id CE7E3A7 for ; Fri, 5 Jan 2018 19:30:34 +0000 (UTC) Received: by mail-pl0-f65.google.com with SMTP id 1so3606339plv.0 for ; Fri, 05 Jan 2018 11:30: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; bh=o9fOMOZ7/Soz9tQ2WBN0LuqwxEfznopgoEYQRqa9h1s=; b=vYves4L8Cm8lznqWJJU92Sl5wjBq8uy2fJQKKfiTJe46L4wJWWyFPNVx+cfhHjWLWS zS+7i9PNqbEzn7Ml5d5Vj6+pb6FSAUKcj1FF5HLK1Kwp70nKTp8mUTbFdq818sWar4Vl WXquTiKAffg7DsKalD/8q2QsXYyo4HYHmczBHrTyhXCR7Nz0u0Evg2ZX1qZdTcFTy5BC O+Tp0pr5kxJqSYBmBc4FmYRneyeLSsVFUEWVQx8NbwPYj8U+Z0S882fMNIZ8IL2Me1A0 7zcpW16x71zX4gnbca7j+JOkXwCBopHh5F5YHVGpRfjyz7vSbIuYkq9c6Sm/aZiplAub egJA== 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; bh=o9fOMOZ7/Soz9tQ2WBN0LuqwxEfznopgoEYQRqa9h1s=; b=TJxiRJrcxwnwERrzHaje0Z1iYBlEkWB+bJ/zgMTzp+s2RWWHTXteYbdSuD1fd6vS/e q7WI+fw3+sxIGm/YBGGDlIxlbtuvxFPY4W6AWPcN2wfZEijVFIyn/0kLygLY7OJPl7IV BvRCfUHvc6Cc3X7SBtS2AjemPLuhmhGAJqwtLVoxhrz9d1TarxT6va6Xpf/B8cZdfeHj Pk9nnKRVH8s9i73/pLagajkBqfq8Z0bT8gCTmvRGQ3rCiKB+BWw8l3mUJMgJDHPdDGkm Iej7FDHOfvsqf3hnxj62TS3WECWp1Ef9bI5mlMPz3GiZdK9nAQHpMs/YmQgkIibY7qEO R/GA== X-Gm-Message-State: AKGB3mLZ1m8EFwzgecFW3RNCxotv3feRZu84gDQPQ76gpFoNGe7v45xB bx/Tmn3hVrfzuhbWt/Uys0wM5g== X-Google-Smtp-Source: ACJfBoudHu+5TEHTioy36k9QJj0HPX6eXKqomj2By2Jens16E6XIFRqDu9P0MiR/dM7TVmZ+/PTbNA== X-Received: by 10.84.240.72 with SMTP id h8mr4107489plt.412.1515180634084; Fri, 05 Jan 2018 11:30:34 -0800 (PST) Received: from gizo.domain (67-5-143-47.ptld.qwest.net. [67.5.143.47]) by smtp.gmail.com with ESMTPSA id c2sm11833291pgq.48.2018.01.05.11.30.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jan 2018 11:30:33 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 5 Jan 2018 11:30:24 -0800 Message-Id: <1515180624-27516-1-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 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 V2] 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 --- V2 - Fix typo --- 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