lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220613080235.15724-3-lukasz.spintzyk@synaptics.com>
Date:   Mon, 13 Jun 2022 10:02:35 +0200
From:   Łukasz Spintzyk <lukasz.spintzyk@...aptics.com>
To:     netdev@...r.kernel.org
Cc:     oliver@...kum.org, ppd-posix@...aptics.com
Subject: [PATCH 2/2] net/cdc_ncm: Add ntb_max_rx,ntb_max_tx cdc_ncm module parameters

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@...aptics.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