public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: u_ether: Re-attach netif device to mirror detachment
@ 2023-12-18 16:45 Richard Acayan
  2023-12-28 21:59 ` Luca Weiss
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Richard Acayan @ 2023-12-18 16:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Hardik Gajjar, linux-usb, linux-kernel; +Cc: Richard Acayan

In 6.7-rc1, there was a netif_device_detach call added to the
gether_disconnect function. This clears the __LINK_STATE_PRESENT bit of
the netif device and suppresses pings (ICMP messages) and TCP connection
requests from the connected host. If userspace temporarily disconnects
the gadget, such as by temporarily removing configuration in the gadget
configfs interface, network activity should continue to be processed
when the gadget is re-connected. Mirror the netif_device_detach call
with a netif_device_attach call in gether_connect to fix re-connecting
gadgets.

Link: https://gitlab.com/postmarketOS/pmaports/-/tree/6002e51b7090aeeb42947e0ca7ec22278d7227d0/main/postmarketos-base-ui/rootfs-usr-lib-NetworkManager-dispatcher.d-50-tethering.sh
Fixes: f49449fbc21e ("usb: gadget: u_ether: Replace netif_stop_queue with netif_device_detach")
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
---
 drivers/usb/gadget/function/u_ether.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
index 9d1c40c152d8..3c5a6f6ac341 100644
--- a/drivers/usb/gadget/function/u_ether.c
+++ b/drivers/usb/gadget/function/u_ether.c
@@ -1163,6 +1163,8 @@ struct net_device *gether_connect(struct gether *link)
 		if (netif_running(dev->net))
 			eth_start(dev, GFP_ATOMIC);
 
+		netif_device_attach(dev->net);
+
 	/* on error, disable any endpoints  */
 	} else {
 		(void) usb_ep_disable(link->out_ep);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-01-21 13:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-18 16:45 [PATCH] usb: gadget: u_ether: Re-attach netif device to mirror detachment Richard Acayan
2023-12-28 21:59 ` Luca Weiss
2023-12-29  8:44   ` Greg Kroah-Hartman
2023-12-28 22:36 ` Duje Mihanović
2024-01-07  9:56 ` Linux regression tracking (Thorsten Leemhuis)
2024-01-15 20:11 ` Ferry Toth
2024-01-21 13:23 ` Andy Shevchenko
2024-01-21 13:24   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox