All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next 0/3] net: sctp:  Add partial MSG_MORE support to SCTP
@ 2014-07-09  8:29 ` David Laight
  0 siblings, 0 replies; 5+ messages in thread
From: David Laight @ 2014-07-09  8:29 UTC (permalink / raw)
  To: 'netdev@vger.kernel.org', 'linux-sctp@vger.kernel.org'
  Cc: 'davem@davemloft.net'

If an application has disabled Nagle then it is almost impossible
to get more than one DATA chunk into an ethernet packet even if
the application has more than one data chunk ready to transmit.

This could be fixed by adding an SCTP_CORK socket option - but
using that requires a lot of system calls.
An alternative is to honour MSG_MORE - using it to mean that
another chunk will be sent soon.
(There isn't much point using MSG_MORE to allow a chunk be extended,
sendv() can be used for fragmented data.)

This is a partial implementation and takes a couple of shortcuts:
1) We only worry about whether MSG_MORE was set on the last send.
   Data sent (by the application) with MSG_MORE unset will only be
   unsent for flow control reasons.
   So if the last send had MSG_MORE set, and an ack opens the window
   then the unsent data won't be sent immediately.

2) If the application doesn't do a send with MSG_MORE unset, then
   buffered data shouldn't be buffered forever.
   Rather than using a timer (as TCP does - which ought to be configurable
   on a per-socket basis) we use the same rules as Nagle and ensure
   that there is always some data outstanding.
   This does mean that the first data chunk on an idle connection
   is send in its own packet even if MSG_MORE is set.

Because of the way Nagle is implemented in SCTP, the change is effectively
just enabling and disabling Nagle prior to each send.

The patch is split into 3 parts:
Parts 1 and 2 do not affect the logic.
1) Splits out the 6-clause condition (all of which must be true)
   for Nagle to delay sends into 6 if statements.
   This allows each condition to have its own comment.
2) Renames an internal return value.
3) Renames the 'nodelay' field to 'tx_delay' and defines separate bits for 'Nagle'
   and MSG_MORE (an extra bit could be used for SCTP_CORKED).
   So 'tx_delay' contains the 'reason(s) why a transmit should be delayed'.
   Save the MSG_MORE bit from the last send in 'tx_delay', apply the same
   delay rules as if Nagle were enabled.

Changes for v2:
Parts 1 and 2 added, constants replaced by defines.

	David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 net-next 0/3] net: sctp:  Add partial MSG_MORE support to SCTP
@ 2014-07-09  8:29 ` David Laight
  0 siblings, 0 replies; 5+ messages in thread
From: David Laight @ 2014-07-09  8:29 UTC (permalink / raw)
  To: 'netdev@vger.kernel.org', 'linux-sctp@vger.kernel.org'
  Cc: 'davem@davemloft.net'

If an application has disabled Nagle then it is almost impossible
to get more than one DATA chunk into an ethernet packet even if
the application has more than one data chunk ready to transmit.

This could be fixed by adding an SCTP_CORK socket option - but
using that requires a lot of system calls.
An alternative is to honour MSG_MORE - using it to mean that
another chunk will be sent soon.
(There isn't much point using MSG_MORE to allow a chunk be extended,
sendv() can be used for fragmented data.)

This is a partial implementation and takes a couple of shortcuts:
1) We only worry about whether MSG_MORE was set on the last send.
   Data sent (by the application) with MSG_MORE unset will only be
   unsent for flow control reasons.
   So if the last send had MSG_MORE set, and an ack opens the window
   then the unsent data won't be sent immediately.

2) If the application doesn't do a send with MSG_MORE unset, then
   buffered data shouldn't be buffered forever.
   Rather than using a timer (as TCP does - which ought to be configurable
   on a per-socket basis) we use the same rules as Nagle and ensure
   that there is always some data outstanding.
   This does mean that the first data chunk on an idle connection
   is send in its own packet even if MSG_MORE is set.

Because of the way Nagle is implemented in SCTP, the change is effectively
just enabling and disabling Nagle prior to each send.

The patch is split into 3 parts:
Parts 1 and 2 do not affect the logic.
1) Splits out the 6-clause condition (all of which must be true)
   for Nagle to delay sends into 6 if statements.
   This allows each condition to have its own comment.
2) Renames an internal return value.
3) Renames the 'nodelay' field to 'tx_delay' and defines separate bits for 'Nagle'
   and MSG_MORE (an extra bit could be used for SCTP_CORKED).
   So 'tx_delay' contains the 'reason(s) why a transmit should be delayed'.
   Save the MSG_MORE bit from the last send in 'tx_delay', apply the same
   delay rules as if Nagle were enabled.

Changes for v2:
Parts 1 and 2 added, constants replaced by defines.

	David




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 net-next 0/3] net: sctp: Add partial MSG_MORE support to SCTP
  2014-07-09  8:29 ` David Laight
@ 2014-07-10 23:14   ` David Miller
  -1 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-07-10 23:14 UTC (permalink / raw)
  To: David.Laight; +Cc: netdev, linux-sctp, vyasevich, nhorman

From: David Laight <David.Laight@ACULAB.COM>
Date: Wed, 9 Jul 2014 08:29:11 +0000

