Commit e3b0d0de authored by Marek Lindner's avatar Marek Lindner Committed by Antonio Quartulli

batman-adv: prepare lq_update_lock to be shared among different protocols

Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
parent 3275e7cc
...@@ -43,7 +43,6 @@ static struct neigh_node *bat_iv_ogm_neigh_new(struct hard_iface *hard_iface, ...@@ -43,7 +43,6 @@ static struct neigh_node *bat_iv_ogm_neigh_new(struct hard_iface *hard_iface,
goto out; goto out;
INIT_LIST_HEAD(&neigh_node->bonding_list); INIT_LIST_HEAD(&neigh_node->bonding_list);
spin_lock_init(&neigh_node->tq_lock);
neigh_node->orig_node = orig_neigh; neigh_node->orig_node = orig_neigh;
neigh_node->if_incoming = hard_iface; neigh_node->if_incoming = hard_iface;
...@@ -637,12 +636,12 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv, ...@@ -637,12 +636,12 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
if (is_duplicate) if (is_duplicate)
continue; continue;
spin_lock_bh(&tmp_neigh_node->tq_lock); spin_lock_bh(&tmp_neigh_node->lq_update_lock);
ring_buffer_set(tmp_neigh_node->tq_recv, ring_buffer_set(tmp_neigh_node->tq_recv,
&tmp_neigh_node->tq_index, 0); &tmp_neigh_node->tq_index, 0);
tmp_neigh_node->tq_avg = tmp_neigh_node->tq_avg =
ring_buffer_avg(tmp_neigh_node->tq_recv); ring_buffer_avg(tmp_neigh_node->tq_recv);
spin_unlock_bh(&tmp_neigh_node->tq_lock); spin_unlock_bh(&tmp_neigh_node->lq_update_lock);
} }
if (!neigh_node) { if (!neigh_node) {
...@@ -668,12 +667,12 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv, ...@@ -668,12 +667,12 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
orig_node->flags = batman_ogm_packet->flags; orig_node->flags = batman_ogm_packet->flags;
neigh_node->last_seen = jiffies; neigh_node->last_seen = jiffies;
spin_lock_bh(&neigh_node->tq_lock); spin_lock_bh(&neigh_node->lq_update_lock);
ring_buffer_set(neigh_node->tq_recv, ring_buffer_set(neigh_node->tq_recv,
&neigh_node->tq_index, &neigh_node->tq_index,
batman_ogm_packet->tq); batman_ogm_packet->tq);
neigh_node->tq_avg = ring_buffer_avg(neigh_node->tq_recv); neigh_node->tq_avg = ring_buffer_avg(neigh_node->tq_recv);
spin_unlock_bh(&neigh_node->tq_lock); spin_unlock_bh(&neigh_node->lq_update_lock);
if (!is_duplicate) { if (!is_duplicate) {
orig_node->last_ttl = batman_ogm_packet->header.ttl; orig_node->last_ttl = batman_ogm_packet->header.ttl;
......
...@@ -99,6 +99,7 @@ struct neigh_node *batadv_neigh_node_new(struct hard_iface *hard_iface, ...@@ -99,6 +99,7 @@ struct neigh_node *batadv_neigh_node_new(struct hard_iface *hard_iface,
INIT_HLIST_NODE(&neigh_node->list); INIT_HLIST_NODE(&neigh_node->list);
memcpy(neigh_node->addr, neigh_addr, ETH_ALEN); memcpy(neigh_node->addr, neigh_addr, ETH_ALEN);
spin_lock_init(&neigh_node->lq_update_lock);
/* extra reference for return */ /* extra reference for return */
atomic_set(&neigh_node->refcount, 2); atomic_set(&neigh_node->refcount, 2);
......
...@@ -137,7 +137,7 @@ struct neigh_node { ...@@ -137,7 +137,7 @@ struct neigh_node {
struct rcu_head rcu; struct rcu_head rcu;
struct orig_node *orig_node; struct orig_node *orig_node;
struct hard_iface *if_incoming; struct hard_iface *if_incoming;
spinlock_t tq_lock; /* protects: tq_recv, tq_index */ spinlock_t lq_update_lock; /* protects: tq_recv, tq_index */
}; };
#ifdef CONFIG_BATMAN_ADV_BLA #ifdef CONFIG_BATMAN_ADV_BLA
......
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