From: Xin Long <lucien.xin@gmail.com>
To: network dev <netdev@vger.kernel.org>, linux-sctp@vger.kernel.org
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
Neil Horman <nhorman@tuxdriver.com>,
Vlad Yasevich <vyasevich@gmail.com>,
davem@davemloft.net, David Laight <david.laight@aculab.com>
Subject: [PATCH net-next 2/2] sctp: add support for MSG_MORE
Date: Sat, 18 Feb 2017 17:52:46 +0000 [thread overview]
Message-ID: <d6f2835b0bd655a563896e86648cbd9b4e01374e.1487440272.git.lucien.xin@gmail.com> (raw)
In-Reply-To: <1830885841c7bdd55510396300092f669896f2b0.1487440272.git.lucien.xin@gmail.com>
This patch is to add support for MSG_MORE on sctp.
It adds force_delay in sctp_datamsg to save MSG_MORE, and sets it after
creating datamsg according to the send flag. sctp_packet_can_append_data
then uses it to decide if the chunks of this msg will be sent at once or
delay it.
Note that unlike [1], this patch saves MSG_MORE in datamsg, instead of
in assoc. As sctp enqueues the chunks first, then dequeue them one by
one. If it's saved in assoc,the current msg's send flag (MSG_MORE) may
affect other chunks' bundling.
Since last patch, sctp flush out queue once assoc state falls into
SHUTDOWN_PENDING, the close block problem mentioned in [1] has been
solved as well.
[1] https://patchwork.ozlabs.org/patch/372404/
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
include/net/sctp/structs.h | 1 +
net/sctp/output.c | 9 +++------
net/sctp/socket.c | 1 +
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 387c802..a244db5 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -497,6 +497,7 @@ struct sctp_datamsg {
/* Did the messenge fail to send? */
int send_error;
u8 send_failed:1,
+ force_delay:1,
can_delay; /* should this message be Nagle delayed */
};
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 814eac0..85406d5 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -704,18 +704,15 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
* unacknowledged.
*/
- if (sctp_sk(asoc->base.sk)->nodelay)
- /* Nagle disabled */
+ if ((sctp_sk(asoc->base.sk)->nodelay || inflight = 0) &&
+ !chunk->msg->force_delay)
+ /* Nothing unacked */
return SCTP_XMIT_OK;
if (!sctp_packet_empty(packet))
/* Append to packet */
return SCTP_XMIT_OK;
- if (inflight = 0)
- /* Nothing unacked */
- return SCTP_XMIT_OK;
-
if (!sctp_state(asoc, ESTABLISHED))
return SCTP_XMIT_OK;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 75f35ce..b532148 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1964,6 +1964,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
err = PTR_ERR(datamsg);
goto out_free;
}
+ datamsg->force_delay = !!(msg->msg_flags & MSG_MORE);
/* Now send the (possibly) fragmented message. */
list_for_each_entry(chunk, &datamsg->chunks, frag_list) {
--
2.1.0
next prev parent reply other threads:[~2017-02-18 17:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-18 17:52 [PATCH net-next 0/2] sctp: support MSG_MORE flag when sending msg Xin Long
2017-02-18 17:52 ` [PATCH net-next 1/2] sctp: flush out queue once assoc state falls into SHUTDOWN_PENDING Xin Long
2017-02-18 17:52 ` Xin Long [this message]
2017-02-21 14:27 ` [PATCH net-next 2/2] sctp: add support for MSG_MORE David Laight
2017-02-23 3:45 ` Xin Long
2017-02-23 16:04 ` David Laight
2017-02-23 17:40 ` Marcelo Ricardo Leitner
2017-02-23 18:16 ` Xin Long
2017-02-23 18:39 ` Marcelo Ricardo Leitner
2017-02-24 6:43 ` Xin Long
2017-02-24 10:14 ` David Laight
2017-02-25 8:41 ` Xin Long
2017-02-27 4:49 ` Xin Long
2017-02-27 10:48 ` David Laight
2017-03-21 22:04 ` Marcelo Ricardo Leitner
2017-03-22 14:07 ` David Laight
2017-03-22 17:33 ` 'Marcelo Ricardo Leitner'
2017-03-23 4:35 ` Xin Long
2017-03-23 16:42 ` Marcelo Ricardo Leitner
2017-03-24 16:09 ` Xin Long
2017-03-24 17:38 ` David Laight
2017-03-28 10:29 ` David Laight
2017-03-28 18:12 ` 'Marcelo Ricardo Leitner'
2017-02-20 15:26 ` [PATCH net-next 0/2] sctp: support MSG_MORE flag when sending msg David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d6f2835b0bd655a563896e86648cbd9b4e01374e.1487440272.git.lucien.xin@gmail.com \
--to=lucien.xin@gmail.com \
--cc=davem@davemloft.net \
--cc=david.laight@aculab.com \
--cc=linux-sctp@vger.kernel.org \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=vyasevich@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).