8

For instance, if I run ethtool -g eth0 on my system, I get the following output:

Ring parameters for eth0:
Pre-set maximums:
RX:             4096
RX Mini:        0
RX Jumbo:       0
TX:             4096
Current hardware settings:
RX:             4096
RX Mini:        0
RX Jumbo:       0
TX:             4096

Is 4096 the buffer size in bytes allocated for one frame, there being multiple number of such buffers or is it the number of buffers?

tejus
  • 164
  • 1
  • 1
  • 10
  • Related question on stackoverflow: [What is the relationship between RX/TX ring and sk_buff?](https://stackoverflow.com/q/46781857/427158) – maxschlepzig Jul 05 '20 at 18:07

2 Answers2

6

Tx/Rx buffers are memory spaces allocated by a network adapter to handle traffic bursts. Buffering takes place when the traffic exceeds physical capacity of network adapter. Increasing the buffer size would help to avoid packet loss when adapter is overloaded.

Strepsils
  • 4,817
  • 9
  • 14
  • 4
    This is understood but is the value that is increased (`ethtool -G`) the buffer size (what is its unit?) or is it the count of the number of buffers of fixed but unspecified size? – tejus Oct 26 '16 at 06:06
  • 4
    As far as I know, this value shows number of ethernet frames, that can be stored in network adapter, so in your case it can store 4096 frames of different sizes (up to MTU) before it starts dropping frames. – Strepsils Oct 26 '16 at 08:47
1

I found this article which helps to illustrate the function that the ring buffer aka. (driver queue) serves, which may help in understanding its purpose/function. The article is titled, Queueing in the Linux Network Stack.

This section is the one that's of interest:

Driver Queue (aka Ring Buffer)

Between the IP stack and the network interface controller (NIC) lies the driver queue. This queue typically is implemented as a first-in, first-out (FIFO) ring buffer (http://en.wikipedia.org/wiki/Circular_buffer)—just think of it as a fixed-sized buffer. The driver queue does not contain the packet data. Instead, it consists of descriptors that point to other data structures called socket kernel buffers (SKBs, http://vger.kernel.org/%7Edavem/skb.html), which hold the packet data and are used throughout the kernel.

This diagram shows where the ring buffer fits in architecturally:

                    ss1

According to this article, the size of the ring buffer controls the number of SKBs (socket kernel buffers) descriptors. You can read more about SKBs at the links provided, they show the C data structures which make up an SKB.

Looking through that documentation, it does not appear that the ring buffer is simply frame buffers related, but rather pointers to a much more complex kernel data structure related to the packet.

slm
  • 7,355
  • 16
  • 54
  • 72
  • According to [this stackoverflow answer](https://stackoverflow.com/a/46782292/427158), a packet might be represented by multiple SKBs but one SKB represents not more than one packet. – maxschlepzig Jul 05 '20 at 18:10