From: me@tobin.cc (Tobin C. Harding)
To: kernelnewbies@lists.kernelnewbies.org
Subject: network driver tx/rx path buffers
Date: Wed, 14 Jun 2017 09:57:41 +1000 [thread overview]
Message-ID: <20170613235741.GA31487@eros> (raw)
Hi,
I am implementing the rx/tx paths for a network driver.
My current understanding is;
On the tx path the driver processes the sk_buff, producing a
frame, and writes this to the tx buffer.
At interrupt time (given that the device produces interrupts for rx
data received and tx data transmitted) the driver either fills the rx
buffer with the received frame read from the device or empties the tx
buffer and writes the frame to the device.
Once rx data has been written to the buffer the driver should empty the rx
buffer, process the frame and pass it upstairs.
Questions
---------
1. Is it ok to process the rx frame in a tasklet or should the tasklet
schedule a work thread to do it so that we are not in software
interrupt context for the entire processing of the frame?
2. Can you us kfifo.h for varying size discreet chunks of data? The
macros in kfifo.h are quite complex for a kernelnewbie, but it seems
that kfifo is better suited to storing fixed size items (i.e stucts)?
3. If the above buffer handling is correct then the data being written
to the rx and tx buffers is of varying size. Is circ_buf.h combined with
buffer in the device data structure a better option?
For reference, paraphrasing LDD3:
For interrupt driven I/O the input buffer should be filled at
interrupt time and emptied by processes that read the device; the
output buffer should be filled by processes that write to the device
and emptied at interrupt time.
thanks,
Tobin.
reply other threads:[~2017-06-13 23:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20170613235741.GA31487@eros \
--to=me@tobin.cc \
--cc=kernelnewbies@lists.kernelnewbies.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).