Commit f9ba3501 authored by Xin Long's avatar Xin Long Committed by David S. Miller

sctp: change to save MSG_MORE flag into assoc

David Laight noticed the support for MSG_MORE with datamsg->force_delay
didn't really work as we expected, as the first msg with MSG_MORE set
would always block the following chunks' dequeuing.

This Patch is to rewrite it by saving the MSG_MORE flag into assoc as
David Laight suggested.

asoc->force_delay is used to save MSG_MORE flag before a msg is sent.
All chunks in queue would not be sent out if asoc->force_delay is set
by the msg with MSG_MORE flag, until a new msg without MSG_MORE flag
clears asoc->force_delay.

Note that this change would not affect the flush is generated by other
triggers, like asoc->state != ESTABLISHED, queue size > pmtu etc.

v1->v2:
  Not clear asoc->force_delay after sending the msg with MSG_MORE flag.

Fixes: 4ea0c32f ("sctp: add support for MSG_MORE")
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Acked-by: default avatarDavid Laight <david.laight@aculab.com>
Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ffefb6f4
...@@ -499,7 +499,6 @@ struct sctp_datamsg { ...@@ -499,7 +499,6 @@ struct sctp_datamsg {
/* Did the messenge fail to send? */ /* Did the messenge fail to send? */
int send_error; int send_error;
u8 send_failed:1, u8 send_failed:1,
force_delay:1,
can_delay; /* should this message be Nagle delayed */ can_delay; /* should this message be Nagle delayed */
}; };
...@@ -1878,6 +1877,7 @@ struct sctp_association { ...@@ -1878,6 +1877,7 @@ struct sctp_association {
__u8 need_ecne:1, /* Need to send an ECNE Chunk? */ __u8 need_ecne:1, /* Need to send an ECNE Chunk? */
temp:1, /* Is it a temporary association? */ temp:1, /* Is it a temporary association? */
force_delay:1,
prsctp_enable:1, prsctp_enable:1,
reconf_enable:1; reconf_enable:1;
......
...@@ -704,7 +704,7 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet, ...@@ -704,7 +704,7 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
*/ */
if ((sctp_sk(asoc->base.sk)->nodelay || inflight == 0) && if ((sctp_sk(asoc->base.sk)->nodelay || inflight == 0) &&
!chunk->msg->force_delay) !asoc->force_delay)
/* Nothing unacked */ /* Nothing unacked */
return SCTP_XMIT_OK; return SCTP_XMIT_OK;
......
...@@ -1965,7 +1965,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) ...@@ -1965,7 +1965,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
err = PTR_ERR(datamsg); err = PTR_ERR(datamsg);
goto out_free; goto out_free;
} }
datamsg->force_delay = !!(msg->msg_flags & MSG_MORE); asoc->force_delay = !!(msg->msg_flags & MSG_MORE);
/* Now send the (possibly) fragmented message. */ /* Now send the (possibly) fragmented message. */
list_for_each_entry(chunk, &datamsg->chunks, frag_list) { list_for_each_entry(chunk, &datamsg->chunks, frag_list) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment