diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2015-03-13 16:08:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-14 14:38:32 -0400 |
commit | 05dcc5aa4dcced4f59f925625cea669e82b75519 (patch) | |
tree | 0a516e1012ee7e9b7eee037d8e31278a425e7d68 /net/tipc/msg.c | |
parent | 2cdf3918e47e98c8f34f7a64455ea9fd433756e7 (diff) |
tipc: split link outqueue
struct tipc_link contains one single queue for outgoing packets,
where both transmitted and waiting packets are queued.
This infrastructure is hard to maintain, because we need
to keep a number of fields to keep track of which packets are
sent or unsent, and the number of packets in each category.
A lot of code becomes simpler if we split this queue into a transmission
queue, where sent/unacknowledged packets are kept, and a backlog queue,
where we keep the not yet sent packets.
In this commit we do this separation.
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/msg.c')
-rw-r--r-- | net/tipc/msg.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 333d2ae1cf76..47c8fd8e2fb2 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c | |||
@@ -330,33 +330,36 @@ error: | |||
330 | 330 | ||
331 | /** | 331 | /** |
332 | * tipc_msg_bundle(): Append contents of a buffer to tail of an existing one | 332 | * tipc_msg_bundle(): Append contents of a buffer to tail of an existing one |
333 | * @list: the buffer chain of the existing buffer ("bundle") | 333 | * @bskb: the buffer to append to ("bundle") |
334 | * @skb: buffer to be appended | 334 | * @skb: buffer to be appended |
335 | * @mtu: max allowable size for the bundle buffer | 335 | * @mtu: max allowable size for the bundle buffer |
336 | * Consumes buffer if successful | 336 | * Consumes buffer if successful |
337 | * Returns true if bundling could be performed, otherwise false | 337 | * Returns true if bundling could be performed, otherwise false |
338 | */ | 338 | */ |
339 | bool tipc_msg_bundle(struct sk_buff_head *list, struct sk_buff *skb, u32 mtu) | 339 | bool tipc_msg_bundle(struct sk_buff *bskb, struct sk_buff *skb, u32 mtu) |
340 | { | 340 | { |
341 | struct sk_buff *bskb = skb_peek_tail(list); | 341 | struct tipc_msg *bmsg; |
342 | struct tipc_msg *bmsg = buf_msg(bskb); | ||
343 | struct tipc_msg *msg = buf_msg(skb); | 342 | struct tipc_msg *msg = buf_msg(skb); |
344 | unsigned int bsz = msg_size(bmsg); | 343 | unsigned int bsz; |
345 | unsigned int msz = msg_size(msg); | 344 | unsigned int msz = msg_size(msg); |
346 | u32 start = align(bsz); | 345 | u32 start, pad; |
347 | u32 max = mtu - INT_H_SIZE; | 346 | u32 max = mtu - INT_H_SIZE; |
348 | u32 pad = start - bsz; | ||
349 | 347 | ||
350 | if (likely(msg_user(msg) == MSG_FRAGMENTER)) | 348 | if (likely(msg_user(msg) == MSG_FRAGMENTER)) |
351 | return false; | 349 | return false; |
350 | if (!bskb) | ||
351 | return false; | ||
352 | bmsg = buf_msg(bskb); | ||
353 | bsz = msg_size(bmsg); | ||
354 | start = align(bsz); | ||
355 | pad = start - bsz; | ||
356 | |||
352 | if (unlikely(msg_user(msg) == CHANGEOVER_PROTOCOL)) | 357 | if (unlikely(msg_user(msg) == CHANGEOVER_PROTOCOL)) |
353 | return false; | 358 | return false; |
354 | if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) | 359 | if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) |
355 | return false; | 360 | return false; |
356 | if (likely(msg_user(bmsg) != MSG_BUNDLER)) | 361 | if (likely(msg_user(bmsg) != MSG_BUNDLER)) |
357 | return false; | 362 | return false; |
358 | if (likely(!TIPC_SKB_CB(bskb)->bundling)) | ||
359 | return false; | ||
360 | if (unlikely(skb_tailroom(bskb) < (pad + msz))) | 363 | if (unlikely(skb_tailroom(bskb) < (pad + msz))) |
361 | return false; | 364 | return false; |
362 | if (unlikely(max < (start + msz))) | 365 | if (unlikely(max < (start + msz))) |
@@ -419,12 +422,11 @@ none: | |||
419 | * Replaces buffer if successful | 422 | * Replaces buffer if successful |
420 | * Returns true if success, otherwise false | 423 | * Returns true if success, otherwise false |
421 | */ | 424 | */ |
422 | bool tipc_msg_make_bundle(struct sk_buff_head *list, | 425 | bool tipc_msg_make_bundle(struct sk_buff **skb, u32 mtu, u32 dnode) |
423 | struct sk_buff *skb, u32 mtu, u32 dnode) | ||
424 | { | 426 | { |
425 | struct sk_buff *bskb; | 427 | struct sk_buff *bskb; |
426 | struct tipc_msg *bmsg; | 428 | struct tipc_msg *bmsg; |
427 | struct tipc_msg *msg = buf_msg(skb); | 429 | struct tipc_msg *msg = buf_msg(*skb); |
428 | u32 msz = msg_size(msg); | 430 | u32 msz = msg_size(msg); |
429 | u32 max = mtu - INT_H_SIZE; | 431 | u32 max = mtu - INT_H_SIZE; |
430 | 432 | ||
@@ -448,9 +450,9 @@ bool tipc_msg_make_bundle(struct sk_buff_head *list, | |||
448 | msg_set_seqno(bmsg, msg_seqno(msg)); | 450 | msg_set_seqno(bmsg, msg_seqno(msg)); |
449 | msg_set_ack(bmsg, msg_ack(msg)); | 451 | msg_set_ack(bmsg, msg_ack(msg)); |
450 | msg_set_bcast_ack(bmsg, msg_bcast_ack(msg)); | 452 | msg_set_bcast_ack(bmsg, msg_bcast_ack(msg)); |
451 | TIPC_SKB_CB(bskb)->bundling = true; | 453 | tipc_msg_bundle(bskb, *skb, mtu); |
452 | __skb_queue_tail(list, bskb); | 454 | *skb = bskb; |
453 | return tipc_msg_bundle(list, skb, mtu); | 455 | return true; |
454 | } | 456 | } |
455 | 457 | ||
456 | /** | 458 | /** |