netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Łukasz Spintzyk" <lukasz.spintzyk@synaptics.com>
To: netdev@vger.kernel.org
Cc: oliver@neukum.org, ppd-posix@synaptics.com
Subject: [PATCH 2/2] net/cdc_ncm: Add ntb_max_rx,ntb_max_tx cdc_ncm module parameters
Date: Mon, 13 Jun 2022 10:02:35 +0200	[thread overview]
Message-ID: <20220613080235.15724-3-lukasz.spintzyk@synaptics.com> (raw)
In-Reply-To: <20220613080235.15724-1-lukasz.spintzyk@synaptics.com>

This change allows to optionally adjust maximum RX and TX NTB size
to better match specific device capabilities, leading to
higher achievable Ethernet bandwidth.

Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
---
 drivers/net/usb/cdc_ncm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 4594bf2982ee..1ea1949c6014 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -61,6 +61,12 @@ static bool prefer_mbim;
 #endif
 module_param(prefer_mbim, bool, 0644);
 MODULE_PARM_DESC(prefer_mbim, "Prefer MBIM setting on dual NCM/MBIM functions");
+static unsigned int ntb_max_tx = CDC_NCM_NTB_MAX_SIZE_TX;
+static unsigned int ntb_max_rx = CDC_NCM_NTB_MAX_SIZE_RX;
+module_param(ntb_max_tx, uint, 0644);
+MODULE_PARM_DESC(ntb_max_rx, "Maximum allowed NTB RX size");
+module_param(ntb_max_rx, uint, 0644);
+MODULE_PARM_DESC(ntb_max_tx, "Maximum allowed NTB TX size");
 
 static void cdc_ncm_txpath_bh(struct tasklet_struct *t);
 static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx);
@@ -154,7 +160,7 @@ static u32 cdc_ncm_check_rx_max(struct usbnet *dev, u32 new_rx)
 
 	/* clamp new_rx to sane values */
 	min = USB_CDC_NCM_NTB_MIN_IN_SIZE;
-	max = min_t(u32, CDC_NCM_NTB_MAX_SIZE_RX, le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize));
+	max = min_t(u32, ntb_max_rx, le32_to_cpu(ctx->ncm_parm.dwNtbInMaxSize));
 
 	/* dwNtbInMaxSize spec violation? Use MIN size for both limits */
 	if (max < min) {
@@ -181,7 +187,7 @@ static u32 cdc_ncm_check_tx_max(struct usbnet *dev, u32 new_tx)
 	else
 		min = ctx->max_datagram_size + ctx->max_ndp_size + sizeof(struct usb_cdc_ncm_nth32);
 
-	max = min_t(u32, CDC_NCM_NTB_MAX_SIZE_TX, le32_to_cpu(ctx->ncm_parm.dwNtbOutMaxSize));
+	max = min_t(u32, ntb_max_tx, le32_to_cpu(ctx->ncm_parm.dwNtbOutMaxSize));
 	if (max == 0)
 		max = CDC_NCM_NTB_MAX_SIZE_TX; /* dwNtbOutMaxSize not set */
 
-- 
2.36.1


  parent reply	other threads:[~2022-06-13  8:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13  8:02 [PATCH 0/2] DisplayLink USB-ethernet improvements Łukasz Spintzyk
2022-06-13  8:02 ` [PATCH 1/2] net/cdc_ncm: Enable ZLP for DisplayLink ethernet devices Łukasz Spintzyk
2022-06-13  8:02 ` Łukasz Spintzyk [this message]
2022-06-13 14:54   ` [PATCH 2/2] net/cdc_ncm: Add ntb_max_rx,ntb_max_tx cdc_ncm module parameters Oliver Neukum
2022-06-14  5:47     ` Lukasz Spintzyk
2022-06-14 10:24     ` Lukasz Spintzyk
2022-06-20  7:03       ` Lukasz Spintzyk
2022-06-24  8:56       ` Lukasz Spintzyk

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=20220613080235.15724-3-lukasz.spintzyk@synaptics.com \
    --to=lukasz.spintzyk@synaptics.com \
    --cc=netdev@vger.kernel.org \
    --cc=oliver@neukum.org \
    --cc=ppd-posix@synaptics.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).