[Ethernet Flow Control] force kernel to stop packet reception when is overloaded
In order to avoid a packet lost (it's a critical requirement for my system), I would like to profit Ethernet Flow Control (IEEE 802.1Qbb) in my application (high rate, continuous UDP flow which is stored on a hard drive). My problem is kernel which receives data from the driver even when its buffers are overloaded. I'll try to describe my issue.
A NIC has its own internal FIFO. When FIFO's usage reach a certain threshold, a NIC sends PAUSE frame and postpone a data transmission for a certain amount of time. That would be an ideal back pressure solution in my application. However, after NIC, kernel has its own FIFOs which stores sk_buf structs in order to process packets though subsequent layers of OSI model implementations. The problem is, that if readout of a socket in user's application is not fast enough, the packet is dropped by the kernel (I think FIFOs are implemented as circular buffers). At the same time, kernel has emptied NIC's FIFOs so PAUSE frame are not send and the whole system loses packets.
My question is whether it's possible to force kernel to stop receiving packets from the driver, when kernel's resources are busy ? It would overload NIC's FIFO and cause PAUSE frame generation as intended. I am also wondering if it's possible to check, at which level exactly kernel drops packets and what are exact conditions of a drop (time interval, memory overload, ect.) ?