From: kambo@home.com
To: linux-kernel@vger.kernel.org
Subject: CONFIG_PACKET_MMAP help
Date: Wed, 18 Apr 2001 08:04:35 -0400 [thread overview]
Message-ID: <10336.010418@home.com> (raw)
Hi,
I upgrading an application to the CONFIG_PACKET_MMAP
interface, and was trying to figure out how the api works. I 'RTFS'
But had a few questions:
1. for tp_frame_size, I dont want to truncate any data on ethernet, I
need 1514 bytes, is this the best way to do it and not waste space?
static const int TURBO_FRAME_SIZE=TPACKET_ALIGN(TPACKET_ALIGN(sizeof(tpacket_hdr))+TPACKET_ALIGN(sizeof(struct sockaddr_ll)+ETH_HLEN) + 1500);
2. what is tp_block_nr for? I dont understand it, I just set it to 1
and make tp_block_size big enough for all the frames I need, so its
just one contiguous space, all I need is about a megabyte I think.
3. is this the general approach for the api?
open socket
set ring size
mmap()
h starts at frame[0] of the mmaped area
while(1) {
if (tp->status == 0) poll() for pollin on the socket /* is there a
race here? */
parse/copy out what I want from h + h->tp_mac
set tp->status to 0 when I am done
h = next packet in ring, or wraps
}
4. what does the copy threshold setsockopt tuning accomplish? doesnt it always
have to copy anyway, to the mmaped area?
Thanks,
c.c. me por favor...
K. Lohan
------------------------
kambo at home dawt com
next reply other threads:[~2001-04-19 0:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-18 12:04 kambo [this message]
2001-04-19 4:41 ` CONFIG_PACKET_MMAP help Edgar Toernig
2001-04-20 16:03 ` kuznet
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=10336.010418@home.com \
--to=kambo@home.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 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.