Commit d4105267 authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp-MSG_MORE'

Xin Long says:

====================
sctp: support MSG_MORE flag when sending msg

This patch is to add support for MSG_MORE on sctp. Patch 1/2 is an
improvement ahead of patch 2/2 to solve the close block problem
mentioned in https://patchwork.ozlabs.org/patch/372404/.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 93a66e93 4ea0c32f
...@@ -497,6 +497,7 @@ struct sctp_datamsg { ...@@ -497,6 +497,7 @@ 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 */
}; };
......
...@@ -704,18 +704,15 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet, ...@@ -704,18 +704,15 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
* unacknowledged. * unacknowledged.
*/ */
if (sctp_sk(asoc->base.sk)->nodelay) if ((sctp_sk(asoc->base.sk)->nodelay || inflight == 0) &&
/* Nagle disabled */ !chunk->msg->force_delay)
/* Nothing unacked */
return SCTP_XMIT_OK; return SCTP_XMIT_OK;
if (!sctp_packet_empty(packet)) if (!sctp_packet_empty(packet))
/* Append to packet */ /* Append to packet */
return SCTP_XMIT_OK; return SCTP_XMIT_OK;
if (inflight == 0)
/* Nothing unacked */
return SCTP_XMIT_OK;
if (!sctp_state(asoc, ESTABLISHED)) if (!sctp_state(asoc, ESTABLISHED))
return SCTP_XMIT_OK; return SCTP_XMIT_OK;
......
...@@ -872,6 +872,10 @@ static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds, ...@@ -872,6 +872,10 @@ static void sctp_cmd_new_state(sctp_cmd_seq_t *cmds,
if (!sctp_style(sk, UDP)) if (!sctp_style(sk, UDP))
sk->sk_state_change(sk); sk->sk_state_change(sk);
} }
if (sctp_state(asoc, SHUTDOWN_PENDING) &&
!sctp_outq_is_empty(&asoc->outqueue))
sctp_outq_uncork(&asoc->outqueue, GFP_ATOMIC);
} }
/* Helper function to delete an association. */ /* Helper function to delete an association. */
......
...@@ -1964,6 +1964,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) ...@@ -1964,6 +1964,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);
/* 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