aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/sm_sideeffect.c
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2009-08-10 13:51:03 -0400
committerVlad Yasevich <vladislav.yasevich@hp.com>2009-09-04 18:20:57 -0400
commit9c5c62be2f794c7cee533d856f9f34c3cf21ff1b (patch)
treee81bcc703cedf4e667b91504b5cf9e8e01ffb6a5 /net/sctp/sm_sideeffect.c
parent5d7ff261ef497c62f54c39effc259910a28b313d (diff)
sctp: Send user messages to the lower layer as one
Currenlty, sctp breaks up user messages into fragments and sends each fragment to the lower layer by itself. This means that for each fragment we go all the way down the stack and back up. This also discourages bundling of multiple fragments when they can fit into a sigle packet (ex: due to user setting a low fragmentation threashold). We introduce a new command SCTP_CMD_SND_MSG and hand the whole message down state machine. The state machine and the side-effect parser will cork the queue, add all chunks from the message to the queue, and then un-cork the queue thus causing the chunks to get transmitted. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Diffstat (limited to 'net/sctp/sm_sideeffect.c')
-rw-r--r--net/sctp/sm_sideeffect.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 86426aac1600..238adf7978e9 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -931,6 +931,27 @@ static void sctp_cmd_t1_timer_update(struct sctp_association *asoc,
931 931
932} 932}
933 933
934/* Send the whole message, chunk by chunk, to the outqueue.
935 * This way the whole message is queued up and bundling if
936 * encouraged for small fragments.
937 */
938static int sctp_cmd_send_msg(struct sctp_association *asoc,
939 struct sctp_datamsg *msg)
940{
941 struct sctp_chunk *chunk;
942 int error = 0;
943
944 list_for_each_entry(chunk, &msg->chunks, frag_list) {
945 error = sctp_outq_tail(&asoc->outqueue, chunk);
946 if (error)
947 break;
948 }
949
950 return error;
951}
952
953
954
934/* These three macros allow us to pull the debugging code out of the 955/* These three macros allow us to pull the debugging code out of the
935 * main flow of sctp_do_sm() to keep attention focused on the real 956 * main flow of sctp_do_sm() to keep attention focused on the real
936 * functionality there. 957 * functionality there.
@@ -1575,7 +1596,13 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1575 case SCTP_CMD_UPDATE_INITTAG: 1596 case SCTP_CMD_UPDATE_INITTAG:
1576 asoc->peer.i.init_tag = cmd->obj.u32; 1597 asoc->peer.i.init_tag = cmd->obj.u32;
1577 break; 1598 break;
1578 1599 case SCTP_CMD_SEND_MSG:
1600 if (!asoc->outqueue.cork) {
1601 sctp_outq_cork(&asoc->outqueue);
1602 local_cork = 1;
1603 }
1604 error = sctp_cmd_send_msg(asoc, cmd->obj.msg);
1605 break;
1579 default: 1606 default:
1580 printk(KERN_WARNING "Impossible command: %u, %p\n", 1607 printk(KERN_WARNING "Impossible command: %u, %p\n",
1581 cmd->verb, cmd->obj.ptr); 1608 cmd->verb, cmd->obj.ptr);