kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* network driver tx/rx path buffers
@ 2017-06-13 23:57 Tobin C. Harding
  0 siblings, 0 replies; only message in thread
From: Tobin C. Harding @ 2017-06-13 23:57 UTC (permalink / raw)
  To: kernelnewbies

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-13 23:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-13 23:57 network driver tx/rx path buffers Tobin C. Harding

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).