|
1 | 1 | /* |
2 | 2 | * net/tipc/bcast.c: TIPC broadcast code |
3 | 3 | * |
4 | | - * Copyright (c) 2004-2006, Ericsson AB |
| 4 | + * Copyright (c) 2004-2006, 2014, Ericsson AB |
5 | 5 | * Copyright (c) 2004, Intel Corporation. |
6 | 6 | * Copyright (c) 2005, 2010-2011, Wind River Systems |
7 | 7 | * All rights reserved. |
|
38 | 38 | #include "core.h" |
39 | 39 | #include "link.h" |
40 | 40 | #include "port.h" |
| 41 | +#include "socket.h" |
| 42 | +#include "msg.h" |
41 | 43 | #include "bcast.h" |
42 | 44 | #include "name_distr.h" |
43 | 45 |
|
@@ -138,6 +140,11 @@ static void tipc_bclink_unlock(void) |
138 | 140 | tipc_link_reset_all(node); |
139 | 141 | } |
140 | 142 |
|
| 143 | +uint tipc_bclink_get_mtu(void) |
| 144 | +{ |
| 145 | + return MAX_PKT_DEFAULT_MCAST; |
| 146 | +} |
| 147 | + |
141 | 148 | void tipc_bclink_set_flags(unsigned int flags) |
142 | 149 | { |
143 | 150 | bclink->flags |= flags; |
@@ -408,6 +415,52 @@ int tipc_bclink_xmit(struct sk_buff *buf) |
408 | 415 | return res; |
409 | 416 | } |
410 | 417 |
|
| 418 | +/* tipc_bclink_xmit2 - broadcast buffer chain to all nodes in cluster |
| 419 | + * and to identified node local sockets |
| 420 | + * @buf: chain of buffers containing message |
| 421 | + * Consumes the buffer chain, except when returning -ELINKCONG |
| 422 | + * Returns 0 if success, otherwise errno: -ELINKCONG,-EHOSTUNREACH,-EMSGSIZE |
| 423 | + */ |
| 424 | +int tipc_bclink_xmit2(struct sk_buff *buf) |
| 425 | +{ |
| 426 | + int rc = 0; |
| 427 | + int bc = 0; |
| 428 | + struct sk_buff *clbuf; |
| 429 | + |
| 430 | + /* Prepare clone of message for local node */ |
| 431 | + clbuf = tipc_msg_reassemble(buf); |
| 432 | + if (unlikely(!clbuf)) { |
| 433 | + kfree_skb_list(buf); |
| 434 | + return -EHOSTUNREACH; |
| 435 | + } |
| 436 | + |
| 437 | + /* Broadcast to all other nodes */ |
| 438 | + if (likely(bclink)) { |
| 439 | + tipc_bclink_lock(); |
| 440 | + if (likely(bclink->bcast_nodes.count)) { |
| 441 | + rc = __tipc_link_xmit(bcl, buf); |
| 442 | + if (likely(!rc)) { |
| 443 | + bclink_set_last_sent(); |
| 444 | + bcl->stats.queue_sz_counts++; |
| 445 | + bcl->stats.accu_queue_sz += bcl->out_queue_size; |
| 446 | + } |
| 447 | + bc = 1; |
| 448 | + } |
| 449 | + tipc_bclink_unlock(); |
| 450 | + } |
| 451 | + |
| 452 | + if (unlikely(!bc)) |
| 453 | + kfree_skb_list(buf); |
| 454 | + |
| 455 | + /* Deliver message clone */ |
| 456 | + if (likely(!rc)) |
| 457 | + tipc_sk_mcast_rcv(clbuf); |
| 458 | + else |
| 459 | + kfree_skb(clbuf); |
| 460 | + |
| 461 | + return rc; |
| 462 | +} |
| 463 | + |
411 | 464 | /** |
412 | 465 | * bclink_accept_pkt - accept an incoming, in-sequence broadcast packet |
413 | 466 | * |
|
0 commit comments