aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/unicast.c
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2011-01-19 15:01:44 -0500
committerMarek Lindner <lindner_marek@yahoo.de>2011-03-05 06:52:04 -0500
commitd0072609baebaffb522083d367f4f195187f60f8 (patch)
tree44e014264e2a2815d63f09c6ba9283d2866cbf48 /net/batman-adv/unicast.c
parent1605d0d60b66b9461cfcff86f8cfc80964f23430 (diff)
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 2ab819841231..b4114385dc56 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,
179 179
180 *new_skb = NULL; 180 *new_skb = NULL;
181 181
182 spin_lock_bh(&bat_priv->orig_hash_lock);
183 orig_node = orig_hash_find(bat_priv, unicast_packet->orig); 182 orig_node = orig_hash_find(bat_priv, unicast_packet->orig);
184 if (!orig_node) 183 if (!orig_node)
185 goto unlock; 184 goto out;
186 185
187 orig_node->last_frag_packet = jiffies; 186 orig_node->last_frag_packet = jiffies;
188 187
@@ -207,8 +206,6 @@ int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
207 if (*new_skb) 206 if (*new_skb)
208 ret = NET_RX_SUCCESS; 207 ret = NET_RX_SUCCESS;
209 208
210unlock:
211 spin_unlock_bh(&bat_priv->orig_hash_lock);
212out: 209out:
213 if (orig_node) 210 if (orig_node)
214 orig_node_free_ref(orig_node); 211 orig_node_free_ref(orig_node);
@@ -281,14 +278,10 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
281 struct ethhdr *ethhdr = (struct ethhdr *)skb->data; 278 struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
282 struct unicast_packet *unicast_packet; 279 struct unicast_packet *unicast_packet;
283 struct orig_node *orig_node; 280 struct orig_node *orig_node;
284 struct batman_if *batman_if;
285 struct neigh_node *neigh_node; 281 struct neigh_node *neigh_node;
286 int data_len = skb->len; 282 int data_len = skb->len;
287 uint8_t dstaddr[6];
288 int ret = 1; 283 int ret = 1;
289 284
290 spin_lock_bh(&bat_priv->orig_hash_lock);
291
292 /* get routing information */ 285 /* get routing information */
293 if (is_multicast_ether_addr(ethhdr->h_dest)) { 286 if (is_multicast_ether_addr(ethhdr->h_dest)) {
294 orig_node = (struct orig_node *)gw_get_selected(bat_priv); 287 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)
300 orig_node = transtable_search(bat_priv, ethhdr->h_dest); 293 orig_node = transtable_search(bat_priv, ethhdr->h_dest);
301 294
302find_router: 295find_router:
303 /* find_router() increases neigh_nodes refcount if found. */ 296 /**
297 * find_router():
298 * - if orig_node is NULL it returns NULL
299 * - increases neigh_nodes refcount if found.
300 */
304 neigh_node = find_router(bat_priv, orig_node, NULL); 301 neigh_node = find_router(bat_priv, orig_node, NULL);
305 302
306 if (!neigh_node) 303 if (!neigh_node)
307 goto unlock; 304 goto out;
308 305
309 if (neigh_node->if_incoming->if_status != IF_ACTIVE) 306 if (neigh_node->if_incoming->if_status != IF_ACTIVE)
310 goto unlock; 307 goto out;
311 308
312 if (my_skb_head_push(skb, sizeof(struct unicast_packet)) < 0) 309 if (my_skb_head_push(skb, sizeof(struct unicast_packet)) < 0)
313 goto unlock; 310 goto out;
314
315 /* don't lock while sending the packets ... we therefore
316 * copy the required data before sending */
317 batman_if = neigh_node->if_incoming;
318 memcpy(dstaddr, neigh_node->addr, ETH_ALEN);
319 spin_unlock_bh(&bat_priv->orig_hash_lock);
320 311
321 unicast_packet = (struct unicast_packet *)skb->data; 312 unicast_packet = (struct unicast_packet *)skb->data;
322 313
@@ -330,19 +321,18 @@ find_router:
330 321
331 if (atomic_read(&bat_priv->fragmentation) && 322 if (atomic_read(&bat_priv->fragmentation) &&
332 data_len + sizeof(struct unicast_packet) > 323 data_len + sizeof(struct unicast_packet) >
333 batman_if->net_dev->mtu) { 324 neigh_node->if_incoming->net_dev->mtu) {
334 /* send frag skb decreases ttl */ 325 /* send frag skb decreases ttl */
335 unicast_packet->ttl++; 326 unicast_packet->ttl++;
336 ret = frag_send_skb(skb, bat_priv, batman_if, dstaddr); 327 ret = frag_send_skb(skb, bat_priv,
328 neigh_node->if_incoming, neigh_node->addr);
337 goto out; 329 goto out;
338 } 330 }
339 331
340 send_skb_packet(skb, batman_if, dstaddr); 332 send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
341 ret = 0; 333 ret = 0;
342 goto out; 334 goto out;
343 335
344unlock:
345 spin_unlock_bh(&bat_priv->orig_hash_lock);
346out: 336out:
347 if (neigh_node) 337 if (neigh_node)
348 neigh_node_free_ref(neigh_node); 338 neigh_node_free_ref(neigh_node);