Re: functionfs on dwc3, xhci host: endpoint cannot be used in both directions ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 16 Jan 2017 14:48:31 +0000, Vincent Pelletier
<plr.vincent@xxxxxxxxx> wrote:
> 3) I declared 4 endpoints (2 IN, 2 OUT). And I went one level deeper
>    down the rabbit hole: now enumeration fails with this message on
>    host:

Aaand... I dug this part of the hole myself. In the library part of my
python module, and I was looking at the test program. Shame on me.

Next tests: After a bit of patching f_fs so it accepts creating 30
endpoints, more endpoints seem to have issues above the 7th (ignoring
direction).

1IN     bandwidth: 0 B/s (0.20s)
1OUT    bandwidth: 30230053 B/s (0.21s)
2IN     bandwidth: 29541962 B/s (0.22s)
2OUT    bandwidth: 29995671 B/s (0.22s)
3IN     bandwidth: 28787881 B/s (0.22s)
3OUT    bandwidth: 30428794 B/s (0.22s)
4IN     bandwidth: 29768777 B/s (0.22s)
4OUT    bandwidth: 30377747 B/s (0.22s)
5IN     bandwidth: 29521290 B/s (0.22s)
5OUT    bandwidth: 30133012 B/s (0.22s)
6IN     bandwidth: 29662245 B/s (0.22s)
6OUT    bandwidth: 30335271 B/s (0.22s)
7IN     bandwidth: 29467489 B/s (0.22s)
7OUT    bandwidth: 30387586 B/s (0.22s)
8IN     bandwidth: 0 B/s (0.20s)
8OUT    bandwidth: 0 B/s (0.20s)
9IN     bandwidth: 0 B/s (0.20s)
9OUT    bandwidth: 30174377 B/s (0.22s)
10IN    bandwidth: 0 B/s (0.20s)
10OUT   bandwidth: 30389703 B/s (0.22s)
11IN    bandwidth: 0 B/s (0.20s)
11OUT   bandwidth: 29947720 B/s (0.21s)
12IN    bandwidth: 0 B/s (0.20s)
12OUT   bandwidth: 29386298 B/s (0.21s)
13IN    bandwidth: 0 B/s (0.20s)
13OUT   bandwidth: 30097119 B/s (0.22s)
14IN    bandwidth: 0 B/s (0.20s)
14OUT   bandwidth: 30099782 B/s (0.22s)
15IN    bandwidth: 0 B/s (0.20s)
15OUT   bandwidth: 31122053 B/s (0.21s)

Would this pattern ring a bell ?

I did the stall test again (on all endpoints and on 8IN + 9IN), and the
halted endpoints behave as expected.
I also verified the right data reaches/comes from the right endpoint
(for those which work), without error.
I did not check with my protocol analyser yet.

I attach the patch against f_fs.c as an RFC.

Regards,
-- 
Vincent Pelletier
>From fc77bb86dfbf088ce4a63510867210c2f2d8b0af Mon Sep 17 00:00:00 2001
Message-Id: <fc77bb86dfbf088ce4a63510867210c2f2d8b0af.1484661254.git.plr.vincent@xxxxxxxxx>
From: Vincent Pelletier <plr.vincent@xxxxxxxxx>
Date: Tue, 17 Jan 2017 12:57:39 +0000
Subject: usb: gadget: f_fs: Accept up to 30 endpoints.

It is allowed by the USB specification to enabled same-address, opposite-
direction endpoints simultaneously, which means 30 non-zero endpoints
are allowed. So double eps_addrmap length to 30.
The original code only accepted 14 descriptors, because the first
eps_addrmap entry is unused (it is a placeholder for endpoint zero).
So increase eps_addrmap length by one to 31.

Signed-off-by: Vincent Pelletier <plr.vincent@xxxxxxxxx>
---
 drivers/usb/gadget/function/f_fs.c | 2 +-
 drivers/usb/gadget/function/u_fs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 5c91a6f4613b..206184b561b7 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -2101,7 +2101,7 @@ static int __ffs_data_do_entity(enum ffs_entity_type type,
 	case FFS_ENDPOINT:
 		d = (void *)desc;
 		helper->eps_count++;
-		if (helper->eps_count >= 15)
+		if (helper->eps_count >= 31)
 			return -EINVAL;
 		/* Check if descriptors for any speed were already parsed */
 		if (!helper->ffs->eps_count && !helper->ffs->interfaces_count)
diff --git a/drivers/usb/gadget/function/u_fs.h b/drivers/usb/gadget/function/u_fs.h
index 60139854e0b1..8eaf473d1ac0 100644
--- a/drivers/usb/gadget/function/u_fs.h
+++ b/drivers/usb/gadget/function/u_fs.h
@@ -247,7 +247,7 @@ struct ffs_data {
 
 	unsigned			user_flags;
 
-	u8				eps_addrmap[15];
+	u8				eps_addrmap[31];
 
 	unsigned short			strings_count;
 	unsigned short			interfaces_count;
-- 
2.11.0


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux