public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: RFC:  Multi-packet read/write for packet sockets?
Date: Mon, 14 Jan 2002 09:11:15 -0700	[thread overview]
Message-ID: <3C430323.6060707@candelatech.com> (raw)

I have a performance critical application that reads packets, both
UDP and Ethernet, from the kernel into user space.  When there are
lots of small packets, the program performs relatively poorly....
Recently, while recovering from a really abusive day of snowboarding,
I started thinking about this problem, and I would like to see what
you all think of a potential solution...

Basically, I want a new read method that is something like this:

int mread(int fd, char* buffer, int buffer_size, int* offsets, int offsets_size);

offsets will be an array of integers that the kernel will fill out,
and offsets_size is the length of the array of offsets...

The basic idea is that under heavy load, I expect there to be multiple packets
to be read by the time I get to servicing that file-descriptor.  The mread
call could grab multiple packets at once, packing them into the buffer.
User-space code can delineate packets by looking at the offsets.  Determining
how many packets were read could be done by looking at the return of mread
(the number of bytes read) and the offsets array.  It could also be returned
in another variable if desired....

The kernel knows the max number of packets that can be read based on offsets_size,
as well as buffer limitations due to the size of buffer.

The mread method could be used on UDP and RAW packets at least.  It would
be completely worthless for stream-based sockets like TCP...

Comments welcome...

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear



             reply	other threads:[~2002-01-14 16:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-14 16:11 Ben Greear [this message]
2002-01-14 16:26 ` RFC: Multi-packet read/write for packet sockets? David S. Miller
2002-01-14 16:40   ` Ben Greear
2002-01-14 16:48     ` David S. 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=3C430323.6060707@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=linux-kernel@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