summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/unicast.c
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2011-01-19 20:01:44 +0000
committerMarek Lindner <lindner_marek@yahoo.de>2011-03-05 12:52:04 +0100
commitd0072609baebaffb522083d367f4f195187f60f8 (patch)
tree44e014264e2a2815d63f09c6ba9283d2866cbf48 /net/batman-adv/unicast.c
parent1605d0d60b66b9461cfcff86f8cfc80964f23430 (diff)
downloadop-kernel-dev-d0072609baebaffb522083d367f4f195187f60f8.zip
op-kernel-dev-d0072609baebaffb522083d367f4f195187f60f8.tar.gz
batman-adv: remove orig_hash spinlock
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/unicast.c')
-rw-r--r--net/batman-adv/unicast.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index 2ab8198..b411438 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -179,10 +179,9 @@ int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
*new_skb = NULL;
- spin_lock_bh(&bat_priv->orig_hash_lock);
orig_node = orig_hash_find(bat_priv, unicast_packet->orig);
if (!orig_node)
- goto unlock;
+ goto out;
orig_node->last_frag_packet = jiffies;
@@ -207,8 +206,6 @@ int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
if (*new_skb)
ret = NET_RX_SUCCESS;
-unlock:
- spin_unlock_bh(&bat_priv->orig_hash_lock);
out:
if (orig_node)
orig_node_free_ref(orig_node);
@@ -281,14 +278,10 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
struct unicast_packet *unicast_packet;
struct orig_node *orig_node;
- struct batman_if *batman_if;
struct neigh_node *neigh_node;
int data_len = skb->len;
- uint8_t dstaddr[6];
int ret = 1;
- spin_lock_bh(&bat_priv->orig_hash_lock);
-
/* get routing information */
if (is_multicast_ether_addr(ethhdr->h_dest)) {
orig_node = (struct orig_node *)gw_get_selected(bat_priv);
@@ -300,23 +293,21 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
orig_node = transtable_search(bat_priv, ethhdr->h_dest);
find_router:
- /* find_router() increases neigh_nodes refcount if found. */
+ /**
+ * find_router():
+ * - if orig_node is NULL it returns NULL
+ * - increases neigh_nodes refcount if found.
+ */
neigh_node = find_router(bat_priv, orig_node, NULL);
if (!neigh_node)
- goto unlock;
+ goto out;
if (neigh_node->if_incoming->if_status != IF_ACTIVE)
- goto unlock;
+ goto out;
if (my_skb_head_push(skb, sizeof(struct unicast_packet)) < 0)
- goto unlock;
-
- /* don't lock while sending the packets ... we therefore
- * copy the required data before sending */
- batman_if = neigh_node->if_incoming;
- memcpy(dstaddr, neigh_node->addr, ETH_ALEN);
- spin_unlock_bh(&bat_priv->orig_hash_lock);
+ goto out;
unicast_packet = (struct unicast_packet *)skb->data;
@@ -330,19 +321,18 @@ find_router:
if (atomic_read(&bat_priv->fragmentation) &&
data_len + sizeof(struct unicast_packet) >
- batman_if->net_dev->mtu) {
+ neigh_node->if_incoming->net_dev->mtu) {
/* send frag skb decreases ttl */
unicast_packet->ttl++;
- ret = frag_send_skb(skb, bat_priv, batman_if, dstaddr);
+ ret = frag_send_skb(skb, bat_priv,
+ neigh_node->if_incoming, neigh_node->addr);
goto out;
}
- send_skb_packet(skb, batman_if, dstaddr);
+ send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
ret = 0;
goto out;
-unlock:
- spin_unlock_bh(&bat_priv->orig_hash_lock);
out:
if (neigh_node)
neigh_node_free_ref(neigh_node);
OpenPOWER on IntegriCloud