name_distr.c (0ea8a56de21be24cb79abb03dee79aabcd60a316) name_distr.c (7b50ee3dad2581dc022b4e32e55964d4fcdccf20)
1/*
2 * net/tipc/name_distr.c: TIPC name distribution code
3 *
4 * Copyright (c) 2000-2006, 2014, Ericsson AB
5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 313 unchanged lines hidden (view full) ---

322
323static struct sk_buff *tipc_named_dequeue(struct sk_buff_head *namedq,
324 u16 *rcv_nxt, bool *open)
325{
326 struct sk_buff *skb, *tmp;
327 struct tipc_msg *hdr;
328 u16 seqno;
329
1/*
2 * net/tipc/name_distr.c: TIPC name distribution code
3 *
4 * Copyright (c) 2000-2006, 2014, Ericsson AB
5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 313 unchanged lines hidden (view full) ---

322
323static struct sk_buff *tipc_named_dequeue(struct sk_buff_head *namedq,
324 u16 *rcv_nxt, bool *open)
325{
326 struct sk_buff *skb, *tmp;
327 struct tipc_msg *hdr;
328 u16 seqno;
329
330 spin_lock_bh(&namedq->lock);
330 skb_queue_walk_safe(namedq, skb, tmp) {
331 skb_queue_walk_safe(namedq, skb, tmp) {
331 skb_linearize(skb);
332 if (unlikely(skb_linearize(skb))) {
333 __skb_unlink(skb, namedq);
334 kfree_skb(skb);
335 continue;
336 }
332 hdr = buf_msg(skb);
333 seqno = msg_named_seqno(hdr);
334 if (msg_is_last_bulk(hdr)) {
335 *rcv_nxt = seqno;
336 *open = true;
337 }
338
339 if (msg_is_bulk(hdr) || msg_is_legacy(hdr)) {
340 __skb_unlink(skb, namedq);
337 hdr = buf_msg(skb);
338 seqno = msg_named_seqno(hdr);
339 if (msg_is_last_bulk(hdr)) {
340 *rcv_nxt = seqno;
341 *open = true;
342 }
343
344 if (msg_is_bulk(hdr) || msg_is_legacy(hdr)) {
345 __skb_unlink(skb, namedq);
346 spin_unlock_bh(&namedq->lock);
341 return skb;
342 }
343
344 if (*open && (*rcv_nxt == seqno)) {
345 (*rcv_nxt)++;
346 __skb_unlink(skb, namedq);
347 return skb;
348 }
349
350 if (*open && (*rcv_nxt == seqno)) {
351 (*rcv_nxt)++;
352 __skb_unlink(skb, namedq);
353 spin_unlock_bh(&namedq->lock);
347 return skb;
348 }
349
350 if (less(seqno, *rcv_nxt)) {
351 __skb_unlink(skb, namedq);
352 kfree_skb(skb);
353 continue;
354 }
355 }
354 return skb;
355 }
356
357 if (less(seqno, *rcv_nxt)) {
358 __skb_unlink(skb, namedq);
359 kfree_skb(skb);
360 continue;
361 }
362 }
363 spin_unlock_bh(&namedq->lock);
356 return NULL;
357}
358
359/**
360 * tipc_named_rcv - process name table update messages sent by another node
361 */
362void tipc_named_rcv(struct net *net, struct sk_buff_head *namedq,
363 u16 *rcv_nxt, bool *open)

--- 45 unchanged lines hidden ---
364 return NULL;
365}
366
367/**
368 * tipc_named_rcv - process name table update messages sent by another node
369 */
370void tipc_named_rcv(struct net *net, struct sk_buff_head *namedq,
371 u16 *rcv_nxt, bool *open)

--- 45 unchanged lines hidden ---