diff options
| author | Bob Copeland <me@bobcopeland.com> | 2016-01-30 13:17:03 -0500 |
|---|---|---|
| committer | Johannes Berg <johannes.berg@intel.com> | 2016-02-24 03:04:29 -0500 |
| commit | 3f73fe9fd8703123faf663908923ca9e62cb984e (patch) | |
| tree | 0a06be161738014422f29947fbcd5a7a9f88c74b | |
| parent | 0ef049dc1167fe834d0ad5d63f89eddc5c70f6e4 (diff) | |
mac80211: mesh: drop constant field mean_chain_len
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>
| -rw-r--r-- | net/mac80211/mesh.h | 3 | ||||
| -rw-r--r-- | 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 a1596344c3ba..d941f3a73a4f 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
| @@ -137,8 +137,6 @@ struct mesh_path { | |||
| 137 | * @copy_node: function to copy nodes of the table | 137 | * @copy_node: function to copy nodes of the table |
| 138 | * @size_order: determines size of the table, there will be 2^size_order hash | 138 | * @size_order: determines size of the table, there will be 2^size_order hash |
| 139 | * buckets | 139 | * buckets |
| 140 | * @mean_chain_len: maximum average length for the hash buckets' list, if it is | ||
| 141 | * reached, the table will grow | ||
| 142 | * @known_gates: list of known mesh gates and their mpaths by the station. The | 140 | * @known_gates: list of known mesh gates and their mpaths by the station. The |
| 143 | * gate's mpath may or may not be resolved and active. | 141 | * gate's mpath may or may not be resolved and active. |
| 144 | * | 142 | * |
| @@ -154,7 +152,6 @@ struct mesh_table { | |||
| 154 | void (*free_node) (struct hlist_node *p, bool free_leafs); | 152 | void (*free_node) (struct hlist_node *p, bool free_leafs); |
| 155 | int (*copy_node) (struct hlist_node *p, struct mesh_table *newtbl); | 153 | int (*copy_node) (struct hlist_node *p, struct mesh_table *newtbl); |
| 156 | int size_order; | 154 | int size_order; |
| 157 | int mean_chain_len; | ||
| 158 | struct hlist_head *known_gates; | 155 | struct hlist_head *known_gates; |
| 159 | spinlock_t gates_lock; | 156 | spinlock_t gates_lock; |
| 160 | 157 | ||
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index dadf8dc6f1cf..c95bdb8bb452 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, | |||
| 160 | int i; | 160 | int i; |
| 161 | 161 | ||
| 162 | if (atomic_read(&oldtbl->entries) | 162 | if (atomic_read(&oldtbl->entries) |
| 163 | < oldtbl->mean_chain_len * (oldtbl->hash_mask + 1)) | 163 | < MEAN_CHAIN_LEN * (oldtbl->hash_mask + 1)) |
| 164 | return -EAGAIN; | 164 | return -EAGAIN; |
| 165 | 165 | ||
| 166 | newtbl->free_node = oldtbl->free_node; | 166 | newtbl->free_node = oldtbl->free_node; |
| 167 | newtbl->mean_chain_len = oldtbl->mean_chain_len; | ||
| 168 | newtbl->copy_node = oldtbl->copy_node; | 167 | newtbl->copy_node = oldtbl->copy_node; |
| 169 | newtbl->known_gates = oldtbl->known_gates; | 168 | newtbl->known_gates = oldtbl->known_gates; |
| 170 | atomic_set(&newtbl->entries, atomic_read(&oldtbl->entries)); | 169 | atomic_set(&newtbl->entries, atomic_read(&oldtbl->entries)); |
| @@ -585,7 +584,7 @@ struct mesh_path *mesh_path_add(struct ieee80211_sub_if_data *sdata, | |||
| 585 | 584 | ||
| 586 | hlist_add_head_rcu(&new_node->list, bucket); | 585 | hlist_add_head_rcu(&new_node->list, bucket); |
| 587 | if (atomic_inc_return(&tbl->entries) >= | 586 | if (atomic_inc_return(&tbl->entries) >= |
| 588 | tbl->mean_chain_len * (tbl->hash_mask + 1)) | 587 | MEAN_CHAIN_LEN * (tbl->hash_mask + 1)) |
| 589 | grow = 1; | 588 | grow = 1; |
| 590 | 589 | ||
| 591 | mesh_paths_generation++; | 590 | mesh_paths_generation++; |
| @@ -714,7 +713,7 @@ int mpp_path_add(struct ieee80211_sub_if_data *sdata, | |||
| 714 | 713 | ||
| 715 | hlist_add_head_rcu(&new_node->list, bucket); | 714 | hlist_add_head_rcu(&new_node->list, bucket); |
| 716 | if (atomic_inc_return(&tbl->entries) >= | 715 | if (atomic_inc_return(&tbl->entries) >= |
| 717 | tbl->mean_chain_len * (tbl->hash_mask + 1)) | 716 | MEAN_CHAIN_LEN * (tbl->hash_mask + 1)) |
| 718 | grow = 1; | 717 | grow = 1; |
| 719 | 718 | ||
| 720 | spin_unlock(&tbl->hashwlock[hash_idx]); | 719 | spin_unlock(&tbl->hashwlock[hash_idx]); |
| @@ -1076,7 +1075,6 @@ int mesh_pathtbl_init(void) | |||
| 1076 | return -ENOMEM; | 1075 | return -ENOMEM; |
| 1077 | tbl_path->free_node = &mesh_path_node_free; | 1076 | tbl_path->free_node = &mesh_path_node_free; |
| 1078 | tbl_path->copy_node = &mesh_path_node_copy; | 1077 | tbl_path->copy_node = &mesh_path_node_copy; |
| 1079 | tbl_path->mean_chain_len = MEAN_CHAIN_LEN; | ||
| 1080 | tbl_path->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC); | 1078 | tbl_path->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC); |
| 1081 | if (!tbl_path->known_gates) { | 1079 | if (!tbl_path->known_gates) { |
| 1082 | ret = -ENOMEM; | 1080 | ret = -ENOMEM; |
| @@ -1092,7 +1090,6 @@ int mesh_pathtbl_init(void) | |||
| 1092 | } | 1090 | } |
| 1093 | tbl_mpp->free_node = &mesh_path_node_free; | 1091 | tbl_mpp->free_node = &mesh_path_node_free; |
| 1094 | tbl_mpp->copy_node = &mesh_path_node_copy; | 1092 | tbl_mpp->copy_node = &mesh_path_node_copy; |
| 1095 | tbl_mpp->mean_chain_len = MEAN_CHAIN_LEN; | ||
| 1096 | tbl_mpp->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC); | 1093 | tbl_mpp->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC); |
| 1097 | if (!tbl_mpp->known_gates) { | 1094 | if (!tbl_mpp->known_gates) { |
| 1098 | ret = -ENOMEM; | 1095 | ret = -ENOMEM; |
