* [PATCHv2 net] sctp: change to save MSG_MORE flag into assoc
@ 2017-03-26 16:21 Xin Long
2017-03-27 22:43 ` Marcelo Ricardo Leitner
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Xin Long @ 2017-03-26 16:21 UTC (permalink / raw)
To: network dev, linux-sctp
Cc: davem, Marcelo Ricardo Leitner, Neil Horman, David Laight
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: 4ea0c32f5f42 ("sctp: add support for MSG_MORE")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
include/net/sctp/structs.h | 2 +-
net/sctp/output.c | 2 +-
net/sctp/socket.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 592dece..8caa5ee 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -499,7 +499,6 @@ 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 */
};
@@ -1878,6 +1877,7 @@ struct sctp_association {
__u8 need_ecne:1, /* Need to send an ECNE Chunk? */
temp:1, /* Is it a temporary association? */
+ force_delay:1,
prsctp_enable:1,
reconf_enable:1;
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 1224421..73fd178 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -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) &&
- !chunk->msg->force_delay)
+ !asoc->force_delay)
/* Nothing unacked */
return SCTP_XMIT_OK;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 0f378ea..baa269a 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1965,7 +1965,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);
+ asoc->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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCHv2 net] sctp: change to save MSG_MORE flag into assoc
2017-03-26 16:21 [PATCHv2 net] sctp: change to save MSG_MORE flag into assoc Xin Long
@ 2017-03-27 22:43 ` Marcelo Ricardo Leitner
2017-03-28 4:17 ` Xin Long
2017-03-28 10:12 ` David Laight
2017-03-29 0:56 ` David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2017-03-27 22:43 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, davem, Neil Horman, David Laight
On Mon, Mar 27, 2017 at 12:21:15AM +0800, Xin Long wrote:
> 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: 4ea0c32f5f42 ("sctp: add support for MSG_MORE")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
> include/net/sctp/structs.h | 2 +-
> net/sctp/output.c | 2 +-
> net/sctp/socket.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
> index 592dece..8caa5ee 100644
> --- a/include/net/sctp/structs.h
> +++ b/include/net/sctp/structs.h
> @@ -499,7 +499,6 @@ 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 */
> };
>
> @@ -1878,6 +1877,7 @@ struct sctp_association {
>
> __u8 need_ecne:1, /* Need to send an ECNE Chunk? */
> temp:1, /* Is it a temporary association? */
> + force_delay:1,
> prsctp_enable:1,
> reconf_enable:1;
>
> diff --git a/net/sctp/output.c b/net/sctp/output.c
> index 1224421..73fd178 100644
> --- a/net/sctp/output.c
> +++ b/net/sctp/output.c
> @@ -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) &&
> - !chunk->msg->force_delay)
> + !asoc->force_delay)
How is this going to not block the flush on asoc->state != ESTABLISHED?
AFAICT b7018d0b6300 ("sctp: flush out queue once assoc state falls into
SHUTDOWN_PENDING") need to clear asoc->force_delay too.
Case I have in mind is the same old one:
- app send a msg with MSG_MORE
- close the asoc, without sending the final msg
> /* Nothing unacked */
> return SCTP_XMIT_OK;
>
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 0f378ea..baa269a 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -1965,7 +1965,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);
> + asoc->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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv2 net] sctp: change to save MSG_MORE flag into assoc
2017-03-27 22:43 ` Marcelo Ricardo Leitner
@ 2017-03-28 4:17 ` Xin Long
2017-03-28 18:04 ` Marcelo Ricardo Leitner
0 siblings, 1 reply; 6+ messages in thread
From: Xin Long @ 2017-03-28 4:17 UTC (permalink / raw)
To: Marcelo Ricardo Leitner
Cc: network dev, linux-sctp, davem, Neil Horman, David Laight
On Tue, Mar 28, 2017 at 6:43 AM, Marcelo Ricardo Leitner
<marcelo.leitner@gmail.com> wrote:
> On Mon, Mar 27, 2017 at 12:21:15AM +0800, Xin Long wrote:
>> 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: 4ea0c32f5f42 ("sctp: add support for MSG_MORE")
>> Signed-off-by: Xin Long <lucien.xin@gmail.com>
>> ---
>> include/net/sctp/structs.h | 2 +-
>> net/sctp/output.c | 2 +-
>> net/sctp/socket.c | 2 +-
>> 3 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
>> index 592dece..8caa5ee 100644
>> --- a/include/net/sctp/structs.h
>> +++ b/include/net/sctp/structs.h
>> @@ -499,7 +499,6 @@ 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 */
>> };
>>
>> @@ -1878,6 +1877,7 @@ struct sctp_association {
>>
>> __u8 need_ecne:1, /* Need to send an ECNE Chunk? */
>> temp:1, /* Is it a temporary association? */
>> + force_delay:1,
>> prsctp_enable:1,
>> reconf_enable:1;
>>
>> diff --git a/net/sctp/output.c b/net/sctp/output.c
>> index 1224421..73fd178 100644
>> --- a/net/sctp/output.c
>> +++ b/net/sctp/output.c
>> @@ -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) &&
>> - !chunk->msg->force_delay)
>> + !asoc->force_delay)
>
> How is this going to not block the flush on asoc->state != ESTABLISHED?
> AFAICT b7018d0b6300 ("sctp: flush out queue once assoc state falls into
> SHUTDOWN_PENDING") need to clear asoc->force_delay too.
It won't block the flush on asoc->state != ESTABLISHED,
in sctp_packet_can_append_data [1].
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 (!sctp_state(asoc, ESTABLISHED)) <-----[1]
return SCTP_XMIT_OK;
>
> Case I have in mind is the same old one:
> - app send a msg with MSG_MORE
> - close the asoc, without sending the final msg
>
>> /* Nothing unacked */
>> return SCTP_XMIT_OK;
>>
>> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
>> index 0f378ea..baa269a 100644
>> --- a/net/sctp/socket.c
>> +++ b/net/sctp/socket.c
>> @@ -1965,7 +1965,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);
>> + asoc->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
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCHv2 net] sctp: change to save MSG_MORE flag into assoc
2017-03-26 16:21 [PATCHv2 net] sctp: change to save MSG_MORE flag into assoc Xin Long
2017-03-27 22:43 ` Marcelo Ricardo Leitner
@ 2017-03-28 10:12 ` David Laight
2017-03-29 0:56 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Laight @ 2017-03-28 10:12 UTC (permalink / raw)
To: 'Xin Long', network dev, linux-sctp@vger.kernel.org
Cc: davem@davemloft.net, Marcelo Ricardo Leitner, Neil Horman
> -----Original Message-----
> From: Xin Long [mailto:lucien.xin@gmail.com]
> Sent: 26 March 2017 17:21
> To: network dev; linux-sctp@vger.kernel.org
> Cc: davem@davemloft.net; Marcelo Ricardo Leitner; Neil Horman; David Laight
> Subject: [PATCHv2 net] 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: 4ea0c32f5f42 ("sctp: add support for MSG_MORE")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
Acked-by: David Laight <david.laight@aculab.com>
I'll get around to testing it yet :-)
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv2 net] sctp: change to save MSG_MORE flag into assoc
2017-03-28 4:17 ` Xin Long
@ 2017-03-28 18:04 ` Marcelo Ricardo Leitner
0 siblings, 0 replies; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2017-03-28 18:04 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, davem, Neil Horman, David Laight
On Tue, Mar 28, 2017 at 12:17:00PM +0800, Xin Long wrote:
> On Tue, Mar 28, 2017 at 6:43 AM, Marcelo Ricardo Leitner
> <marcelo.leitner@gmail.com> wrote:
> > On Mon, Mar 27, 2017 at 12:21:15AM +0800, Xin Long wrote:
> >> 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: 4ea0c32f5f42 ("sctp: add support for MSG_MORE")
> >> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> >> ---
> >> include/net/sctp/structs.h | 2 +-
> >> net/sctp/output.c | 2 +-
> >> net/sctp/socket.c | 2 +-
> >> 3 files changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
> >> index 592dece..8caa5ee 100644
> >> --- a/include/net/sctp/structs.h
> >> +++ b/include/net/sctp/structs.h
> >> @@ -499,7 +499,6 @@ 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 */
> >> };
> >>
> >> @@ -1878,6 +1877,7 @@ struct sctp_association {
> >>
> >> __u8 need_ecne:1, /* Need to send an ECNE Chunk? */
> >> temp:1, /* Is it a temporary association? */
> >> + force_delay:1,
> >> prsctp_enable:1,
> >> reconf_enable:1;
> >>
> >> diff --git a/net/sctp/output.c b/net/sctp/output.c
> >> index 1224421..73fd178 100644
> >> --- a/net/sctp/output.c
> >> +++ b/net/sctp/output.c
> >> @@ -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) &&
> >> - !chunk->msg->force_delay)
> >> + !asoc->force_delay)
> >
> > How is this going to not block the flush on asoc->state != ESTABLISHED?
> > AFAICT b7018d0b6300 ("sctp: flush out queue once assoc state falls into
> > SHUTDOWN_PENDING") need to clear asoc->force_delay too.
>
> It won't block the flush on asoc->state != ESTABLISHED,
> in sctp_packet_can_append_data [1].
>
> 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 (!sctp_state(asoc, ESTABLISHED)) <-----[1]
> return SCTP_XMIT_OK;
Ah yes, okay.
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
>
>
>
> >
> > Case I have in mind is the same old one:
> > - app send a msg with MSG_MORE
> > - close the asoc, without sending the final msg
> >
> >> /* Nothing unacked */
> >> return SCTP_XMIT_OK;
> >>
> >> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> >> index 0f378ea..baa269a 100644
> >> --- a/net/sctp/socket.c
> >> +++ b/net/sctp/socket.c
> >> @@ -1965,7 +1965,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);
> >> + asoc->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
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at http://vger.kernel.org/majordomo-info.html
> >>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCHv2 net] sctp: change to save MSG_MORE flag into assoc
2017-03-26 16:21 [PATCHv2 net] sctp: change to save MSG_MORE flag into assoc Xin Long
2017-03-27 22:43 ` Marcelo Ricardo Leitner
2017-03-28 10:12 ` David Laight
@ 2017-03-29 0:56 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-03-29 0:56 UTC (permalink / raw)
To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman, david.laight
From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 27 Mar 2017 00:21:15 +0800
> 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: 4ea0c32f5f42 ("sctp: add support for MSG_MORE")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-03-29 0:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-26 16:21 [PATCHv2 net] sctp: change to save MSG_MORE flag into assoc Xin Long
2017-03-27 22:43 ` Marcelo Ricardo Leitner
2017-03-28 4:17 ` Xin Long
2017-03-28 18:04 ` Marcelo Ricardo Leitner
2017-03-28 10:12 ` David Laight
2017-03-29 0:56 ` David Miller
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).