Message ID | 20231006155646.12938-1-hgajjar@de.adit-jv.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp426894vqo; Fri, 6 Oct 2023 08:57:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbxQ4+9dtiUs2NM+7NswmhsgINIxnwMaabJxj5limhoSwi5DMm5GCM9+VfbW/0ZHz/f8cI X-Received: by 2002:a05:6358:278c:b0:143:8084:e625 with SMTP id l12-20020a056358278c00b001438084e625mr8499384rwb.11.1696607831220; Fri, 06 Oct 2023 08:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696607831; cv=none; d=google.com; s=arc-20160816; b=w5iiAD9DhR+cFqq7wuTslMhyVbLWA6DNDJqWZ+2xkhBOtI6m09Koxbz/W2ExiRYtWs Sfw3ZVDwNblgSk3begeEWkkmJfZ0tMUlua+dGQ6ShVVU0K8RbJt2h5vSjAkVOdxTXx1b /Cl0QZh9d8NfeeUoO4Ks9FQBHTUjDpCGYf5+oEqZFqpZEMcOim1TkFK7G3g8RYzYgeCs sf/V0z67utY88bNrJ5Jz+MFbHXCpXTPmkcRGyrq69z6QZqRm3IV5zpVZj0VxV5SUY92w 9NcDmACPvzETqwpAUoeyj2LQ++aseB7HV1qQTmbZHTTCh0WMNjN0R+tyfpe50IWX1t1a 9d8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=BwUCwF0DUFIOtt6ltK9cY1srHH/RX/2nJWYsjYdOQhU=; fh=fnE/bHGRt0bnLs/gLT7CmmXLtlYO+uB6FxtaiV5G/9U=; b=cUaW42N4dk9ZEb8VIxRuC1CZMBkbSl+8FBntZNFcSTlvmbj1DfTz5oDVOz8Ar4pNpS g6ld0lpAO0x1vOFHBAnLTr+VMozYacAqV40MZhFS6JWMY5ujnfOvt9DcQ1jNB66gYqGL uDZdwiHdXPbzq4uLWLSF9tmW+zXK4yn+yZfe7Gp7ZsaYJa3gXbdgbE44SPX3ZuVYJOJW fHPMo8SLH0EXLiA2Svm8EjYytKy6InXIWzAGJE9ETsgv95NGCcbj5Y4SUaayrQs4Zfuv nyfSCEqFtdwcB+QmZrYZtyJv69BLVoHMyf3s7PepJTKFwjtvcADxbEnT7+79spz7f82L HwOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id a22-20020a17090abe1600b00275cffed966si5965820pjs.57.2023.10.06.08.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 08:57:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id EEEC480ABF3E; Fri, 6 Oct 2023 08:57:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232888AbjJFP46 (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Fri, 6 Oct 2023 11:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232850AbjJFP44 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Oct 2023 11:56:56 -0400 Received: from hi1smtp01.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90370AD; Fri, 6 Oct 2023 08:56:55 -0700 (PDT) Received: from hi2exch02.adit-jv.com (hi2exch02.adit-jv.com [10.72.92.28]) by hi1smtp01.de.adit-jv.com (Postfix) with ESMTP id 476F852050C; Fri, 6 Oct 2023 17:56:54 +0200 (CEST) Received: from vmlxhi-118.adit-jv.com (10.72.93.77) by hi2exch02.adit-jv.com (10.72.92.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Fri, 6 Oct 2023 17:56:54 +0200 From: Hardik Gajjar <hgajjar@de.adit-jv.com> To: <gregkh@linuxfoundation.org>, <s.hauer@pengutronix.de>, <jonathanh@nvidia.com>, <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <quic_linyyuan@quicinc.com>, <paul@crapouillou.net>, <quic_eserrao@quicinc.com>, <erosca@de.adit-jv.com>, <hgajjar@de.adit-jv.com> Subject: [PATCH v4] usb: gadget: u_ether: Replace netif_stop_queue with netif_device_detach Date: Fri, 6 Oct 2023 17:56:46 +0200 Message-ID: <20231006155646.12938-1-hgajjar@de.adit-jv.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231006153808.9758-1-hgajjar@de.adit-jv.com> References: <20231006153808.9758-1-hgajjar@de.adit-jv.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.72.93.77] X-ClientProxiedBy: hi2exch02.adit-jv.com (10.72.92.28) To hi2exch02.adit-jv.com (10.72.92.28) X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 06 Oct 2023 08:57:09 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779015707810044398 X-GMAIL-MSGID: 1779022253215452768 |
Series |
[v4] usb: gadget: u_ether: Replace netif_stop_queue with netif_device_detach
|
|
Commit Message
Hardik Gajjar
Oct. 6, 2023, 3:56 p.m. UTC
This patch replaces the usage of netif_stop_queue with netif_device_detach
in the u_ether driver. The netif_device_detach function not only stops all
tx queues by calling netif_tx_stop_all_queues but also marks the device as
removed by clearing the __LINK_STATE_PRESENT bit.
This change helps notify user space about the disconnection of the device
more effectively, compared to netif_stop_queue, which only stops a single
transmit queue.
Signed-off-by: Hardik Gajjar <hgajjar@de.adit-jv.com>
---
Changes since version 1:
- Correct Singed-off user name and e-mail
Changes since version 2:
- Move change history below signed-off-by
Changes since version 3:
- move netif_device_detach from eth_stop to gether_disconnect.
---
drivers/usb/gadget/function/u_ether.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
+Cc: Ferry. On Fri, Oct 06, 2023 at 05:56:46PM +0200, Hardik Gajjar wrote: > This patch replaces the usage of netif_stop_queue with netif_device_detach > in the u_ether driver. The netif_device_detach function not only stops all > tx queues by calling netif_tx_stop_all_queues but also marks the device as > removed by clearing the __LINK_STATE_PRESENT bit. > > This change helps notify user space about the disconnection of the device > more effectively, compared to netif_stop_queue, which only stops a single > transmit queue. This change effectively broke my USB ether setup. git bisect start # status: waiting for both good and bad commits # good: [1f24458a1071f006e3f7449c08ae0f12af493923] Merge tag 'tty-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty git bisect good 1f24458a1071f006e3f7449c08ae0f12af493923 # status: waiting for bad commit, 1 good commit known # bad: [2c40c1c6adab90ee4660caf03722b3a3ec67767b] Merge tag 'usb-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb git bisect bad 2c40c1c6adab90ee4660caf03722b3a3ec67767b # bad: [17d6b82d2d6d467149874b883cdba844844b996d] usb/usbip: fix wrong data added to platform device git bisect bad 17d6b82d2d6d467149874b883cdba844844b996d # good: [ba6b83a910b6d8a9379bda55cbf06cb945473a96] usb: xhci-mtk: add a bandwidth budget table git bisect good ba6b83a910b6d8a9379bda55cbf06cb945473a96 # good: [dddc00f255415b826190cfbaa5d6dbc87cd9ded1] Revert "usb: gadget: uvc: cleanup request when not in correct state" git bisect good dddc00f255415b826190cfbaa5d6dbc87cd9ded1 # bad: [8f999ce60ea3d47886b042ef1f22bb184b6e9c59] USB: typec: tps6598x: Refactor tps6598x port registration git bisect bad 8f999ce60ea3d47886b042ef1f22bb184b6e9c59 # bad: [f49449fbc21e7e9550a5203902d69c8ae7dfd918] usb: gadget: u_ether: Replace netif_stop_queue with netif_device_detach git bisect bad f49449fbc21e7e9550a5203902d69c8ae7dfd918 # good: [97475763484245916735a1aa9a3310a01d46b008] USB: usbip: fix stub_dev hub disconnect git bisect good 97475763484245916735a1aa9a3310a01d46b008 # good: [0f5aa1b01263b8b621bc4f031a1f2983ef8517b7] usb: usbtest: fix a type promotion bug git bisect good 0f5aa1b01263b8b621bc4f031a1f2983ef8517b7 # first bad commit: [f49449fbc21e7e9550a5203902d69c8ae7dfd918] usb: gadget: u_ether: Replace netif_stop_queue with netif_device_detach Note, revert indeed helps. Should I send a revert? I use configfs to setup USB EEM function and it worked till this commit. If needed, I can share my scripts, but I believe it's not needed as here we see a clear regression.
On Sun, Jan 14, 2024 at 06:59:19PM +0200, Andy Shevchenko wrote: > +Cc: Ferry. > > On Fri, Oct 06, 2023 at 05:56:46PM +0200, Hardik Gajjar wrote: > > This patch replaces the usage of netif_stop_queue with netif_device_detach > > in the u_ether driver. The netif_device_detach function not only stops all > > tx queues by calling netif_tx_stop_all_queues but also marks the device as > > removed by clearing the __LINK_STATE_PRESENT bit. > > > > This change helps notify user space about the disconnection of the device > > more effectively, compared to netif_stop_queue, which only stops a single > > transmit queue. > > This change effectively broke my USB ether setup. > > git bisect start > # status: waiting for both good and bad commits > # good: [1f24458a1071f006e3f7449c08ae0f12af493923] Merge tag 'tty-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty > git bisect good 1f24458a1071f006e3f7449c08ae0f12af493923 > # status: waiting for bad commit, 1 good commit known > # bad: [2c40c1c6adab90ee4660caf03722b3a3ec67767b] Merge tag 'usb-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb > git bisect bad 2c40c1c6adab90ee4660caf03722b3a3ec67767b > # bad: [17d6b82d2d6d467149874b883cdba844844b996d] usb/usbip: fix wrong data added to platform device > git bisect bad 17d6b82d2d6d467149874b883cdba844844b996d > # good: [ba6b83a910b6d8a9379bda55cbf06cb945473a96] usb: xhci-mtk: add a bandwidth budget table > git bisect good ba6b83a910b6d8a9379bda55cbf06cb945473a96 > # good: [dddc00f255415b826190cfbaa5d6dbc87cd9ded1] Revert "usb: gadget: uvc: cleanup request when not in correct state" > git bisect good dddc00f255415b826190cfbaa5d6dbc87cd9ded1 > # bad: [8f999ce60ea3d47886b042ef1f22bb184b6e9c59] USB: typec: tps6598x: Refactor tps6598x port registration > git bisect bad 8f999ce60ea3d47886b042ef1f22bb184b6e9c59 > # bad: [f49449fbc21e7e9550a5203902d69c8ae7dfd918] usb: gadget: u_ether: Replace netif_stop_queue with netif_device_detach > git bisect bad f49449fbc21e7e9550a5203902d69c8ae7dfd918 > # good: [97475763484245916735a1aa9a3310a01d46b008] USB: usbip: fix stub_dev hub disconnect > git bisect good 97475763484245916735a1aa9a3310a01d46b008 > # good: [0f5aa1b01263b8b621bc4f031a1f2983ef8517b7] usb: usbtest: fix a type promotion bug > git bisect good 0f5aa1b01263b8b621bc4f031a1f2983ef8517b7 > # first bad commit: [f49449fbc21e7e9550a5203902d69c8ae7dfd918] usb: gadget: u_ether: Replace netif_stop_queue with netif_device_detach > > Note, revert indeed helps. Should I send a revert? > > I use configfs to setup USB EEM function and it worked till this commit. > If needed, I can share my scripts, but I believe it's not needed as here > we see a clear regression. > > -- > With Best Regards, > Andy Shevchenko > > Without this patch, there may be a potential crash in a race condition, as __LINK_STATE_PRESENT is monitored at many places in the Network stack to determine the status of the link. Could you please provide details on how this patch affects your functionality? Are you experiencing connection problems or data transfer interruptions? Instead of reverting this patch, consider trying the upcoming patch (soon to be available in the mainline) to see if it resolves your issue. https://lore.kernel.org/lkml/2023122900-commence-agenda-db2c@gregkh/T/#m36a812d3f1e5d744ee32381f6ae4185940b376de Thanks, Hardik
Hi, Op 15-01-2024 om 14:27 schreef Hardik Gajjar: > On Sun, Jan 14, 2024 at 06:59:19PM +0200, Andy Shevchenko wrote: >> +Cc: Ferry. >> >> On Fri, Oct 06, 2023 at 05:56:46PM +0200, Hardik Gajjar wrote: >>> This patch replaces the usage of netif_stop_queue with netif_device_detach >>> in the u_ether driver. The netif_device_detach function not only stops all >>> tx queues by calling netif_tx_stop_all_queues but also marks the device as >>> removed by clearing the __LINK_STATE_PRESENT bit. >>> >>> This change helps notify user space about the disconnection of the device >>> more effectively, compared to netif_stop_queue, which only stops a single >>> transmit queue. >> >> This change effectively broke my USB ether setup. >> >> git bisect start >> # status: waiting for both good and bad commits >> # good: [1f24458a1071f006e3f7449c08ae0f12af493923] Merge tag 'tty-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty >> git bisect good 1f24458a1071f006e3f7449c08ae0f12af493923 >> # status: waiting for bad commit, 1 good commit known >> # bad: [2c40c1c6adab90ee4660caf03722b3a3ec67767b] Merge tag 'usb-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb >> git bisect bad 2c40c1c6adab90ee4660caf03722b3a3ec67767b >> # bad: [17d6b82d2d6d467149874b883cdba844844b996d] usb/usbip: fix wrong data added to platform device >> git bisect bad 17d6b82d2d6d467149874b883cdba844844b996d >> # good: [ba6b83a910b6d8a9379bda55cbf06cb945473a96] usb: xhci-mtk: add a bandwidth budget table >> git bisect good ba6b83a910b6d8a9379bda55cbf06cb945473a96 >> # good: [dddc00f255415b826190cfbaa5d6dbc87cd9ded1] Revert "usb: gadget: uvc: cleanup request when not in correct state" >> git bisect good dddc00f255415b826190cfbaa5d6dbc87cd9ded1 >> # bad: [8f999ce60ea3d47886b042ef1f22bb184b6e9c59] USB: typec: tps6598x: Refactor tps6598x port registration >> git bisect bad 8f999ce60ea3d47886b042ef1f22bb184b6e9c59 >> # bad: [f49449fbc21e7e9550a5203902d69c8ae7dfd918] usb: gadget: u_ether: Replace netif_stop_queue with netif_device_detach >> git bisect bad f49449fbc21e7e9550a5203902d69c8ae7dfd918 >> # good: [97475763484245916735a1aa9a3310a01d46b008] USB: usbip: fix stub_dev hub disconnect >> git bisect good 97475763484245916735a1aa9a3310a01d46b008 >> # good: [0f5aa1b01263b8b621bc4f031a1f2983ef8517b7] usb: usbtest: fix a type promotion bug >> git bisect good 0f5aa1b01263b8b621bc4f031a1f2983ef8517b7 >> # first bad commit: [f49449fbc21e7e9550a5203902d69c8ae7dfd918] usb: gadget: u_ether: Replace netif_stop_queue with netif_device_detach >> >> Note, revert indeed helps. Should I send a revert? >> >> I use configfs to setup USB EEM function and it worked till this commit. >> If needed, I can share my scripts, but I believe it's not needed as here >> we see a clear regression. >> >> -- >> With Best Regards, >> Andy Shevchenko >> >> > > Without this patch, there may be a potential crash in a race condition, as __LINK_STATE_PRESENT is monitored at many places in the Network stack to determine the status of the link. > > Could you please provide details on how this patch affects your functionality? Are you experiencing connection problems or data transfer interruptions? In my case on mrfld (Intel Edison Arduino) using configfs with this patch no config from host through dhcp is received. Manual setting correct ipv4 addr / mask / gw still no connection. > Instead of reverting this patch, consider trying the upcoming patch (soon to be available in the mainline) to see if it resolves your issue. > > https://lore.kernel.org/lkml/2023122900-commence-agenda-db2c@gregkh/T/#m36a812d3f1e5d744ee32381f6ae4185940b376de This patch works for me with v6.7.0. > Thanks, > Hardik
diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index 4bb0553da658..9d1c40c152d8 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -1200,7 +1200,7 @@ void gether_disconnect(struct gether *link) DBG(dev, "%s\n", __func__); - netif_stop_queue(dev->net); + netif_device_detach(dev->net); netif_carrier_off(dev->net); /* disable endpoints, forcing (synchronous) completion