aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2010-04-30 22:41:10 -0400
committerVlad Yasevich <vladislav.yasevich@hp.com>2010-04-30 22:41:10 -0400
commit0e3aef8d09a8c11e3fb83cdcb24b5bc7421b3726 (patch)
tree62e19d24380a9a8308d0ef3f2186742944971a5c
parentbfa0d9843ac5feb9667990706b4524390fee4df9 (diff)
sctp: Tag messages that can be Nagle delayed at creation.
When we create the sctp_datamsg and fragment the user data, we know exactly if we are sending full segments or not and how they might be bundled. During this time, we can mark messages a Nagle capable or not. This makes the check at transmit time much simpler. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
-rw-r--r--include/net/sctp/structs.h8
-rw-r--r--net/sctp/chunk.c4
-rw-r--r--net/sctp/output.c2
3 files changed, 6 insertions, 8 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index d463296d9f79..9d44aef365da 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -643,17 +643,15 @@ struct sctp_pf {
643struct sctp_datamsg { 643struct sctp_datamsg {
644 /* Chunks waiting to be submitted to lower layer. */ 644 /* Chunks waiting to be submitted to lower layer. */
645 struct list_head chunks; 645 struct list_head chunks;
646 /* Chunks that have been transmitted. */
647 size_t msg_size;
648 /* Reference counting. */ 646 /* Reference counting. */
649 atomic_t refcnt; 647 atomic_t refcnt;
650 /* When is this message no longer interesting to the peer? */ 648 /* When is this message no longer interesting to the peer? */
651 unsigned long expires_at; 649 unsigned long expires_at;
652 /* Did the messenge fail to send? */ 650 /* Did the messenge fail to send? */
653 int send_error; 651 int send_error;
654 char send_failed; 652 u8 send_failed:1,
655 /* Control whether chunks from this message can be abandoned. */ 653 can_abandon:1, /* can chunks from this message can be abandoned. */
656 char can_abandon; 654 can_delay; /* should this message be Nagle delayed */
657}; 655};
658 656
659struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, 657struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c
index 3eab6db59a37..476caaf100ed 100644
--- a/net/sctp/chunk.c
+++ b/net/sctp/chunk.c
@@ -58,9 +58,9 @@ static void sctp_datamsg_init(struct sctp_datamsg *msg)
58 msg->send_failed = 0; 58 msg->send_failed = 0;
59 msg->send_error = 0; 59 msg->send_error = 0;
60 msg->can_abandon = 0; 60 msg->can_abandon = 0;
61 msg->can_delay = 1;
61 msg->expires_at = 0; 62 msg->expires_at = 0;
62 INIT_LIST_HEAD(&msg->chunks); 63 INIT_LIST_HEAD(&msg->chunks);
63 msg->msg_size = 0;
64} 64}
65 65
66/* Allocate and initialize datamsg. */ 66/* Allocate and initialize datamsg. */
@@ -157,7 +157,6 @@ static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chu
157{ 157{
158 sctp_datamsg_hold(msg); 158 sctp_datamsg_hold(msg);
159 chunk->msg = msg; 159 chunk->msg = msg;
160 msg->msg_size += chunk->skb->len;
161} 160}
162 161
163 162
@@ -247,6 +246,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
247 if (msg_len >= first_len) { 246 if (msg_len >= first_len) {
248 msg_len -= first_len; 247 msg_len -= first_len;
249 whole = 1; 248 whole = 1;
249 msg->can_delay = 0;
250 } 250 }
251 251
252 /* How many full sized? How many bytes leftover? */ 252 /* How many full sized? How many bytes leftover? */
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 35e49b9df4e0..a646681f5acd 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -674,7 +674,7 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
674 * Don't delay large message writes that may have been 674 * Don't delay large message writes that may have been
675 * fragmeneted into small peices. 675 * fragmeneted into small peices.
676 */ 676 */
677 if ((len < max) && (chunk->msg->msg_size < max)) { 677 if ((len < max) && chunk->msg->can_delay) {
678 retval = SCTP_XMIT_NAGLE_DELAY; 678 retval = SCTP_XMIT_NAGLE_DELAY;
679 goto finish; 679 goto finish;
680 } 680 }