netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brandon Black <blblack@gmail.com>
To: netdev@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>, anton@samba.org
Subject: Re: [PATCH] net: Add sendmmsg socket system call
Date: Fri, 17 Jun 2011 08:15:02 -0500	[thread overview]
Message-ID: <BANLkTimZV2uoKmeHztv=PH9Ycq+mOYdhdg@mail.gmail.com> (raw)

Re: the patch in http://lists.openwall.net/netdev/2011/05/03/12 ,
which is now in the 3.0-rc kernels

I was wondering if would it be possible / valid to add support to
sendmmsg() for skipping packets with a zero msg_iovlen?  The use-case
I'm think of here is a daemon that's basically looping on recvmmsg() +
sendmmsg() to cut overhead.  The simplest userspace approach in this
sort of case is to re-use the same mmsg_hdr and set of iov's for both
recvmmsg() and sendmmsg().

Consider this scenario though: It may, for example, receive 8 packets,
parse them in userspace, decide packet #5 is malformed, and then wish
to respond only to packets 1-4,6-8.  However, in order to drop a
response packet from the set with the current sendmmsg()
implementation, the userspace code would have to shift all of the
mmsg_hdr entries down to close the gaps where no response was desired.
 If sendmmsg() had code to simply skip the underlying sendmsg() on
msg_iovlen = 0, it becomes a lot simpler to handle this case.  sendmsg
with a msg_iovlen of zero currently sends a packet with no data (just
UDP headers in the UDP case) it seems.

The arguments against this would be that some applications may have a
use for sending zero-data-bytes packets via this mechanism today
(although there's the alternate path for this with msg_iovlen = 1 and
a zero length for the actual iov within), and the overhead of adding
another branch in the sendmmsg() code.  I suppose there's a middle
route too, where we add a custom flags for sendmmsg() to turn on this
behavior, and leave the default at today's behavior.

Anyone have any thoughts for/against this idea?  Leaving this alone in
the kernel and doing the shifting in userspace isn't too bad a
solution either, but if nobody has a problem with patching in the
"skip on msg_iovlen == 0" behavior it does make the userspace code
cleaner and simpler.

-- Brandon

             reply	other threads:[~2011-06-17 13:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 13:15 Brandon Black [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-03  6:21 [PATCH] net: Add sendmmsg socket system call Anton Blanchard
2011-05-05 18:06 ` 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='BANLkTimZV2uoKmeHztv=PH9Ycq+mOYdhdg@mail.gmail.com' \
    --to=blblack@gmail.com \
    --cc=acme@redhat.com \
    --cc=anton@samba.org \
    --cc=netdev@vger.kernel.org \
    /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).