[PATCH 2/2] usb: gadget: f_ecm: do not notify from ecm_set_alt()

From: Massimo Toscanelli via B4 Relay

Date: Fri Oct 23 2026 - 08:16:30 EST


From: Massimo Toscanelli <massimo.toscanelli@xxxxxxxxxxxxxxxxxxxx>

ecm_set_alt() calls ecm_notify() for both altsettings of the data
interface. So a notification is already queued at SET_CONFIGURATION,
when altsetting 0 is selected, and it waits until the host reads the
interrupt endpoint.

The USB 2.0 LPM ECN (section 2.2.2) lets a device answer NYET to an LPM
request when it has data pending for the host, and DWC3 does so. So
when the host loads no class driver, the device never enters L1.

For altsetting 1 the call is not needed: gether_connect() already
calls ecm_open() or ecm_close(), and both notify. The extra call only
restarts the sequence while the first notification is in flight, so
the host gets two connection notifications before the speed one. The
removed comment calls this a minor disagreement with the ECM spec.

Remove the call and the comment.

Fixes: da741b8c56d6 ("usb ethernet gadget: split CDC Ethernet function")
Signed-off-by: Massimo Toscanelli <massimo.toscanelli@xxxxxxxxxxxxxxxxxxxx>
---
drivers/usb/gadget/function/f_ecm.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
index e495bac4efe..c8c3a7d1c80 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -581,14 +581,6 @@ static int ecm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
if (IS_ERR(net))
return PTR_ERR(net);
}
-
- /* NOTE this can be a minor disagreement with the ECM spec,
- * which says speed notifications will "always" follow
- * connection notifications. But we allow one connect to
- * follow another (if the first is in flight), and instead
- * just guarantee that a speed notification is always sent.
- */
- ecm_notify(ecm);
} else
goto fail;


--
2.43.0