From patchwork Sat Jan 30 18:17:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Copeland X-Patchwork-Id: 8172111 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E3CF8BEEE5 for ; Sat, 30 Jan 2016 18:17:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF1E020395 for ; Sat, 30 Jan 2016 18:17:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3B5020392 for ; Sat, 30 Jan 2016 18:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932848AbcA3SRs (ORCPT ); Sat, 30 Jan 2016 13:17:48 -0500 Received: from mail-qg0-f65.google.com ([209.85.192.65]:33824 "EHLO mail-qg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932820AbcA3SRr (ORCPT ); Sat, 30 Jan 2016 13:17:47 -0500 Received: by mail-qg0-f65.google.com with SMTP id 94so7466950qgt.1 for ; Sat, 30 Jan 2016 10:17:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bobcopeland-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=BGqtQLyHDAXG2cNT4aPrKAzzD7655BljhjzY+dXyPqA=; b=RM6BSGRqL5myz4QlIifrNhDQgpLqzzwug38/4LjWiFKzLqHHdah70EjtyzYsvO4ODu Zw0k0/OFkDL0fKqJJZ2U0Br5FUsALfctyrbUMEOpWxKI7qC+/pFulGXH5HZaFRzOpqOn CB0LPN+iXeumq6y15me3PDtLW69aB70CYE4HqdQ2Ld0iRgXurRySzf5ldx39WxzyUXFf BtNK7SP0FVnpyf8MkMouYsSJX7nzfFy/vs/GsjznRiJJMj8siOBYLJEbGHw/pHuUVChX EFN+4yC4iLPe52DU71S4bU06XdLwGbxJECsKydwhil+rILQtqO/zBfKKPpPE3cIEpR9U fcaA== 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; bh=BGqtQLyHDAXG2cNT4aPrKAzzD7655BljhjzY+dXyPqA=; b=We65mhA91h7FXgzk9lGQecbZbd1RThp0wBQzcAeHpqS34JeXCKDK2CN+uVDewiU/Vg Sh2HucdsM5gwI99gq++PbtLyBbTTXic5M2lH2icOqUvcMSsZyEZVoXfgPx3ePJw+MYgu L5wUlSSNNaR5NILiPTJ9mgTEGpyTXty/hn4sPQB6TC6m0666WLG8vKEJSVv5GCRSAlXC AcvYNlqNd8fUx/WIxqa8LUaHaaqamThZgebyBHtNgzBY8vilQHed/GWI8Yp8J4BjqoLc f6mj/Kv16uet3SKxGlVaF8/jaUVyD0seduuZtNDJ6+TrnnY5uC1653gsnMLWxmesU7Op DnIg== X-Gm-Message-State: AG10YOSqmCYEXkig4AORpXWKJ8yBz0LFr1WLPNmBB5Gu6XUOJGxdmn/dtYr4ohp9cmATPg== X-Received: by 10.140.100.229 with SMTP id s92mr18309487qge.19.1454177866290; Sat, 30 Jan 2016 10:17:46 -0800 (PST) Received: from hash ([2001:470:1d:6db:230:48ff:fe9d:9c89]) by smtp.gmail.com with ESMTPSA id 77sm9723311qgg.48.2016.01.30.10.17.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Jan 2016 10:17:45 -0800 (PST) Received: from bob by hash with local (Exim 4.84) (envelope-from ) id 1aPa5U-0006Kr-12; Sat, 30 Jan 2016 13:17:32 -0500 From: Bob Copeland To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Bob Copeland Subject: [PATCH v2] mac80211: mesh: drop constant field mean_chain_len Date: Sat, 30 Jan 2016 13:17:03 -0500 Message-Id: <1454177823-24313-1-git-send-email-me@bobcopeland.com> X-Mailer: git-send-email 2.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The mean_chain_len field in struct mesh_table is copied whenever a new mesh table is allocated, but only ever has the value 2 and is never otherwise updated, so just remove it and use the related define instead. Signed-off-by: Bob Copeland --- v2: Upon rereading the commit log, noticed some lies. Reworded. v1: Sending this by itself as it's pretty trivial and doesn't conflict with other outstanding patches. net/mac80211/mesh.h | 3 --- net/mac80211/mesh_pathtbl.c | 9 +++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 4a8019f..87c017a 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h @@ -137,8 +137,6 @@ struct mesh_path { * @copy_node: function to copy nodes of the table * @size_order: determines size of the table, there will be 2^size_order hash * buckets - * @mean_chain_len: maximum average length for the hash buckets' list, if it is - * reached, the table will grow * @known_gates: list of known mesh gates and their mpaths by the station. The * gate's mpath may or may not be resolved and active. * @@ -154,7 +152,6 @@ struct mesh_table { void (*free_node) (struct hlist_node *p, bool free_leafs); int (*copy_node) (struct hlist_node *p, struct mesh_table *newtbl); int size_order; - int mean_chain_len; struct hlist_head *known_gates; spinlock_t gates_lock; diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index dadf8dc..c95bdb8 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c @@ -160,11 +160,10 @@ static int mesh_table_grow(struct mesh_table *oldtbl, int i; if (atomic_read(&oldtbl->entries) - < oldtbl->mean_chain_len * (oldtbl->hash_mask + 1)) + < MEAN_CHAIN_LEN * (oldtbl->hash_mask + 1)) return -EAGAIN; newtbl->free_node = oldtbl->free_node; - newtbl->mean_chain_len = oldtbl->mean_chain_len; newtbl->copy_node = oldtbl->copy_node; newtbl->known_gates = oldtbl->known_gates; atomic_set(&newtbl->entries, atomic_read(&oldtbl->entries)); @@ -585,7 +584,7 @@ struct mesh_path *mesh_path_add(struct ieee80211_sub_if_data *sdata, hlist_add_head_rcu(&new_node->list, bucket); if (atomic_inc_return(&tbl->entries) >= - tbl->mean_chain_len * (tbl->hash_mask + 1)) + MEAN_CHAIN_LEN * (tbl->hash_mask + 1)) grow = 1; mesh_paths_generation++; @@ -714,7 +713,7 @@ int mpp_path_add(struct ieee80211_sub_if_data *sdata, hlist_add_head_rcu(&new_node->list, bucket); if (atomic_inc_return(&tbl->entries) >= - tbl->mean_chain_len * (tbl->hash_mask + 1)) + MEAN_CHAIN_LEN * (tbl->hash_mask + 1)) grow = 1; spin_unlock(&tbl->hashwlock[hash_idx]); @@ -1076,7 +1075,6 @@ int mesh_pathtbl_init(void) return -ENOMEM; tbl_path->free_node = &mesh_path_node_free; tbl_path->copy_node = &mesh_path_node_copy; - tbl_path->mean_chain_len = MEAN_CHAIN_LEN; tbl_path->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC); if (!tbl_path->known_gates) { ret = -ENOMEM; @@ -1092,7 +1090,6 @@ int mesh_pathtbl_init(void) } tbl_mpp->free_node = &mesh_path_node_free; tbl_mpp->copy_node = &mesh_path_node_copy; - tbl_mpp->mean_chain_len = MEAN_CHAIN_LEN; tbl_mpp->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC); if (!tbl_mpp->known_gates) { ret = -ENOMEM;