diff mbox series

[v2,2/2] net/cdc_ncm: Increase NTB max RX/TX values to 64kb

Message ID 20220714120217.18635-2-lukasz.spintzyk@synaptics.com (mailing list archive)
State Superseded
Headers show
Series [v2,1/2] net/cdc_ncm: Enable ZLP for DisplayLink ethernet devices | expand

Commit Message

Łukasz Spintzyk July 14, 2022, 12:02 p.m. UTC
DisplayLink ethernet devices require NTB buffers larger then 32kb
in order to run with highest performance.

This patch is changing upper limit of the rx and tx buffers.
Those buffers are initialized with CDC_NCM_NTB_DEF_SIZE_RX and
CDC_NCM_NTB_DEF_SIZE_TX which is 16kb so by default no device is
affected by increased limit.

Rx and tx buffer is increased under two conditions:
 - Device need to advertise that it supports higher buffer size in
   dwNtbMaxInMaxSize and dwNtbMaxOutMaxSize.
 - cdc_ncm/rx_max and cdc_ncm/tx_max driver parameters must be adjusted
   with udev rule or ethtool.

Summary of testing and performance results:
Tests were performed on following devices:
 - DisplayLink DL-3xxx family device
 - DisplayLink DL-6xxx family device
 - ASUS USB-C2500 2.5G USB3 ethernet adapter
 - Plugable USB3 1G USB3 ethernet adapter
 - EDIMAX EU-4307 USB-C ethernet adapter
 - Dell DBQBCBC064 USB-C ethernet adapter

Performance measurements were done with:
 - iperf3 between two linux boxes
 - http://openspeedtest.com/ instance running on local test machine

Insights from tests results:
 - All except one from third party usb adapters were not affected by
   increased buffer size to their advertised dwNtbOutMaxSize and
   dwNtbInMaxSize.
   Devices were generally reaching 912-940Mbps both download and upload.

   Only EDIMAX adapter experienced decreased download size from
   929Mbps to 827Mbps with iper3, with openspeedtest decrease was from
   968Mbps to 886Mbps.

 - DisplayLink DL-3xxx family devices experienced performance increase
   with iperf3 download from 300Mbps to 870Mbps and
   upload from 782Mbps to 844Mbps.
   With openspeedtest download increased from 556Mbps to 873Mbps
   and upload from 727Mbps to 973Mbps

 - DiplayLink DL-6xxx family devices are not affected by
   increased buffer size.

Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
---

v2:
 - Information how to change tx,rx buffer size
 - Added performance tests results to the commit description.


 include/linux/usb/cdc_ncm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Greg KH July 14, 2022, 12:20 p.m. UTC | #1
On Thu, Jul 14, 2022 at 02:02:17PM +0200, Łukasz Spintzyk wrote:
> DisplayLink ethernet devices require NTB buffers larger then 32kb
> in order to run with highest performance.
> 
> This patch is changing upper limit of the rx and tx buffers.
> Those buffers are initialized with CDC_NCM_NTB_DEF_SIZE_RX and
> CDC_NCM_NTB_DEF_SIZE_TX which is 16kb so by default no device is
> affected by increased limit.
> 
> Rx and tx buffer is increased under two conditions:
>  - Device need to advertise that it supports higher buffer size in
>    dwNtbMaxInMaxSize and dwNtbMaxOutMaxSize.
>  - cdc_ncm/rx_max and cdc_ncm/tx_max driver parameters must be adjusted
>    with udev rule or ethtool.
> 
> Summary of testing and performance results:
> Tests were performed on following devices:
>  - DisplayLink DL-3xxx family device
>  - DisplayLink DL-6xxx family device
>  - ASUS USB-C2500 2.5G USB3 ethernet adapter
>  - Plugable USB3 1G USB3 ethernet adapter
>  - EDIMAX EU-4307 USB-C ethernet adapter
>  - Dell DBQBCBC064 USB-C ethernet adapter
> 
> Performance measurements were done with:
>  - iperf3 between two linux boxes
>  - http://openspeedtest.com/ instance running on local test machine
> 
> Insights from tests results:
>  - All except one from third party usb adapters were not affected by
>    increased buffer size to their advertised dwNtbOutMaxSize and
>    dwNtbInMaxSize.
>    Devices were generally reaching 912-940Mbps both download and upload.
> 
>    Only EDIMAX adapter experienced decreased download size from
>    929Mbps to 827Mbps with iper3, with openspeedtest decrease was from
>    968Mbps to 886Mbps.
> 
>  - DisplayLink DL-3xxx family devices experienced performance increase
>    with iperf3 download from 300Mbps to 870Mbps and
>    upload from 782Mbps to 844Mbps.
>    With openspeedtest download increased from 556Mbps to 873Mbps
>    and upload from 727Mbps to 973Mbps
> 
>  - DiplayLink DL-6xxx family devices are not affected by
>    increased buffer size.
> 
> Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
> ---
> 
> v2:
>  - Information how to change tx,rx buffer size
>  - Added performance tests results to the commit description.
> 
> 
>  include/linux/usb/cdc_ncm.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
> index f7cb3ddce7fb..2d207cb4837d 100644
> --- a/include/linux/usb/cdc_ncm.h
> +++ b/include/linux/usb/cdc_ncm.h
> @@ -53,8 +53,8 @@
>  #define USB_CDC_NCM_NDP32_LENGTH_MIN		0x20
>  
>  /* Maximum NTB length */
> -#define	CDC_NCM_NTB_MAX_SIZE_TX			32768	/* bytes */
> -#define	CDC_NCM_NTB_MAX_SIZE_RX			32768	/* bytes */
> +#define	CDC_NCM_NTB_MAX_SIZE_TX			65536	/* bytes */
> +#define	CDC_NCM_NTB_MAX_SIZE_RX			65536	/* bytes */
>  
>  /* Initial NTB length */
>  #define	CDC_NCM_NTB_DEF_SIZE_TX			16384	/* bytes */
> -- 
> 2.36.1
> 

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Thanks for the additional information in the changelog text.
diff mbox series

Patch

diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index f7cb3ddce7fb..2d207cb4837d 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -53,8 +53,8 @@ 
 #define USB_CDC_NCM_NDP32_LENGTH_MIN		0x20
 
 /* Maximum NTB length */
-#define	CDC_NCM_NTB_MAX_SIZE_TX			32768	/* bytes */
-#define	CDC_NCM_NTB_MAX_SIZE_RX			32768	/* bytes */
+#define	CDC_NCM_NTB_MAX_SIZE_TX			65536	/* bytes */
+#define	CDC_NCM_NTB_MAX_SIZE_RX			65536	/* bytes */
 
 /* Initial NTB length */
 #define	CDC_NCM_NTB_DEF_SIZE_TX			16384	/* bytes */