]> www.infradead.org Git - nvme.git/commit
mlxsw: pci: Store number of scatter/gather entries for maximum packet size
authorAmit Cohen <amcohen@nvidia.com>
Tue, 25 Jun 2024 13:47:34 +0000 (15:47 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 26 Jun 2024 14:43:57 +0000 (07:43 -0700)
commit8f8cea8f3ddbd8f64d4f08c2d8525989c4fb44d4
tree2fb3d77bdb30f2a5adc711b5bb081a0f21839c79
parenta6a6a98094116b60e5523a571d9443c53325f5b1
mlxsw: pci: Store number of scatter/gather entries for maximum packet size

A previous patch-set used page pool for Rx buffers allocations. To
simplify the change, we first used page pool for one allocation per
packet - one continuous buffer is allocated for each packet. This can be
improved by using fragmented buffers, then memory consumption will be
significantly reduced.

WQE (Work Queue Element) includes up to 3 scatter/gather entries for
data. As preparation for fragmented buffer usage, calculate number of
scatter/gather entries which are required for packet according to
maximum MTU and store it for future use. For now use PAGE_SIZE for each
entry, which means that maximum buffer size is 3 * PAGE_SIZE. This is
enough for the maximum MTU which is supported in the driver now (10K).
Warn in an unlikely case of maximum MTU which requires more than 3 pages,
for now this warn should not happen with standard page size (>=4K) and
maximum MTU (10K).

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Link: https://patch.msgid.link/98c3e3adb7e727e571ac538faf67cef262cec4fc.1719321422.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/pci.c