Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2299037lqb; Mon, 27 May 2024 15:09:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYg6ULNw+SwSAMb1DOsAJWtGVSjMnWQfteYSYJYrl1A+ervz1+R8TpE8exQbEIeBac8cCR8i1Z69pv+xpJqHT17yaMN0MsAckeAuAEnw== X-Google-Smtp-Source: AGHT+IFIRAwGlLHeKcHCTffTdrxz6if9AAx1CpshlsAVG14TrRT07APNJyAL/DQP1kKc/iPRaXNz X-Received: by 2002:a05:6214:43c4:b0:6ab:8a68:bb3e with SMTP id 6a1803df08f44-6abbbccc860mr125782756d6.32.1716847752199; Mon, 27 May 2024 15:09:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716847752; cv=pass; d=google.com; s=arc-20160816; b=JKQVKzs6cZMKGHDLQ4f010gcWBbCn2DlbKOuiBuOnSn1HPehE9hGr5wXGrdqlXJVyL SAolkLb3AI8BpbY16Zh2W659yp0huZEoH2H5hsx1Q6X5LhoEbubvw/Pe2YbA47Vg680G zCq4f2FeNK+aAe2RBOBlu64aDTcDXRY7oGysITIfZ56OgF+L4NMen2xWFltRo7CPxYlH 2EQEreKQfj1qtijkqKL4Rr2Q6eGsAh/aP57Ceom9DpvozJC8TzaIFkcA4gWuyxNRDww+ 2bcib7im6ii5Vx6xuZHU+44ydrSOcmlFYoJAWKr320hwuQxJDGNAxhAd1i11gvYTCZ/k DLyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from; bh=ucdv3Oh7KLe9IjQQVAVgJ2kZkypU0CwXLHfpsQxQHHk=; fh=BetTQ7+0tLsY0WaMandJDXWx8m/FwRdgmXujrYRFHMk=; b=hF5eno1u6DQMYwWXzYH/xmPoV6+mqiqjcDUqa9PwqniiOzdpSGUoMKuSE7IQNSzvZe nfmYLJFpq/ynAX/rAmNqCqsnNPF8tJqi+woZmwUAxd5mZoJ0fhNEdgQh1/m9R2CYS6cl 4lH26kpXM/TlIVlg7n46h8C22PldfKWVyyQwhxzHYI98dLVwp4XZGlujqH7YwML6hh/V Z12ZLUmem7Y43ws5q90DuqOarl3Amml/Y7dTtK6Qp2x0PfABzFd+fLBLLE3Fdm08GL3Z kNtpUkj1HMCVp64LJur9fkcPcKFRo6iKsTcg1a387lux2QBFXnzKfizNUktrWTHO/4ai OKCQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-191473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191473-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac16286ac4si89826366d6.423.2024.05.27.15.09.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 15:09:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191473-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; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-191473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191473-linux.lists.archive=gmail.com@vger.kernel.org" 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 CCEC01C210E1 for ; Mon, 27 May 2024 22:09:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 995B4167D99; Mon, 27 May 2024 22:08:53 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74025167270 for ; Mon, 27 May 2024 22:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716847732; cv=none; b=NTLcolmmCIXUnW1hs/diT4uBgTnQZUr0h46fbwZGZGmcQc1ecaqZtten2QfGwkKBUxLuQ1oxT7EyMAmNnMRjZkKTK7vEWH+shTKXn0JHS5HwwYAhB0dh/XC9gDgw44ttXrOJlfWzFqrlctkA5NG+BP+UvUNXdU6LK7y4Fm1TP2c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716847732; c=relaxed/simple; bh=H6U+eWUQikfOYCkQKk4sxdqm4T/OqhmsooC1md3a7JY=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=B2aGZUJAcagxLK/EEJAtVIdvHEiflQmV/lGvr7E+KdrXBaiCe6gaxw+SiWfODd+ySo8cEiPTUxyVr4q+mPS1kZgj5cpRHjYYQudeIDFTQ3X/2pTZYk97/Stwpq6c6vpb5xKFdqkKlhCo/PrqCOn9JtDUd/B/MulXa85EzoucIRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sBiWH-0003jX-OH; Tue, 28 May 2024 00:08:41 +0200 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sBiWE-003FHD-OY; Tue, 28 May 2024 00:08:38 +0200 Received: from localhost ([::1] helo=dude04.red.stw.pengutronix.de) by dude04.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sBiWF-007MAH-0Y; Tue, 28 May 2024 00:08:38 +0200 From: Michael Grzeschik Subject: [PATCH v5 0/3] usb: gadget: 9pfs transport Date: Tue, 28 May 2024 00:08:35 +0200 Message-Id: <20240116-ml-topic-u9p-v5-0-5ed0abd53ef5@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAGQEVWYC/33PzY6DIBQF4FdpWJcpXJBKV32PSRf8XCuJogFrO ml896LbaV0ecu53wotkTAEzuRxeJOEcchhiCdXxQFxr4h1p8CUTYCAZ54r2HZ2GMTj60COtdQV nWQmGlpNyYk1GapOJrl2P+q7vTlv7VNprYUzYhOe293sruQ15GtLfNj/z9fXL0swpo8bXTjDVa CPxOmK8P6Y0xPD88UhWbYY9AYpgpXK2qTRoBR8FsSeIIjgFRih0zhv+UZB7gizCGQA91JYZ//8 Xy7K8AZ/2jJqUAQAA To: Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , Jonathan Corbet , Greg Kroah-Hartman Cc: v9fs@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, kernel@pengutronix.de, Michael Grzeschik , Jan Luebbe X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4742; i=m.grzeschik@pengutronix.de; h=from:subject:message-id; bh=H6U+eWUQikfOYCkQKk4sxdqm4T/OqhmsooC1md3a7JY=; b=owEBbQKS/ZANAwAKAb9pWET5cfSrAcsmYgBmVQRlrFD/Ithlu3ZmZKyMifhKrn0B0MTWVSOTA 2Mdb6WRvhCJAjMEAAEKAB0WIQQV2+2Fpbqd6fvv0Gi/aVhE+XH0qwUCZlUEZQAKCRC/aVhE+XH0 q5XiEACxtsWRVQSsnHfHg45OzYdHkH3rkcLmWBAppGtOicjFSJN5jbgrI5mGzGhJKVyigwtIzuM JKzJlzL196kF/FQmaW0MW7YAYrnxTa5HiSoJBdDDNl8Pdtb8CcR7bQ8L7rNPe9hWcgSVN+C/zF1 aZlg/qfrhHZDOgFbwUrGv07Kv1v8QrWW1KBsW7lN/DaXjH+obRSthtRelqJOldQ0NdeDmDNC0t6 pufQ5FyVtRN0EM+66wRPolXs5pt6gfEUSYEggkfMwukAZpdcTdHkxMPkDxpdVNqftCL9WtSgM02 dhMvqUPyGbNIig9m9EURjuqFNqCF7Un8AiPnCF2I6hn75H6OU9VKuAexgMetViFRvuhaADFH4Xa Sw+SBp5HVlKdEBF3EsCmXp/NVOeJWWcUQhjM8faOXDaO1W7cJ6+/fdYI+QF4XmmupRTSScB+elo 36gVEQQhtJjtIrC9rg2LRIPDpkACi+tR9No0JQeL7xz3w8hxARwYrIu33npkQtVkiH1cplBk5GQ 4zMIqM0B0UtM5KIy1TSd3hx3uxtGabIDhmoIR5tZO/9oxt+8VoRThGhXFgRPuVVLwO0wArWidr4 F7iEBlWSUiz4rbASmcU7ZhbZ++WDrrrC0TQeVn4mJZzcc0Wl/3D/1ZfxFvPkTzeVX2LBCZSk8oM hR2cguQUY1nIlPQ== X-Developer-Key: i=m.grzeschik@pengutronix.de; a=openpgp; fpr=957BC452CE953D7EA60CF4FC0BE9E3157A1E2C64 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: m.grzeschik@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org This series is adding support to mount usb hostside exported 9pfs filesystems via the usb gadget interface. It also includes a simple tool (p9_fwd.py) to translate an tcp 9pfs transport and reuse it via the usb interface. +--------------------------+ | +--------------------------+ | 9PFS mounting client | | | 9PFS exporting server | SW | | | | | | (this:trans_usbg) | | |(e.g. diod or nfs-ganesha)| +-------------^------------+ | +-------------^------------+ | | | | | +------v------+ | | | p9_fwd.py | | | +------^------+ | | | ------------------|------------------------------------|------------- | | | +-------------v------------+ | +-------------v------------+ | | | | | HW | USB Device Controller <---------> USB Host Controller | | | | | | +--------------------------+ | +--------------------------+ The USB host exports a filesystem, while the gadget on the USB device side makes it mountable. Diod (9pfs server) and the forwarder are on the development host, where the root filesystem is actually stored. The gadget is initialized during boot (or later) on the embedded board. Then the forwarder will find it on the USB bus and start forwarding requests. In this case the 9p requests come from the device and are handled by the host. The reason is that USB device ports are normally not available on PCs, so a connection in the other direction would not work. One use-case is to use it as an alternative to NFS root booting during the development of embedded Linux devices. Signed-off-by: Michael Grzeschik --- Changes in v5: - fixed lockup in mount -> remount -> monut scenario - improved p9_fwd transport script with more options - Link to v4: https://lore.kernel.org/r/20240116-ml-topic-u9p-v4-0-722ed28b0ade@pengutronix.de Changes in v4: - reworked the naming scheme to be set by the configfs instance - added conn_cancel function to properly stop the transfers - ensured that umount -f will work even when the host side has crahed - added all the review feedback from Andrzej Pietrasiewicz - Link to v3: https://lore.kernel.org/r/20240116-ml-topic-u9p-v3-0-c62a36eccda1@pengutronix.de Changes in v3: - dropped patch "usb: gadget: legacy: add 9pfs multi gadget" as discussed with gregkh - Link to v2: https://lore.kernel.org/r/20240116-ml-topic-u9p-v2-0-b46cbf592962@pengutronix.de Changes in v2: - improved the commit messages - introduced an patch to move the header u_f.h to include/linux/usb to compile usb gadget functions treewide - moved usbg gadget function to net/9p/ - adderessed several comments in function driver, like the cleanup path and kbuild errors - improved the documentation in Documentation/filesystems/9p.rst - Link to v1: https://lore.kernel.org/r/20240116-ml-topic-u9p-v1-0-ad8c306f9a4e@pengutronix.de --- Michael Grzeschik (3): usb: gadget: function: move u_f.h to include/linux/usb/func_utils.h net/9p/usbg: Add new usb gadget function transport tools: usb: p9_fwd: add usb gadget packet forwarder script Documentation/filesystems/9p.rst | 58 +- drivers/usb/gadget/configfs.c | 2 +- drivers/usb/gadget/function/f_fs.c | 2 +- drivers/usb/gadget/function/f_hid.c | 2 +- drivers/usb/gadget/function/f_loopback.c | 2 +- drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/function/f_midi2.c | 2 +- drivers/usb/gadget/function/f_sourcesink.c | 2 +- drivers/usb/gadget/u_f.c | 2 +- .../gadget/u_f.h => include/linux/usb/func_utils.h | 2 +- net/9p/Kconfig | 6 + net/9p/Makefile | 4 + net/9p/trans_usbg.c | 974 +++++++++++++++++++++ tools/usb/p9_fwd.py | 243 +++++ 14 files changed, 1293 insertions(+), 10 deletions(-) --- base-commit: 2bfcfd584ff5ccc8bb7acde19b42570414bf880b change-id: 20240116-ml-topic-u9p-895274530eb1 Best regards, -- Michael Grzeschik