Skip to content

Commit

Permalink
mac80211: mesh: drop constant field mean_chain_len
Browse files Browse the repository at this point in the history
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 <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Bob Copeland authored and Johannes Berg committed Feb 24, 2016
1 parent 0ef049d commit 3f73fe9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 0 additions & 3 deletions net/mac80211/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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;

Expand Down
9 changes: 3 additions & 6 deletions net/mac80211/mesh_pathtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 3f73fe9

Please sign in to comment.