From patchwork Thu Jul 21 23:30:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16566 X-Patchwork-Delegate: sven@narfation.org Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 27C1282DD8; Fri, 22 Jul 2016 01:30:27 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=narfation.org Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=mhbvoSMD; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=79.140.41.39; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=pass header.from=narfation.org Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 9845C82DD6 for ; Fri, 22 Jul 2016 01:30:18 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p200300C593C0FCF90000000000002E16.dip0.t-ipconnect.de [IPv6:2003:c5:93c0:fcf9::2e16]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 283251100F1; Fri, 22 Jul 2016 01:30:18 +0200 (CEST) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1469143818; bh=Guzq4Qu3/aaVxr82pAC+/yreqX9JenBVYUbfA1+ysLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mhbvoSMDg/w9Cggfa7h3rQmOqceXCtL/o6jmkej0ZL5QZFurLXVkXGAiKUGt4Pyml GNRxu45NBsad5W7u0m+52mszIN0p4Ait2gw9HSICEx4+HOSKLmDnkQfdQ4oKY9DakV qRr3l9X/jNNKoIUqE4DlJOueHThMquLZWsZRYV8Q= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 22 Jul 2016 01:30:10 +0200 Message-Id: <1469143811-15498-2-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1469143811-15498-1-git-send-email-sven@narfation.org> References: <1469143811-15498-1-git-send-email-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: Move batadv_sum_counter to soft-interface.c X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" The function batadv_sum_counter is only used in soft-interface.c and has no special relevance for main.h. Signed-off-by: Sven Eckelmann --- net/batman-adv/main.h | 21 --------------------- net/batman-adv/soft-interface.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 06a8608..3633515 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h @@ -185,7 +185,6 @@ enum batadv_uev_type { #include /* for packet.h */ #include -#include #include #include /* for packet.h */ #include @@ -284,26 +283,6 @@ static inline void batadv_add_counter(struct batadv_priv *bat_priv, size_t idx, #define batadv_inc_counter(b, i) batadv_add_counter(b, i, 1) -/** - * batadv_sum_counter - Sum the cpu-local counters for index 'idx' - * @bat_priv: the bat priv with all the soft interface information - * @idx: index of counter to sum up - * - * Return: sum of all cpu-local counters - */ -static inline u64 batadv_sum_counter(struct batadv_priv *bat_priv, size_t idx) -{ - u64 *counters, sum = 0; - int cpu; - - for_each_possible_cpu(cpu) { - counters = per_cpu_ptr(bat_priv->bat_counters, cpu); - sum += counters[idx]; - } - - return sum; -} - /* Define a macro to reach the control buffer of the skb. The members of the * control buffer are defined in struct batadv_skb_cb in types.h. * The macro is inspired by the similar macro TCP_SKB_CB() in tcp.h. diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 49e16b6..f37c1c7 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -116,6 +117,26 @@ static int batadv_interface_release(struct net_device *dev) return 0; } +/** + * batadv_sum_counter - Sum the cpu-local counters for index 'idx' + * @bat_priv: the bat priv with all the soft interface information + * @idx: index of counter to sum up + * + * Return: sum of all cpu-local counters + */ +static u64 batadv_sum_counter(struct batadv_priv *bat_priv, size_t idx) +{ + u64 *counters, sum = 0; + int cpu; + + for_each_possible_cpu(cpu) { + counters = per_cpu_ptr(bat_priv->bat_counters, cpu); + sum += counters[idx]; + } + + return sum; +} + static struct net_device_stats *batadv_interface_stats(struct net_device *dev) { struct batadv_priv *bat_priv = netdev_priv(dev);