Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
- for (i = 0 ; i < hash->size; i++)
+ for (i = 0 ; i < hash->size; i++) {
INIT_HLIST_HEAD(&hash->table[i]);
INIT_HLIST_HEAD(&hash->table[i]);
+ spin_lock_init(&hash->list_locks[i]);
+ }
}
/* free only the hashtable and the hash itself. */
void hash_destroy(struct hashtable_t *hash)
{
}
/* free only the hashtable and the hash itself. */
void hash_destroy(struct hashtable_t *hash)
{
+ kfree(hash->list_locks);
kfree(hash->table);
kfree(hash);
}
kfree(hash->table);
kfree(hash);
}
{
struct hashtable_t *hash;
{
struct hashtable_t *hash;
- hash = kmalloc(sizeof(struct hashtable_t) , GFP_ATOMIC);
-
+ hash = kmalloc(sizeof(struct hashtable_t), GFP_ATOMIC);
hash->table = kmalloc(sizeof(struct element_t *) * size, GFP_ATOMIC);
hash->table = kmalloc(sizeof(struct element_t *) * size, GFP_ATOMIC);
+ if (!hash->table)
+ goto free_hash;
- if (!hash->table) {
- kfree(hash);
- return NULL;
- }
+ hash->list_locks = kmalloc(sizeof(spinlock_t) * size, GFP_ATOMIC);
+ if (!hash->list_locks)
+ goto free_table;
+
+free_table:
+ kfree(hash->table);
+free_hash:
+ kfree(hash);
+ return NULL;
+}
+
+void bucket_free_rcu(struct rcu_head *rcu)
+{
+ struct element_t *bucket;
+
+ bucket = container_of(rcu, struct element_t, rcu);
+ kfree(bucket);
struct element_t {
void *data; /* pointer to the data */
struct hlist_node hlist; /* bucket list pointer */
struct element_t {
void *data; /* pointer to the data */
struct hlist_node hlist; /* bucket list pointer */
- struct hlist_head *table; /* the hashtable itself, with the buckets */
+ struct hlist_head *table; /* the hashtable itself with the buckets */
+ spinlock_t *list_locks; /* spinlock for each hash list entry */
int size; /* size of hashtable */
};
int size; /* size of hashtable */
};
/* free only the hashtable and the hash itself. */
void hash_destroy(struct hashtable_t *hash);
/* free only the hashtable and the hash itself. */
void hash_destroy(struct hashtable_t *hash);
+void bucket_free_rcu(struct rcu_head *rcu);
+
/* remove the hash structure. if hashdata_free_cb != NULL, this function will be
* called to remove the elements inside of the hash. if you don't remove the
* elements, memory might be leaked. */
/* remove the hash structure. if hashdata_free_cb != NULL, this function will be
* called to remove the elements inside of the hash. if you don't remove the
* elements, memory might be leaked. */
struct hlist_head *head;
struct hlist_node *walk, *safe;
struct element_t *bucket;
struct hlist_head *head;
struct hlist_node *walk, *safe;
struct element_t *bucket;
+ spinlock_t *list_lock; /* spinlock to protect write access */
int i;
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
int i;
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
+ list_lock = &hash->list_locks[i];
- hlist_for_each_safe(walk, safe, head) {
- bucket = hlist_entry(walk, struct element_t, hlist);
+ spin_lock_bh(list_lock);
+ hlist_for_each_entry_safe(bucket, walk, safe, head, hlist) {
if (free_cb)
free_cb(bucket->data, arg);
if (free_cb)
free_cb(bucket->data, arg);
- hlist_del(walk);
- kfree(bucket);
+ hlist_del_rcu(walk);
+ call_rcu(&bucket->rcu, bucket_free_rcu);
+ spin_unlock_bh(list_lock);
struct hlist_head *head;
struct hlist_node *walk, *safe;
struct element_t *bucket;
struct hlist_head *head;
struct hlist_node *walk, *safe;
struct element_t *bucket;
+ spinlock_t *list_lock; /* spinlock to protect write access */
index = choose(data, hash->size);
head = &hash->table[index];
index = choose(data, hash->size);
head = &hash->table[index];
+ list_lock = &hash->list_locks[index];
- hlist_for_each_safe(walk, safe, head) {
- bucket = hlist_entry(walk, struct element_t, hlist);
+ rcu_read_lock();
+ hlist_for_each_entry_safe(bucket, walk, safe, head, hlist) {
if (compare(bucket->data, data))
if (compare(bucket->data, data))
/* no duplicate found in list, add new element */
bucket = kmalloc(sizeof(struct element_t), GFP_ATOMIC);
/* no duplicate found in list, add new element */
bucket = kmalloc(sizeof(struct element_t), GFP_ATOMIC);
- hlist_add_head(&bucket->hlist, head);
+
+ spin_lock_bh(list_lock);
+ hlist_add_head_rcu(&bucket->hlist, head);
+ spin_unlock_bh(list_lock);
+
+err_unlock:
+ rcu_read_unlock();
+err:
+ return -1;
}
/* removes data from hash, if found. returns pointer do data on success, so you
}
/* removes data from hash, if found. returns pointer do data on success, so you
struct hlist_node *walk;
struct element_t *bucket;
struct hlist_head *head;
struct hlist_node *walk;
struct element_t *bucket;
struct hlist_head *head;
+ void *data_save = NULL;
index = choose(data, hash->size);
head = &hash->table[index];
index = choose(data, hash->size);
head = &hash->table[index];
+ spin_lock_bh(&hash->list_locks[index]);
hlist_for_each_entry(bucket, walk, head, hlist) {
if (compare(bucket->data, data)) {
data_save = bucket->data;
hlist_for_each_entry(bucket, walk, head, hlist) {
if (compare(bucket->data, data)) {
data_save = bucket->data;
- hlist_del(walk);
- kfree(bucket);
- return data_save;
+ hlist_del_rcu(walk);
+ call_rcu(&bucket->rcu, bucket_free_rcu);
+ break;
+ spin_unlock_bh(&hash->list_locks[index]);
-/* finds data, based on the key in keydata. returns the found data on success,
- * or NULL on error */
+/**
+ * finds data, based on the key in keydata. returns the found data on success,
+ * or NULL on error
+ *
+ * caller must lock with rcu_read_lock() / rcu_read_unlock()
+ **/
static inline void *hash_find(struct hashtable_t *hash,
hashdata_compare_cb compare,
hashdata_choose_cb choose, void *keydata)
static inline void *hash_find(struct hashtable_t *hash,
hashdata_compare_cb compare,
hashdata_choose_cb choose, void *keydata)
struct hlist_head *head;
struct hlist_node *walk;
struct element_t *bucket;
struct hlist_head *head;
struct hlist_node *walk;
struct element_t *bucket;
+ void *bucket_data = NULL;
index = choose(keydata , hash->size);
head = &hash->table[index];
index = choose(keydata , hash->size);
head = &hash->table[index];
- hlist_for_each(walk, head) {
- bucket = hlist_entry(walk, struct element_t, hlist);
- if (compare(bucket->data, keydata))
- return bucket->data;
+ hlist_for_each_entry(bucket, walk, head, hlist) {
+ if (compare(bucket->data, keydata)) {
+ bucket_data = bucket->data;
+ break;
+ }
}
#endif /* _NET_BATMAN_ADV_HASH_H_ */
}
#endif /* _NET_BATMAN_ADV_HASH_H_ */
goto dst_unreach;
spin_lock_bh(&bat_priv->orig_hash_lock);
goto dst_unreach;
spin_lock_bh(&bat_priv->orig_hash_lock);
orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
compare_orig, choose_orig,
icmp_packet->dst));
orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
compare_orig, choose_orig,
icmp_packet->dst));
if (!orig_node)
goto unlock;
if (!orig_node)
goto unlock;
int size;
int hash_added;
int size;
int hash_added;
orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
compare_orig, choose_orig,
addr));
orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
compare_orig, choose_orig,
addr));
if (orig_node)
return orig_node;
if (orig_node)
return orig_node;
struct hlist_node *walk, *safe;
struct hlist_head *head;
struct element_t *bucket;
struct hlist_node *walk, *safe;
struct hlist_head *head;
struct element_t *bucket;
+ spinlock_t *list_lock; /* spinlock to protect write access */
struct orig_node *orig_node;
int i;
struct orig_node *orig_node;
int i;
/* for all origins... */
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
/* for all origins... */
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
+ list_lock = &hash->list_locks[i];
+ spin_lock_bh(list_lock);
hlist_for_each_entry_safe(bucket, walk, safe, head, hlist) {
orig_node = bucket->data;
if (purge_orig_node(bat_priv, orig_node)) {
if (orig_node->gw_flags)
gw_node_delete(bat_priv, orig_node);
hlist_for_each_entry_safe(bucket, walk, safe, head, hlist) {
orig_node = bucket->data;
if (purge_orig_node(bat_priv, orig_node)) {
if (orig_node->gw_flags)
gw_node_delete(bat_priv, orig_node);
- hlist_del(walk);
- kfree(bucket);
+ hlist_del_rcu(walk);
+ call_rcu(&bucket->rcu, bucket_free_rcu);
free_orig_node(orig_node, bat_priv);
free_orig_node(orig_node, bat_priv);
}
if (time_after(jiffies, orig_node->last_frag_packet +
msecs_to_jiffies(FRAG_TIMEOUT)))
frag_list_free(&orig_node->frag_list);
}
}
if (time_after(jiffies, orig_node->last_frag_packet +
msecs_to_jiffies(FRAG_TIMEOUT)))
frag_list_free(&orig_node->frag_list);
}
+ spin_unlock_bh(list_lock);
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
- hlist_for_each_entry(bucket, walk, head, hlist) {
+ rcu_read_lock();
+ hlist_for_each_entry_rcu(bucket, walk, head, hlist) {
orig_node = bucket->data;
if (!orig_node->router)
orig_node = bucket->data;
if (!orig_node->router)
neigh_node->addr,
neigh_node->if_incoming->net_dev->name);
neigh_node->addr,
neigh_node->if_incoming->net_dev->name);
hlist_for_each_entry_rcu(neigh_node, node,
&orig_node->neigh_list, list) {
seq_printf(seq, " %pM (%3i)", neigh_node->addr,
neigh_node->tq_avg);
}
hlist_for_each_entry_rcu(neigh_node, node,
&orig_node->neigh_list, list) {
seq_printf(seq, " %pM (%3i)", neigh_node->addr,
neigh_node->tq_avg);
}
seq_printf(seq, "\n");
batman_count++;
}
seq_printf(seq, "\n");
batman_count++;
}
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
- hlist_for_each_entry(bucket, walk, head, hlist) {
+ rcu_read_lock();
+ hlist_for_each_entry_rcu(bucket, walk, head, hlist) {
orig_node = bucket->data;
if (orig_node_add_if(orig_node, max_if_num) == -1)
goto err;
}
orig_node = bucket->data;
if (orig_node_add_if(orig_node, max_if_num) == -1)
goto err;
}
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
return 0;
err:
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
return 0;
err:
spin_unlock_bh(&bat_priv->orig_hash_lock);
return -ENOMEM;
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
return -ENOMEM;
}
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
- hlist_for_each_entry(bucket, walk, head, hlist) {
+ rcu_read_lock();
+ hlist_for_each_entry_rcu(bucket, walk, head, hlist) {
orig_node = bucket->data;
ret = orig_node_del_if(orig_node, max_if_num,
orig_node = bucket->data;
ret = orig_node_del_if(orig_node, max_if_num,
if (ret == -1)
goto err;
}
if (ret == -1)
goto err;
}
}
/* renumber remaining batman interfaces _inside_ of orig_hash_lock */
}
/* renumber remaining batman interfaces _inside_ of orig_hash_lock */
spin_unlock_bh(&bat_priv->orig_hash_lock);
return -ENOMEM;
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
return -ENOMEM;
}
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
- hlist_for_each_entry(bucket, walk, head, hlist) {
+ rcu_read_lock();
+ hlist_for_each_entry_rcu(bucket, walk, head, hlist) {
orig_node = bucket->data;
word_index = batman_if->if_num * NUM_WORDS;
word = &(orig_node->bcast_own[word_index]);
orig_node = bucket->data;
word_index = batman_if->if_num * NUM_WORDS;
word = &(orig_node->bcast_own[word_index]);
orig_node->bcast_own_sum[batman_if->if_num] =
bit_packet_count(word);
}
orig_node->bcast_own_sum[batman_if->if_num] =
bit_packet_count(word);
}
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
/* answer echo request (ping) */
/* get routing information */
spin_lock_bh(&bat_priv->orig_hash_lock);
/* answer echo request (ping) */
/* get routing information */
spin_lock_bh(&bat_priv->orig_hash_lock);
orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
compare_orig, choose_orig,
icmp_packet->orig));
orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
compare_orig, choose_orig,
icmp_packet->orig));
ret = NET_RX_DROP;
if ((orig_node) && (orig_node->router)) {
ret = NET_RX_DROP;
if ((orig_node) && (orig_node->router)) {
/* get routing information */
spin_lock_bh(&bat_priv->orig_hash_lock);
/* get routing information */
spin_lock_bh(&bat_priv->orig_hash_lock);
orig_node = ((struct orig_node *)
hash_find(bat_priv->orig_hash, compare_orig, choose_orig,
icmp_packet->orig));
orig_node = ((struct orig_node *)
hash_find(bat_priv->orig_hash, compare_orig, choose_orig,
icmp_packet->orig));
ret = NET_RX_DROP;
if ((orig_node) && (orig_node->router)) {
ret = NET_RX_DROP;
if ((orig_node) && (orig_node->router)) {
/* get routing information */
spin_lock_bh(&bat_priv->orig_hash_lock);
/* get routing information */
spin_lock_bh(&bat_priv->orig_hash_lock);
orig_node = ((struct orig_node *)
hash_find(bat_priv->orig_hash, compare_orig, choose_orig,
icmp_packet->dst));
orig_node = ((struct orig_node *)
hash_find(bat_priv->orig_hash, compare_orig, choose_orig,
icmp_packet->dst));
if ((orig_node) && (orig_node->router)) {
if ((orig_node) && (orig_node->router)) {
router_orig->orig, ETH_ALEN) == 0) {
primary_orig_node = router_orig;
} else {
router_orig->orig, ETH_ALEN) == 0) {
primary_orig_node = router_orig;
} else {
primary_orig_node = hash_find(bat_priv->orig_hash, compare_orig,
choose_orig,
router_orig->primary_addr);
primary_orig_node = hash_find(bat_priv->orig_hash, compare_orig,
choose_orig,
router_orig->primary_addr);
if (!primary_orig_node)
return orig_node->router;
if (!primary_orig_node)
return orig_node->router;
/* get routing information */
spin_lock_bh(&bat_priv->orig_hash_lock);
/* get routing information */
spin_lock_bh(&bat_priv->orig_hash_lock);
orig_node = ((struct orig_node *)
hash_find(bat_priv->orig_hash, compare_orig, choose_orig,
unicast_packet->dest));
orig_node = ((struct orig_node *)
hash_find(bat_priv->orig_hash, compare_orig, choose_orig,
unicast_packet->dest));
router = find_router(bat_priv, orig_node, recv_if);
router = find_router(bat_priv, orig_node, recv_if);
return NET_RX_DROP;
spin_lock_bh(&bat_priv->orig_hash_lock);
return NET_RX_DROP;
spin_lock_bh(&bat_priv->orig_hash_lock);
orig_node = ((struct orig_node *)
hash_find(bat_priv->orig_hash, compare_orig, choose_orig,
bcast_packet->orig));
orig_node = ((struct orig_node *)
hash_find(bat_priv->orig_hash, compare_orig, choose_orig,
bcast_packet->orig));
if (!orig_node) {
spin_unlock_bh(&bat_priv->orig_hash_lock);
if (!orig_node) {
spin_unlock_bh(&bat_priv->orig_hash_lock);
int required_bytes;
spin_lock_bh(&bat_priv->hna_lhash_lock);
int required_bytes;
spin_lock_bh(&bat_priv->hna_lhash_lock);
hna_local_entry =
((struct hna_local_entry *)hash_find(bat_priv->hna_local_hash,
compare_orig, choose_orig,
addr));
hna_local_entry =
((struct hna_local_entry *)hash_find(bat_priv->hna_local_hash,
compare_orig, choose_orig,
addr));
spin_unlock_bh(&bat_priv->hna_lhash_lock);
if (hna_local_entry) {
spin_unlock_bh(&bat_priv->hna_lhash_lock);
if (hna_local_entry) {
/* remove address from global hash if present */
spin_lock_bh(&bat_priv->hna_ghash_lock);
/* remove address from global hash if present */
spin_lock_bh(&bat_priv->hna_ghash_lock);
hna_global_entry = ((struct hna_global_entry *)
hash_find(bat_priv->hna_global_hash,
compare_orig, choose_orig, addr));
hna_global_entry = ((struct hna_global_entry *)
hash_find(bat_priv->hna_global_hash,
compare_orig, choose_orig, addr));
if (hna_global_entry)
_hna_global_del_orig(bat_priv, hna_global_entry,
if (hna_global_entry)
_hna_global_del_orig(bat_priv, hna_global_entry,
spin_lock_bh(&bat_priv->hna_lhash_lock);
spin_lock_bh(&bat_priv->hna_lhash_lock);
hna_local_entry = (struct hna_local_entry *)
hash_find(bat_priv->hna_local_hash, compare_orig, choose_orig,
addr);
hna_local_entry = (struct hna_local_entry *)
hash_find(bat_priv->hna_local_hash, compare_orig, choose_orig,
addr);
if (hna_local_entry)
hna_local_del(bat_priv, hna_local_entry, message);
if (hna_local_entry)
hna_local_del(bat_priv, hna_local_entry, message);
spin_lock_bh(&bat_priv->hna_ghash_lock);
hna_ptr = hna_buff + (hna_buff_count * ETH_ALEN);
spin_lock_bh(&bat_priv->hna_ghash_lock);
hna_ptr = hna_buff + (hna_buff_count * ETH_ALEN);
hna_global_entry = (struct hna_global_entry *)
hash_find(bat_priv->hna_global_hash, compare_orig,
choose_orig, hna_ptr);
hna_global_entry = (struct hna_global_entry *)
hash_find(bat_priv->hna_global_hash, compare_orig,
choose_orig, hna_ptr);
if (!hna_global_entry) {
spin_unlock_bh(&bat_priv->hna_ghash_lock);
if (!hna_global_entry) {
spin_unlock_bh(&bat_priv->hna_ghash_lock);
spin_lock_bh(&bat_priv->hna_lhash_lock);
hna_ptr = hna_buff + (hna_buff_count * ETH_ALEN);
spin_lock_bh(&bat_priv->hna_lhash_lock);
hna_ptr = hna_buff + (hna_buff_count * ETH_ALEN);
hna_local_entry = (struct hna_local_entry *)
hash_find(bat_priv->hna_local_hash, compare_orig,
choose_orig, hna_ptr);
hna_local_entry = (struct hna_local_entry *)
hash_find(bat_priv->hna_local_hash, compare_orig,
choose_orig, hna_ptr);
if (hna_local_entry)
hna_local_del(bat_priv, hna_local_entry,
if (hna_local_entry)
hna_local_del(bat_priv, hna_local_entry,
while ((hna_buff_count + 1) * ETH_ALEN <= orig_node->hna_buff_len) {
hna_ptr = orig_node->hna_buff + (hna_buff_count * ETH_ALEN);
while ((hna_buff_count + 1) * ETH_ALEN <= orig_node->hna_buff_len) {
hna_ptr = orig_node->hna_buff + (hna_buff_count * ETH_ALEN);
hna_global_entry = (struct hna_global_entry *)
hash_find(bat_priv->hna_global_hash, compare_orig,
choose_orig, hna_ptr);
hna_global_entry = (struct hna_global_entry *)
hash_find(bat_priv->hna_global_hash, compare_orig,
choose_orig, hna_ptr);
if ((hna_global_entry) &&
(hna_global_entry->orig_node == orig_node))
if ((hna_global_entry) &&
(hna_global_entry->orig_node == orig_node))
struct hna_global_entry *hna_global_entry;
spin_lock_bh(&bat_priv->hna_ghash_lock);
struct hna_global_entry *hna_global_entry;
spin_lock_bh(&bat_priv->hna_ghash_lock);
hna_global_entry = (struct hna_global_entry *)
hash_find(bat_priv->hna_global_hash,
compare_orig, choose_orig, addr);
hna_global_entry = (struct hna_global_entry *)
hash_find(bat_priv->hna_global_hash,
compare_orig, choose_orig, addr);
spin_unlock_bh(&bat_priv->hna_ghash_lock);
if (!hna_global_entry)
spin_unlock_bh(&bat_priv->hna_ghash_lock);
if (!hna_global_entry)
*new_skb = NULL;
spin_lock_bh(&bat_priv->orig_hash_lock);
*new_skb = NULL;
spin_lock_bh(&bat_priv->orig_hash_lock);
orig_node = ((struct orig_node *)
hash_find(bat_priv->orig_hash, compare_orig, choose_orig,
unicast_packet->orig));
orig_node = ((struct orig_node *)
hash_find(bat_priv->orig_hash, compare_orig, choose_orig,
unicast_packet->orig));
if (!orig_node) {
pr_debug("couldn't find originator in orig_hash\n");
if (!orig_node) {
pr_debug("couldn't find originator in orig_hash\n");
sizeof(struct vis_packet));
memcpy(search_packet->vis_orig, vis_packet->vis_orig, ETH_ALEN);
sizeof(struct vis_packet));
memcpy(search_packet->vis_orig, vis_packet->vis_orig, ETH_ALEN);
old_info = hash_find(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
&search_elem);
old_info = hash_find(bat_priv->vis_hash, vis_info_cmp, vis_info_choose,
&search_elem);
kfree_skb(search_elem.skb_packet);
if (old_info) {
kfree_skb(search_elem.skb_packet);
if (old_info) {
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
- hlist_for_each_entry(bucket, walk, head, hlist) {
+ rcu_read_lock();
+ hlist_for_each_entry_rcu(bucket, walk, head, hlist) {
orig_node = bucket->data;
if ((orig_node) && (orig_node->router) &&
(orig_node->flags & VIS_SERVER) &&
orig_node = bucket->data;
if ((orig_node) && (orig_node->router) &&
(orig_node->flags & VIS_SERVER) &&
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
- hlist_for_each_entry(bucket, walk, head, hlist) {
+ rcu_read_lock();
+ hlist_for_each_entry_rcu(bucket, walk, head, hlist) {
orig_node = bucket->data;
neigh_node = orig_node->router;
orig_node = bucket->data;
neigh_node = orig_node->router;
packet->entries++;
if (vis_packet_full(info)) {
packet->entries++;
if (vis_packet_full(info)) {
spin_unlock_bh(&bat_priv->orig_hash_lock);
return 0;
}
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
return 0;
}
}
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
- hlist_for_each_entry(bucket, walk, head, hlist) {
+ rcu_read_lock();
+ hlist_for_each_entry_rcu(bucket, walk, head, hlist) {
orig_node = bucket->data;
/* if it's a vis server and reachable, send it. */
orig_node = bucket->data;
/* if it's a vis server and reachable, send it. */
spin_lock_bh(&bat_priv->orig_hash_lock);
}
spin_lock_bh(&bat_priv->orig_hash_lock);
}
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
}
spin_unlock_bh(&bat_priv->orig_hash_lock);
spin_lock_bh(&bat_priv->orig_hash_lock);
packet = (struct vis_packet *)info->skb_packet->data;
spin_lock_bh(&bat_priv->orig_hash_lock);
packet = (struct vis_packet *)info->skb_packet->data;
orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
compare_orig, choose_orig,
packet->target_orig));
orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
compare_orig, choose_orig,
packet->target_orig));
if ((!orig_node) || (!orig_node->router))
goto out;
if ((!orig_node) || (!orig_node->router))
goto out;