> If an application has disabled Nagle then it is almost impossible
> to get more than one DATA chunk into an ethernet packet even if
> the application has more than one data chunk ready to transmit.
> 
> This could be fixed by adding an SCTP_CORK socket option - but
> using that requires a lot of system calls.
> An alternative is to honour MSG_MORE - using it to mean that
> another chunk will be sent soon.
> (There isn't much point using MSG_MORE to allow a chunk be extended,
> sendv() can be used for fragmented data.)
> 
> This is a partial implementation and takes a couple of shortcuts:
> 1) We only worry about whether MSG_MORE was set on the last send.
>    Data sent (by the application) with MSG_MORE unset will only be
>    unsent for flow control reasons.
>    So if the last send had MSG_MORE set, and an ack opens the window
>    then the unsent data won't be sent immediately.
> 
> 2) If the application doesn't do a send with MSG_MORE unset, then
>    buffered data shouldn't be buffered forever.
>    Rather than using a timer (as TCP does - which ought to be configurable
>    on a per-socket basis) we use the same rules as Nagle and ensure
>    that there is always some data outstanding.
>    This does mean that the first data chunk on an idle connection
>    is send in its own packet even if MSG_MORE is set.

I need some SCTP experts to review this series, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 net-next 0/3] net: sctp: Add partial MSG_MORE support to SCTP
@ 2014-07-10 23:14   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-07-10 23:14 UTC (permalink / raw)
  To: David.Laight; +Cc: netdev, linux-sctp, vyasevich, nhorman

From: David Laight <David.Laight@ACULAB.COM>
Date: Wed, 9 Jul 2014 08:29:11 +0000

> If an application has disabled Nagle then it is almost impossible
> to get more than one DATA chunk into an ethernet packet even if
> the application has more than one data chunk ready to transmit.
> 
> This could be fixed by adding an SCTP_CORK socket option - but
> using that requires a lot of system calls.
> An alternative is to honour MSG_MORE - using it to mean that
> another chunk will be sent soon.
> (There isn't much point using MSG_MORE to allow a chunk be extended,
> sendv() can be used for fragmented data.)
> 
> This is a partial implementation and takes a couple of shortcuts:
> 1) We only worry about whether MSG_MORE was set on the last send.
>    Data sent (by the application) with MSG_MORE unset will only be
>    unsent for flow control reasons.
>    So if the last send had MSG_MORE set, and an ack opens the window
>    then the unsent data won't be sent immediately.
> 
> 2) If the application doesn't do a send with MSG_MORE unset, then
>    buffered data shouldn't be buffered forever.
>    Rather than using a timer (as TCP does - which ought to be configurable
>    on a per-socket basis) we use the same rules as Nagle and ensure
>    that there is always some data outstanding.
>    This does mean that the first data chunk on an idle connection
>    is send in its own packet even if MSG_MORE is set.

I need some SCTP experts to review this series, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2 net-next 0/3] net: sctp: Add partial MSG_MORE support to SCTP
  2014-07-10 23:14   ` David Miller
  (?)
@ 2014-07-11  8:39   ` David Laight
  -1 siblings, 0 replies; 5+ messages in thread
From: David Laight @ 2014-07-11  8:39 UTC (permalink / raw)
  To: 'David Miller'; +Cc: netdev, linux-sctp, vyasevich, nhorman

From: David Miller 
> From: David Laight <David.Laight@ACULAB.COM>
> Date: Wed, 9 Jul 2014 08:29:11 +0000
> 
> > If an application has disabled Nagle then it is almost impossible
> > to get more than one DATA chunk into an ethernet packet even if
> > the application has more than one data chunk ready to transmit.
> >
> > This could be fixed by adding an SCTP_CORK socket option - but
> > using that requires a lot of system calls.
> > An alternative is to honour MSG_MORE - using it to mean that
> > another chunk will be sent soon.
> > (There isn't much point using MSG_MORE to allow a chunk be extended,
> > sendv() can be used for fragmented data.)
> >
> > This is a partial implementation and takes a couple of shortcuts:
> > 1) We only worry about whether MSG_MORE was set on the last send.
> >    Data sent (by the application) with MSG_MORE unset will only be
> >    unsent for flow control reasons.
> >    So if the last send had MSG_MORE set, and an ack opens the window
> >    then the unsent data won't be sent immediately.
> >
> > 2) If the application doesn't do a send with MSG_MORE unset, then
> >    buffered data shouldn't be buffered forever.
> >    Rather than using a timer (as TCP does - which ought to be configurable
> >    on a per-socket basis) we use the same rules as Nagle and ensure
> >    that there is always some data outstanding.
> >    This does mean that the first data chunk on an idle connection
> >    is send in its own packet even if MSG_MORE is set.
> 
> I need some SCTP experts to review this series, thanks.

One thing that makes it easier, is that there is only one conditional
in the entire sctp stack that checks whether Nagle is enabled.

	David

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-11  8:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-09  8:29 [PATCH v2 net-next 0/3] net: sctp: Add partial MSG_MORE support to SCTP David Laight
2014-07-09  8:29 ` David Laight
2014-07-10 23:14 ` David Miller
2014-07-10 23:14   ` David Miller
2014-07-11  8:39   ` David Laight

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.