IB/core: Implement a limit on UMAD receive List
authorMichael Guralnik <michaelgur@nvidia.com>
Tue, 16 Apr 2024 12:01:44 +0000 (15:01 +0300)
committerLeon Romanovsky <leon@kernel.org>
Sun, 21 Apr 2024 11:00:35 +0000 (14:00 +0300)
commitca0b44e20a6f3032224599f02e7c8fb49525c894
treec6daac74c2cf5f9bed96fc5a1f78a3b7aa02b59a
parent349e859952285ab9689779fb46de163f13f18f43
IB/core: Implement a limit on UMAD receive List

The existing behavior of ib_umad, which maintains received MAD
packets in an unbounded list, poses a risk of uncontrolled growth.
As user-space applications extract packets from this list, the rate
of extraction may not match the rate of incoming packets, leading
to potential list overflow.

To address this, we introduce a limit to the size of the list. After
considering typical scenarios, such as OpenSM processing, which can
handle approximately 100k packets per second, and the 1-second retry
timeout for most packets, we set the list size limit to 200k. Packets
received beyond this limit are dropped, assuming they are likely timed
out by the time they are handled by user-space.

Notably, packets queued on the receive list due to reasons like
timed-out sends are preserved even when the list is full.

Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
Reviewed-by: Mark Zhang <markzhang@nvidia.com>
Link: https://lore.kernel.org/r/7197cb58a7d9e78399008f25036205ceab07fbd5.1713268818.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/core/user_mad.c