UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
515 Views
Registered: ‎05-16-2013

USB 3.0 Ethernet Gadget Speeds

I am attempting to utilize the USB 3.0 built into an MPSoC to get speeds greater than 1Gbps using the Linux Ethernet Gadget.  I am using the UltraZed EV with Carier Card, and Petalinux 2018.2.  Following this post, I attempted to change my MTU size, but as later posts in the link mention, that is not supported by later kernel updates. I can run the attached bash script and both Windows 10 and Ubuntu detect the device as an Ethernet Gadget.  When I run iperf3 I am receiving speeds of only 220Mbps.  I then attempted the patch below, which was based on the patch described by this confluence page.  This patch causes a kernel panic below:

From 6429b8dbe0d804c6b01a5220e54f31e766a03567 Mon Sep 17 00:00:00 2001
From: Bruce Frantz <bfrantz@alionscience.com>
Date: Fri, 19 Apr 2019 18:37:38 +0000
Subject: [PATCH] patches for faster ecm

---
 drivers/usb/gadget/function/f_ecm.c   | 2 +-
 drivers/usb/gadget/function/f_rndis.c | 2 +-
 drivers/usb/gadget/function/u_ether.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
index 4c488d1..2d65c82 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -327,7 +327,7 @@ static struct usb_ss_ep_comp_descriptor ss_ecm_bulk_comp_desc = {
 	.bDescriptorType =	USB_DT_SS_ENDPOINT_COMP,
 
 	/* the following 2 values can be tweaked if necessary */
-	/* .bMaxBurst =		0, */
+ 	.bMaxBurst =		15, 
 	/* .bmAttributes =	0, */
 };
 
diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
index c7c5b3c..fabb37e 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -323,7 +323,7 @@ static struct usb_ss_ep_comp_descriptor ss_bulk_comp_desc = {
 	.bDescriptorType =	USB_DT_SS_ENDPOINT_COMP,
 
 	/* the following 2 values can be tweaked if necessary */
-	/* .bMaxBurst =		0, */
+	.bMaxBurst =		15,
 	/* .bmAttributes =	0, */
 };
 
diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
index bdbc3fd..3c0653a 100644
--- a/drivers/usb/gadget/function/u_ether.c
+++ b/drivers/usb/gadget/function/u_ether.c
@@ -91,7 +91,7 @@ struct eth_dev {
 
 #define RX_EXTRA	20	/* bytes guarding against rx overflows */
 
-#define DEFAULT_QLEN	2	/* double buffering by default */
+#define DEFAULT_QLEN	32	/* double buffering by default */
 
 /* for dual-speed hardware, use deeper queues at high/super speed */
 static inline int qlen(struct usb_gadget *gadget, unsigned qmult)
-- 
2.7.4

 

Has anyone succesfully operated at the speeds referenced in the forum post with recent kernels?

root@uz7ev-evcc-sd-oob-2018-2:/mnt# [   80.196571] g_ether gadget: super-speed config #2: RNDIS
[   80.202552] IPv6: ADDRCONF(NETDEV_CHANGE): usb0: link becomes ready
[   81.300620] NOHZ: local_softirq_pending 08
[   81.304706] skbuff: skb_over_panic: text:ffffff80086e6354 len:-230 put:-230 head:ffffffc871e96680 data:fffffil:0xffffff9c end:0x700 dev:usb0
[   81.318477] ------------[ cut here ]------------
[   81.323034] kernel BUG at /kernel-source//net/core/skbuff.c:105!
[   81.329025] Internal error: Oops - BUG: 0 [#1] SMP
[   81.333797] Modules linked in: usb_f_ecm g_ether usb_f_rndis uio_pdrv_genirq
[   81.340832] CPU: 3 PID: 2173 Comm: irq/71-dwc3 Not tainted 4.14.0-xilinx-v2018.2 #3
[   81.348468] Hardware name: xlnx,zynqmp (DT)
[   81.352632] task: ffffffc875b99300 task.stack: ffffff800cd78000
[   81.358541] PC is at skb_panic+0x48/0x50
[   81.362442] LR is at skb_panic+0x48/0x50
[   81.366347] pc : [<ffffff80088157e8>] lr : [<ffffff80088157e8>] pstate: 000001c5
[   81.373727] sp : ffffff800cd7bc30
[   81.377022] x29: ffffff800cd7bc40 x28: ffffffc871d84100
[   81.382318] x27: 0000000000000001 x26: 00000000ffffff1a
[   81.387613] x25: ffffffc872dcc148 x24: ffffff800cd7bdd8
[   81.392908] x23: ffffffc871d86850 x22: 0000000000000000
[   81.398203] x21: ffffffc871d84b00 x20: ffffffc871d84100
[   81.403498] x19: ffffffc871d86800 x18: 0000000000000010
[   81.408792] x17: 0000000000000000 x16: 0000000000000000
[   81.414087] x15: ffffffffffffffff x14: 0720072007200730
[   81.419382] x13: 076207730775073a x12: 0776076507640720
[   81.424677] x11: 0730073007370778 x10: 0730073a0764076e
[   81.429972] x9 : 0765072007630739 x8 : 0766076607660766
[   81.435267] x7 : 0766076607780730 x6 : 0000000000000175
[   81.440561] x5 : 0000000000000000 x4 : 0000000000000000
[   81.445856] x3 : 0000000000000000 x2 : ffffffc87ffbb568
[   81.451151] x1 : 00000048771cb000 x0 : 000000000000008e
[   81.456447] Process irq/71-dwc3 (pid: 2173, stack limit = 0xffffff800cd78000)
[   81.463565] Call trace:
[   81.465994] Exception stack(0xffffff800cd7baf0 to 0xffffff800cd7bc30)
[   81.472420] bae0:                                   000000000000008e 00000048771cb000
[   81.480234] bb00: ffffffc87ffbb568 0000000000000000 0000000000000000 0000000000000000
[   81.488047] bb20: 0000000000000175 0766076607780730 0766076607660766 0765072007630739
[   81.495859] bb40: 0730073a0764076e 0730073007370778 0776076507640720 076207730775073a
[   81.503671] bb60: 0720072007200730 ffffffffffffffff 0000000000000000 0000000000000000
[   81.511483] bb80: 0000000000000010 ffffffc871d86800 ffffffc871d84100 ffffffc871d84b00
[   81.519295] bba0: 0000000000000000 ffffffc871d86850 ffffff800cd7bdd8 ffffffc872dcc148
[   81.527107] bbc0: 00000000ffffff1a 0000000000000001 ffffffc871d84100 ffffff800cd7bc40
[   81.534919] bbe0: ffffff80088157e8 ffffff800cd7bc30 ffffff80088157e8 00000000000001c5
[   81.542731] bc00: ffffff80086e6354 00000000ffffff1a ffffffffffffffff ffffffc871e96680
[   81.550542] bc20: ffffff800cd7bc40 ffffff80088157e8
[   81.555402] [<ffffff80088157e8>] skb_panic+0x48/0x50
[   81.560349] [<ffffff8008816eec>] skb_put+0x64/0x68
[   81.565125] [<ffffff80086e6354>] rx_complete+0x4c/0x248
[   81.570333] [<ffffff80086e14a0>] usb_gadget_giveback_request+0x10/0x18
[   81.576843] [<ffffff80086ac5f0>] dwc3_gadget_giveback+0x98/0xc8
[   81.582745] [<ffffff80086ae44c>] dwc3_endpoint_transfer_complete+0x144/0x410
[   81.589775] [<ffffff80086ae9b4>] dwc3_thread_interrupt+0x29c/0x868
[   81.595940] [<ffffff80080ddc30>] irq_thread_fn+0x28/0x68
[   81.601233] [<ffffff80080ddedc>] irq_thread+0x10c/0x1a8
[   81.606441] [<ffffff80080b8bbc>] kthread+0x12c/0x130
[   81.611389] [<ffffff8008084a90>] ret_from_fork+0x10/0x18
[   81.616684] Code: a90023eb aa0a03e1 9109e120 97e3172d (d4210000)
[   81.622759] ---[ end trace 2094c547cc9ee6cf ]---
[   81.627376] genirq: exiting task "irq/71-dwc3" (2173) is an active IRQ thread (irq 71)
[  172.265916] random: crng init done

 

0 Kudos
3 Replies
Xilinx Employee
Xilinx Employee
454 Views
Registered: ‎09-01-2014

Re: USB 3.0 Ethernet Gadget Speeds

This is a MTU bug in USB ether.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=eea52743eb5654ec6f52b0e8b4aefec952543697
this patch was merged into 2018.3 release, so you can apply this patch manually or try 2018.3, then try to increase the MTU size by giving below command.
ip link set dev usb0 mtu 15300
430 Views
Registered: ‎05-16-2013

Re: USB 3.0 Ethernet Gadget Speeds

I applied this patch to 2018.2 Petalinux and I was able to increase the MTU size to 15300, which iperf3 gave me speeds at 1.3Gbps.  Now I am moving onto changing the burst sizes, but the patch I applied above give me kernel panics.  Any ideas there?

0 Kudos
Xilinx Employee
Xilinx Employee
409 Views
Registered: ‎09-01-2014

Re: USB 3.0 Ethernet Gadget Speeds

I don’t know, other customers also tried this patch, but I don’t hear of Kernel panics.
Maybe try 2018.3?
0 Kudos