diff mbox series

[RFC,1/1] vmxnet3: Adjust maximum Rx ring buffer size

Message ID 20250105213036.288356-2-atomlin@atomlin.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series vmxnet3: Adjust maximum Rx ring buffer size | expand

Checks

Context Check Description
netdev/series_format warning Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 4 this patch: 4
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Aaron Tomlin Jan. 5, 2025, 9:30 p.m. UTC
In the context of vmxnet3_rq_create(), the Rx Data ring's size is
calculated by multiplying the size of Ring 0 by the size of the Rx ring
buffer. See __dma_direct_alloc_pages(). Now if CMA (Contiguous Memory
Allocator) is not available or the allocation attempt failed, the zone
buddy allocator is used to try to allocate physically contiguous memory.

The problem is, when the maximum supported Ring 0 and Rx ring buffer size
is selected, the page-order required to accommodate the new size of the
Rx Data ring is greater than the default MAX_PAGE_ORDER (10)
i.e. __get_order(4096 * 2048) == 11. Consequently, this request can
trigger the following warning condition in __alloc_pages_noprof():

	if (WARN_ON_ONCE_GFP(order > MAX_PAGE_ORDER, gfp))
		return NULL;

This patch ensures that the maximum Rx ring buffer size is reduced under
a Linux kernel without CMA (Contiguous Memory Allocator) support.
There is no point attempting a large memory allocation request that
could exceed the maximum page-order supported by the system.

Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
---
 drivers/net/vmxnet3/vmxnet3_defs.h | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/vmxnet3/vmxnet3_defs.h b/drivers/net/vmxnet3/vmxnet3_defs.h
index 5c5148768039..cc71e697a5f3 100644
--- a/drivers/net/vmxnet3/vmxnet3_defs.h
+++ b/drivers/net/vmxnet3/vmxnet3_defs.h
@@ -466,7 +466,11 @@  union Vmxnet3_GenericDesc {
 #define VMXNET3_TXDATA_DESC_MIN_SIZE 128
 #define VMXNET3_TXDATA_DESC_MAX_SIZE 2048
 
+#if defined(CONFIG_DMA_CMA)
 #define VMXNET3_RXDATA_DESC_MAX_SIZE 2048
+#else
+#define VMXNET3_RXDATA_DESC_MAX_SIZE 1024
+#endif
 
 #define VMXNET3_TXTS_DESC_MAX_SIZE   256
 #define VMXNET3_RXTS_DESC_MAX_SIZE   256