Message ID | 20240116-ml-topic-u9p-v3-0-c62a36eccda1@pengutronix.de (mailing list archive) |
---|---|
Headers | show |
Series | usb: gadget: 9pfs transport | expand |
Hi Michael, W dniu 26.02.2024 o 14:56, Michael Grzeschik pisze: > 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 <m.grzeschik@pengutronix.de> > --- > Changes in v3: > - dropped patch "usb: gadget: legacy: add 9pfs multi gadget" as discussed with gregkh I will give the dropped patch a try to see how it works, as it should work the same way regardless of how the gadget is composed, legacy or configfs. Speaking of the latter, IMO there _are_ valid usecases other than having 9pfs rootfs, so configfs support should be there. If you intend to send the patches adding configfs support then kindly Cc me and I will test and review it for you. Regards, Andrzej > - 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/ > net/9p/usbg: Add new usb gadget function transport > tools: usb: p9_fwd: add usb gadget packet forwarder script > > Documentation/filesystems/9p.rst | 47 ++ > 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 +- > {drivers/usb/gadget => include/linux/usb}/u_f.h | 0 > net/9p/Kconfig | 6 + > net/9p/Makefile | 4 + > net/9p/trans_usbg.c | 871 ++++++++++++++++++++++++ > tools/usb/p9_fwd.py | 194 ++++++ > 14 files changed, 1130 insertions(+), 8 deletions(-) > --- > base-commit: 41bccc98fb7931d63d03f326a746ac4d429c1dd3 > change-id: 20240116-ml-topic-u9p-895274530eb1 > > Best regards,
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 <m.grzeschik@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/ net/9p/usbg: Add new usb gadget function transport tools: usb: p9_fwd: add usb gadget packet forwarder script Documentation/filesystems/9p.rst | 47 ++ 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 +- {drivers/usb/gadget => include/linux/usb}/u_f.h | 0 net/9p/Kconfig | 6 + net/9p/Makefile | 4 + net/9p/trans_usbg.c | 871 ++++++++++++++++++++++++ tools/usb/p9_fwd.py | 194 ++++++ 14 files changed, 1130 insertions(+), 8 deletions(-) --- base-commit: 41bccc98fb7931d63d03f326a746ac4d429c1dd3 change-id: 20240116-ml-topic-u9p-895274530eb1 Best regards,