Message ID | 20231218164532.411125-2-mailingradian@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-4086-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1374373dyi; Mon, 18 Dec 2023 08:46:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQjcNDHUE2AH54NsRTzaq05RugFgRivB+YGDG9Lo71zUQ2K8YRvfXT11X7T79ZF0DrNU1J X-Received: by 2002:a05:6a00:1941:b0:6ce:4941:c52d with SMTP id s1-20020a056a00194100b006ce4941c52dmr18474386pfk.68.1702917964871; Mon, 18 Dec 2023 08:46:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702917964; cv=none; d=google.com; s=arc-20160816; b=OeKNdr7oq+7VrjXhSaQHVsquttbX3RZ4lC1ZG9WYHd8nzDJ9+PIKqruVi2KUQZCvo9 8/fdqBoSfMP8KEwUkV+7TdBX08kDKV+ES54LexdiCI+M0wrysFyiQIuECWvhsyqtwvBH 5juQ9Oaj7z4e+Nc1MLsA6k1HLMU8Q75MmwKeaLMh3rG+5zrSsfo8IpnlFKcAA8feUXcJ eyKqxk5fa/K3wirstQNvKKix/X+CiAUOopGi4q1TrRuwWCo8vQ158qAUBIeAhXErmJoK 4XFmDoAlrkfdVTHoQy0H6RMf1DHTJeeON5+WT+4pSSh7wJbgS+FEN5LJgEIRDBheCC2d oQZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=kZBaEcaOfw2v5PuhZIuGx5Nh4ffB6hmj27S27SIqM0U=; fh=wIS3vq8rL1qEsvq/TpU1Cv+MDBARwitXcGgrCjulS+M=; b=pZqnjDqnMRNclp7TaqH4mtSzNypED7DyIfwlbNVigw46ioFPXCIQcwWathuiynRCRd JHpNhZJf93vS/G3dGH4kqjjq1qNqGUfRjyPGvLWQNHahhfGpdqPKSdNAgzGJ10gWu7WM XUzHFKSicNtJN5h82lrYTvh05qG8TpUd4qHaIselDVzAUi0hU4bN1zdRIehFhbPoxa5x EjGk5cCJ6UxscFHpseO0iJomzJdGomW6syVFH7AbPyUPRTAgMlbYI5Ue2pJDf/N81cVH BrpfX7vtfjVAuX6dFzxKnD6H7jV3W/QiMvfqh23+H6KWyEX7Vx4HrCDhHlPaoSw6n2ze zKrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="RfMt/8N8"; spf=pass (google.com: domain of linux-kernel+bounces-4086-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4086-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bk6-20020a056a02028600b00577616e3ad9si18333395pgb.871.2023.12.18.08.46.04 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 08:46:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4086-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="RfMt/8N8"; spf=pass (google.com: domain of linux-kernel+bounces-4086-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4086-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4CA752853E1 for <ouuuleilei@gmail.com>; Mon, 18 Dec 2023 16:46:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B0AD4FF7D; Mon, 18 Dec 2023 16:45:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RfMt/8N8" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DEBD6FB6; Mon, 18 Dec 2023 16:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-202ffc46e15so1001485fac.1; Mon, 18 Dec 2023 08:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702917944; x=1703522744; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kZBaEcaOfw2v5PuhZIuGx5Nh4ffB6hmj27S27SIqM0U=; b=RfMt/8N8ISkeYyAid+dJCGNfMapEDGNvi+ZVGVye764Ay7DC+frAaEtcTHbx12jC/I n21pQ+MSCkCS36s4Ko2rJL/nVRipfirxGD4Sw+BbjERSecvyhyH61e4C4dYfcrx8AISG WyXxi6n6xNU4RCHPdRZQjHy3CAE4JrFmYzaiXW0oJktp1P0SGt2x+AbNVct+RssstMSh Xu10SeYTdBZJENrh6cDWNxUDO3VNGxHAYPrdPFmcb6HSrc1gp6cFasZ05CSZXC+B3wYS Wu/DE0yCt741nCd8MjU/f+XUExPJZhir9MNMdJsTtGiFS5osT6XkVW9PPPPp6gn0SE4+ R1oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702917944; x=1703522744; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kZBaEcaOfw2v5PuhZIuGx5Nh4ffB6hmj27S27SIqM0U=; b=Sz+t4hxtp5bC3coaHEGmmJRa1Rv9XDCAkyjoVkpq9BQtUN81tUepltsOop77AX3KJH O0A3bNxEme+YwdHsSN+AtKPRkRnkP/B9DRvgEPzawqThHhWtLDM1rnDpqTR/fX92qmGs vq5XjdJNwhhH+2ww09m4rs5+pyvewFVmCrUupRsHrkmyfBFvNGomI1kiFuRVkKkwEVR+ Hgblw/eMRB9iqc5XOL7JMwqhfArI7+dXTMWeJWN9tY3DoeF+uT38bCgif6CIkkG72hio keBPSyo4VRnuZoAs6Eqn29E8GATj6TeAun+qTQZG2bFaupoI0dhp2iEWtKgLBOB5umHR 4KBQ== X-Gm-Message-State: AOJu0YzYss05Ux+psfL0GgohGAjz13iW3oUTZa+dL/EVarR1WTjsJkks 9lJ7cioguxFHHcVxxI14YEw= X-Received: by 2002:a05:6871:890a:b0:203:9e4a:d9c0 with SMTP id ti10-20020a056871890a00b002039e4ad9c0mr1007193oab.31.1702917944490; Mon, 18 Dec 2023 08:45:44 -0800 (PST) Received: from localhost ([2607:fea8:52a3:d200::325c]) by smtp.gmail.com with ESMTPSA id c12-20020ac86e8c000000b004255183b1a4sm9374825qtv.64.2023.12.18.08.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 08:45:43 -0800 (PST) From: Richard Acayan <mailingradian@gmail.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Hardik Gajjar <hgajjar@de.adit-jv.com>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Richard Acayan <mailingradian@gmail.com> Subject: [PATCH] usb: gadget: u_ether: Re-attach netif device to mirror detachment Date: Mon, 18 Dec 2023 11:45:33 -0500 Message-ID: <20231218164532.411125-2-mailingradian@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785638908348976052 X-GMAIL-MSGID: 1785638908348976052 |
Series |
usb: gadget: u_ether: Re-attach netif device to mirror detachment
|
|
Commit Message
Richard Acayan
Dec. 18, 2023, 4:45 p.m. UTC
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(+)
Comments
On Montag, 18. Dezember 2023 17:45:33 CET Richard Acayan wrote: > 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. (+Cc Thorsten Leemhuis) This appears to fix the regression on a 6.7-rc5-based build for qcom-msm8974pro-fairphone-fp2, that the NCM network gadget doesn't work. I've also heard reports from qcom-sdm845 and a PXA1908-based phone (if I see this correctly) about issues on 6.7. In postmarketOS on the device side the usb0 interface doesn't get the IP address assigned correctly it seems, but it seems to behave a bit inconsistently - but always broken. Anyways, with this patch everything looks good again. I hope this makes it for 6.7 final still. Tested-by: Luca Weiss <luca@z3ntu.xyz> > > 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);
On Monday, December 18, 2023 17:45:33 CET, Richard Acayan wrote: > 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. This fixes the NCM gadget on the PXA1908 phone Luca mentioned on v6.7-rc7. Tested-by: Duje Mihanović <duje.mihanovic@skole.hr> Regards, Duje
On Thu, Dec 28, 2023 at 10:59:59PM +0100, Luca Weiss wrote: > On Montag, 18. Dezember 2023 17:45:33 CET Richard Acayan wrote: > > 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. > > (+Cc Thorsten Leemhuis) > > This appears to fix the regression on a 6.7-rc5-based build for > qcom-msm8974pro-fairphone-fp2, that the NCM network gadget doesn't work. > I've also heard reports from qcom-sdm845 and a PXA1908-based phone (if > I see this correctly) about issues on 6.7. > > In postmarketOS on the device side the usb0 interface doesn't get the IP > address assigned correctly it seems, but it seems to behave a bit > inconsistently - but always broken. > > Anyways, with this patch everything looks good again. I hope this makes > it for 6.7 final still. It will have to wait until 6.8-rc1, sorry.
Linux regression tracking (Thorsten Leemhuis)
Jan. 7, 2024, 9:56 a.m. UTC |
#4
Addressed
Unaddressed
On 18.12.23 17:45, Richard Acayan wrote: > 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> Thanks for the report. To be sure the issue doesn't fall through the cracks unnoticed, I'm adding it to regzbot, the Linux kernel regression tracking bot: #regzbot ^introduced f49449fbc21e #regzbot title usb: gadget: u_ether: network gadgets don't work #regzbot fix: usb: gadget: u_ether: Re-attach netif device to mirror detachment #regzbot ignore-activity Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) -- Everything you wanna know about Linux kernel regression tracking: https://linux-regtracking.leemhuis.info/about/#tldr That page also explains what to do if mails like this annoy you.
Hi, Op 18-12-2023 om 17:45 schreef 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); This works mrfld (Intel Edison Arduino) using configfs with v6.7.0. Tested using `iperf3 -s` on mrfld, iperf3 --bidir -c edison-usb [ ID][Role] Interval Transfer Bitrate Retr [ 5][TX-C] 0.00-10.00 sec 130 MBytes 109 Mbits/sec 0 sender [ 5][TX-C] 0.00-9.99 sec 129 MBytes 108 Mbits/sec receiver [ 7][RX-C] 0.00-10.00 sec 167 MBytes 140 Mbits/sec 0 sender [ 7][RX-C] 0.00-9.99 sec 166 MBytes 139 Mbits/sec receiver and iperf3 -c edison-usb [ 5] 0.00-10.00 sec 247 MBytes 207 Mbits/sec 0 sender [ 5] 0.00-9.99 sec 246 MBytes 206 Mbits/sec receiver Tested-by: Ferry Toth <fntoth@gmail.com> [mrfld]
On Mon, Dec 18, 2023 at 11:45:33AM -0500, Richard Acayan wrote: > 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. Tested-by: From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Merrifield
On Sun, Jan 21, 2024 at 03:23:42PM +0200, Andy Shevchenko wrote: > On Mon, Dec 18, 2023 at 11:45:33AM -0500, Richard Acayan wrote: > > 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. > > Tested-by: From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Merrifield Sorry, now correct tag. Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Merrifield
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);