From 4c3bf9ce07544cb24a4b279d25cdf4b2d02acdd0 Mon Sep 17 00:00:00 2001 From: Fiona Klute Date: Wed, 10 Jan 2024 21:40:26 +0100 Subject: [PATCH] linux-postmarketos-allwinner: Import patch for u_ether regression (MR 4706) This fixes the USB networking issue, see: https://patchwork.kernel.org/project/linux-usb/patch/20231218164532.411125-2-mailingradian@gmail.com/ Thanks to Alexey Min to pointing me at the patch! [ci:skip-build]: Already built successfully in CI. --- ...her-Re-attach-netif-device-to-mirror.patch | 44 +++++++++++++++++++ .../linux-postmarketos-allwinner/APKBUILD | 2 + 2 files changed, 46 insertions(+) create mode 100644 device/main/linux-postmarketos-allwinner/0015-usb-gadget-u_ether-Re-attach-netif-device-to-mirror.patch diff --git a/device/main/linux-postmarketos-allwinner/0015-usb-gadget-u_ether-Re-attach-netif-device-to-mirror.patch b/device/main/linux-postmarketos-allwinner/0015-usb-gadget-u_ether-Re-attach-netif-device-to-mirror.patch new file mode 100644 index 000000000..29b481e04 --- /dev/null +++ b/device/main/linux-postmarketos-allwinner/0015-usb-gadget-u_ether-Re-attach-netif-device-to-mirror.patch @@ -0,0 +1,44 @@ +From 5f4158b3feecb4cc9fcae276cec2352ae3a03ec2 Mon Sep 17 00:00:00 2001 +From: Richard Acayan +Date: Mon, 18 Dec 2023 11:45:33 -0500 +Subject: [PATCH] usb: gadget: u_ether: Re-attach netif device to mirror + detachment +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +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 +Tested-by: Luca Weiss +Tested-by: Duje Mihanović +--- + 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 18fc4fb011..5817a0993a 100644 +--- a/drivers/usb/gadget/function/u_ether.c ++++ b/drivers/usb/gadget/function/u_ether.c +@@ -1159,6 +1159,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 + diff --git a/device/main/linux-postmarketos-allwinner/APKBUILD b/device/main/linux-postmarketos-allwinner/APKBUILD index f86e3a623..87f6564f0 100644 --- a/device/main/linux-postmarketos-allwinner/APKBUILD +++ b/device/main/linux-postmarketos-allwinner/APKBUILD @@ -46,6 +46,7 @@ source="$pkgname-$_tag.tar.gz::https://codeberg.org/megi/linux/archive/$_tag.tar 0012-arm64-dts-allwinner-orangepi-3-fix-ethernet.patch 0013-Revert-usb-quirks-Add-USB_QUIRK_RESET-for-Quectel-EG25G-Modem.patch 0014-usb-serial-option-add-reset-resume-callback-for-WWAN.patch + 0015-usb-gadget-u_ether-Re-attach-netif-device-to-mirror.patch " builddir="$srcdir/linux" @@ -100,4 +101,5 @@ b7c084bb32cfc18defcec77966f1944fd3b33bb48769a4c0e257709d0f3898c5e0ca2a50c39a5d45 370e963805a4c984dc501a6a6f686cac059485a275370c5f55de0841e227c5f6652abb38ad935c8dd046014e632e70129d3f8fbeae9650fe7de6f0d10e9cdc3a 0012-arm64-dts-allwinner-orangepi-3-fix-ethernet.patch c766911f76d36b997582533707d7d7a089ed1272e49a79dbe75f7c1eafef0ba3f1417d6c66f25e12e56124e0cd4bb9f443d400236e252ef1c43d53def9392a87 0013-Revert-usb-quirks-Add-USB_QUIRK_RESET-for-Quectel-EG25G-Modem.patch 382e6e8785235788101459ae47c940ec85831007c61e3f14c4e3a43abfa21b95cdaa6bdd1b7fdd6fd26944f4c629d41b9ab776e89d9a18778fbc9f6a7785444b 0014-usb-serial-option-add-reset-resume-callback-for-WWAN.patch +3ce3bc02e4cb401f5834b9607d50fe26e0cbd7d6f5e32f1ab092660185ff01b253a759be5e6dfb46aa629dc0871f935d93746a0b55ede49f194b617dda87f766 0015-usb-gadget-u_ether-Re-attach-netif-device-to-mirror.patch "