diff mbox series

[1/7] usb: gadget: f_ecm: fix ecm_bitrate() for SuperSpeed and above

Message ID 20230803051810.2974-2-quic_linyyuan@quicinc.com
State New
Headers show
Series remove some usage of gadget_is_{*}speed() API | expand

Commit Message

Linyu Yuan Aug. 3, 2023, 5:18 a.m. UTC
In function ecm_bitrate(), it is not good to report same speed as
super speed when gadget work at super speed plus.

Change report speed same as commit 986499b1569a ("usb: gadget: f_ncm:
fix ncm_bitrate for SuperSpeed and above.").

Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
 drivers/usb/gadget/function/f_ecm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
index c6e63ad77a40..8da7d314602c 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -68,8 +68,10 @@  static inline struct f_ecm *func_to_ecm(struct usb_function *f)
 /* peak (theoretical) bulk transfer rate in bits-per-second */
 static inline unsigned ecm_bitrate(struct usb_gadget *g)
 {
-	if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER)
-		return 13 * 1024 * 8 * 1000 * 8;
+	if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER_PLUS)
+		return 4250000000U;
+	else if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER)
+		return 3750000000U;
 	else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
 		return 13 * 512 * 8 * 1000 * 8;
 	else