Q: about ring buffer

Hello,

what is the ‘ring buffer’:
ethtool -g eth0

Is it set by the driver e1000e or by the kernel?
r8169 does not offer these setting, butt r8169 has fifo-buffers.

Best regards.

Here is an explanation
http://www.linuxjournal.com/content/queueing-linux-network-stack

TSU

On 07/12/2014 11:26 AM, AchimKl wrote:
>
> Hello,
>
> what is the ‘ring buffer’:
> ethtool -g eth0
>
> Is it set by the driver e1000e or by the kernel?
> r8169 does not offer these setting, butt r8169 has fifo-buffers.

A ring buffer is also known as a circular buffer. See
http://en.wikipedia.org/wiki/Circular_buffer.

FIFO means first in first out. See http://en.wikipedia.org/wiki/FIFO.

The choice of buffer type was made by the persons that wrote the drivers, but it
is influenced by the design of the hardware. Thus both the hardware and the
kernel are involved.

Both types of buffers handle the case of extracting the oldest information
first. The main difference is that a circular buffer can only contain as many
entries as were created when the buffer was established. FIFOs are usually
implemented using linked lists, and more entries can be added at any time as
long as the necessary memory is available.

An example of using a ring buffer can be found in Zoneminder.

A camera is monitored continuously, although video frames may not be viewed or saved.
But, each and every frame is analyzed for pixel changes (movement).
When movement is detected, then an event is triggered.
At the moment of a triggered event, a specified number of video frames in the ring buffer <before> the event are written to disk (saved) as part of the saved video.

The result is that later when you view the video associated by the event, your video doesn’t start exactly a the moment of the triggering event… it might be too late at that point to capture the full event. Your video instead actually starts a few specified seconds <before> the event so that you can be sure to see the entire scene even just before the movement was detected.

As Larry describes, the ring buffer is FIFO, as new frames are fed into the buffer, oldes frames are simultaneously discarded.

For more on how Zoneminder uses this ring buffer
http://www.zoneminder.com/wiki/index.php/Main_Documentation#Buffers_Tab