netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aaron Tomlin <atomlin@atomlin.com>
To: ronak.doshi@broadcom.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, atomlin@atomlin.com
Subject: [RFC PATCH 1/1] vmxnet3: Adjust maximum Rx ring buffer size
Date: Sun,  5 Jan 2025 21:30:36 +0000	[thread overview]
Message-ID: <20250105213036.288356-2-atomlin@atomlin.com> (raw)
In-Reply-To: <20250105213036.288356-1-atomlin@atomlin.com>

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 --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
-- 
2.47.1


  reply	other threads:[~2025-01-05 21:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-05 21:30 [RFC PATCH 0/1] vmxnet3: Adjust maximum Rx ring buffer size Aaron Tomlin
2025-01-05 21:30 ` Aaron Tomlin [this message]
2025-01-06 23:47 ` Jakub Kicinski
2025-01-06 23:51   ` Florian Fainelli
2025-01-07  0:57     ` Jakub Kicinski
2025-01-07 22:55       ` Aaron Tomlin
2025-01-07 23:46         ` Jakub Kicinski
     [not found]           ` <CAP1Q3XQ_Fubke4=SYrFkaiJj0RHB99ehdMedMVDTFtRS6R_RCw@mail.gmail.com>
2025-01-08 17:24             ` Ronak Doshi
2025-01-08 21:05           ` Aaron Tomlin
2025-01-15 20:55             ` Aaron Tomlin
2025-01-08 16:53       ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250105213036.288356-2-atomlin@atomlin.com \
    --to=atomlin@atomlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ronak.doshi@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).