summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/function/f_ecm.c
diff options
context:
space:
mode:
authorLinyu Yuan <quic_linyyuan@quicinc.com>2023-08-03 17:10:47 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-22 14:48:33 +0200
commit98102ae1549e3af33359ec3a8e57adafa57b1b01 (patch)
treebd7cfb6dc7c8759d7455c05a18608e4bb74326a8 /drivers/usb/gadget/function/f_ecm.c
parent0c2dfb3ea6e92e8179efb44652442f4b87557ed6 (diff)
usb: gadget: use working speed to calcaulate network bitrate and qlen
Take ecm_bitrate() as example, it will be called after gadget device link speed negotiation, consider code if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER), if a gadget device link speed is USB_SPEED_SUPER, gadget_is_superspeed(g) must be true, or not it is a wrong configuration of gadget max support speed. Remove gadget_is_superspeed(g) checking should be safe, and remove other similar operation in ncm, rndis, u_ether. Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> Link: https://lore.kernel.org/r/20230803091053.9714-2-quic_linyyuan@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/function/f_ecm.c')
-rw-r--r--drivers/usb/gadget/function/f_ecm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
index c6e63ad77a40..cbe05da94bde 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -68,9 +68,9 @@ 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)
+ if (g->speed == USB_SPEED_SUPER)
return 13 * 1024 * 8 * 1000 * 8;
- else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
+ else if (g->speed == USB_SPEED_HIGH)
return 13 * 512 * 8 * 1000 * 8;
else
return 19 * 64 * 1 * 1000 * 8;