Commit b7cfcd11 authored by Thomas Pedersen's avatar Thomas Pedersen Committed by Johannes Berg

mac80211: RMC buckets are just list heads

The array of rmc_entrys is redundant since only the
list_head is used. Make this an array of list_heads
instead and save ~6k per vif at runtime :D
Signed-off-by: default avatarThomas Pedersen <thomas@cozybit.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 4d76d21b
...@@ -163,7 +163,7 @@ int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) ...@@ -163,7 +163,7 @@ int mesh_rmc_init(struct ieee80211_sub_if_data *sdata)
return -ENOMEM; return -ENOMEM;
sdata->u.mesh.rmc->idx_mask = RMC_BUCKETS - 1; sdata->u.mesh.rmc->idx_mask = RMC_BUCKETS - 1;
for (i = 0; i < RMC_BUCKETS; i++) for (i = 0; i < RMC_BUCKETS; i++)
INIT_LIST_HEAD(&sdata->u.mesh.rmc->bucket[i].list); INIT_LIST_HEAD(&sdata->u.mesh.rmc->bucket[i]);
return 0; return 0;
} }
...@@ -177,7 +177,7 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata) ...@@ -177,7 +177,7 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata)
return; return;
for (i = 0; i < RMC_BUCKETS; i++) for (i = 0; i < RMC_BUCKETS; i++)
list_for_each_entry_safe(p, n, &rmc->bucket[i].list, list) { list_for_each_entry_safe(p, n, &rmc->bucket[i], list) {
list_del(&p->list); list_del(&p->list);
kmem_cache_free(rm_cache, p); kmem_cache_free(rm_cache, p);
} }
...@@ -210,7 +210,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, ...@@ -210,7 +210,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
/* Don't care about endianness since only match matters */ /* Don't care about endianness since only match matters */
memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum)); memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum));
idx = le32_to_cpu(mesh_hdr->seqnum) & rmc->idx_mask; idx = le32_to_cpu(mesh_hdr->seqnum) & rmc->idx_mask;
list_for_each_entry_safe(p, n, &rmc->bucket[idx].list, list) { list_for_each_entry_safe(p, n, &rmc->bucket[idx], list) {
++entries; ++entries;
if (time_after(jiffies, p->exp_time) || if (time_after(jiffies, p->exp_time) ||
(entries == RMC_QUEUE_MAX_LEN)) { (entries == RMC_QUEUE_MAX_LEN)) {
...@@ -229,7 +229,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, ...@@ -229,7 +229,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
p->seqnum = seqnum; p->seqnum = seqnum;
p->exp_time = jiffies + RMC_TIMEOUT; p->exp_time = jiffies + RMC_TIMEOUT;
memcpy(p->sa, sa, ETH_ALEN); memcpy(p->sa, sa, ETH_ALEN);
list_add(&p->list, &rmc->bucket[idx].list); list_add(&p->list, &rmc->bucket[idx]);
return 0; return 0;
} }
......
...@@ -184,7 +184,7 @@ struct rmc_entry { ...@@ -184,7 +184,7 @@ struct rmc_entry {
}; };
struct mesh_rmc { struct mesh_rmc {
struct rmc_entry bucket[RMC_BUCKETS]; struct list_head bucket[RMC_BUCKETS];
u32 idx_mask; u32 idx_mask;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment