Received: by 2002:a05:7412:8d06:b0:f9:332d:97f1 with SMTP id bj6csp54848rdb; Mon, 18 Dec 2023 08:45:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAo3gwlV16iNHVvEvDE60wJe6sK/Gz5e9KZKdhd6cOUL0G3Fu8lg6YIY/p4yrUr1z3KXa0 X-Received: by 2002:a05:622a:1455:b0:425:74e5:6dbf with SMTP id v21-20020a05622a145500b0042574e56dbfmr22768345qtx.67.1702917955503; Mon, 18 Dec 2023 08:45:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702917955; cv=none; d=google.com; s=arc-20160816; b=eGPUCdLh0J4XhIEXGLOLD8f2fWxZhy5UXYn7uQScVBfsyDhnSLjE13WHzkYEPUn+R8 UKLtEqi7hyTIIB6zlOLfhdka91dl4qNnGCsMs1+R1BWs8uQk5Bugx5SRDwvgc7rFwHx9 6eUkQ9MUFHGHMOwXKKDMY9sFAaqY7bqBSgSuSDCnQfP2QCHlr9gsNBbHspUS7uNVuCAB 1dCkp/lN0cUXbFBExYCSne1XcWqqt9vOpsr8TrZNR8Tetf1PxbI7Hp/CgzUfrz+IOfnK WjergOwMp5yOsJIYyBGnDi8bP0DObhwKRZ+GRM1YRaFTCKLz6pPp86c4e3+HpYE5JF5f LfMw== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4086-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fw7-20020a05622a4a8700b004254ed7c183si25323079qtb.227.2023.12.18.08.45.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 08:45:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4086-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4086-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 453C31C22615 for ; Mon, 18 Dec 2023 16:45:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 748FB498B4; Mon, 18 Dec 2023 16:45:47 +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 To: Greg Kroah-Hartman , Hardik Gajjar , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Richard Acayan 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: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- 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