All of lore.kernel.org
 help / color / mirror / Atom feed
* Ethernet-over-usb with linux guest using USB Device Controller ?
@ 2021-04-26 16:48 Doug Evans
  2021-04-27  7:30 ` Gerd Hoffmann
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Evans @ 2021-04-26 16:48 UTC (permalink / raw)
  To: QEMU Developers; +Cc: kraxel

[-- Attachment #1: Type: text/plain, Size: 1282 bytes --]

Hi.

I'm working on a project where I want to have the linux qemu guest
communicate with another linux system via ethernet-over-usb (as far as the
guest is concerned, as it will be using a usb network gadget).
In this case the linux guest will be using a USB Device Controller (UDC) to
drive its side of the connection, and the protocol will be, IIUC, CDC-ECM.

The modeling would basically look like:

linux-guest <--> UDC-model <--> ?#1 <--> ?#2 <--> linux-host
|<-------------------- QEMU -------------->|

UDC-model will be working with CDC-ECM, but is there a use-case where we'd
want "?#1" to be libslirp and "?#2" to be the host's IP network? Another
use case is propagating CDC-ECM (or the USB packets in general) outside of
QEMU such that it can be fed directly into the USB of the host (or remote
host).

Questions: Is this support in QEMU and if so got any pointers to source for
existing examples?
If not, any guidance on how to proceed?

Of course we'd want this to not be a one-off. E.g., the code would be
partitioned such that the UDC-model-independent-support would be available
to other UDC models to use. Thus perhaps this falls under the scope of
things like this?
https://yhbt.net/lore/all/YFDo%2FoHikOEcXFcg@work-vm/
I'm new to all of this side of USB btw ...

[-- Attachment #2: Type: text/html, Size: 2549 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ethernet-over-usb with linux guest using USB Device Controller ?
  2021-04-26 16:48 Ethernet-over-usb with linux guest using USB Device Controller ? Doug Evans
@ 2021-04-27  7:30 ` Gerd Hoffmann
  2021-05-03 21:27   ` Doug Evans
  0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2021-04-27  7:30 UTC (permalink / raw)
  To: Doug Evans; +Cc: QEMU Developers

  Hi,

> Questions: Is this support in QEMU and if so got any pointers to source for
> existing examples?
> If not, any guidance on how to proceed?

qemu has only usb host controller emulation, not any usb device
controller emulation.  So you are entering new territory and there are
no existing code exsamples, sorry.

take care,
  Gerd



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ethernet-over-usb with linux guest using USB Device Controller ?
  2021-04-27  7:30 ` Gerd Hoffmann
@ 2021-05-03 21:27   ` Doug Evans
  2021-05-04  6:35     ` Gerd Hoffmann
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Evans @ 2021-05-03 21:27 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

On Tue, Apr 27, 2021 at 12:31 AM Gerd Hoffmann <kraxel@redhat.com> wrote:

>   Hi,
>
> > Questions: Is this support in QEMU and if so got any pointers to source
> for
> > existing examples?
> > If not, any guidance on how to proceed?
>
> qemu has only usb host controller emulation, not any usb device
> controller emulation.  So you are entering new territory and there are
> no existing code exsamples, sorry.
>


Thanks. Any suggestions on how you would do it? Even just high level design
points would be helpful.

As far as implementation goes:
1) Is there a "libusb" kinda thing for devices?
  [any sort of utility library that takes the device's point of view]
2) Would it make sense to use the usbredir protocol for speaking USB over
sockets?
  [where in this case QEMU is the device and not the host]
  ref: https://www.spice-space.org/usbredir.html
3) Would it make sense to use the parts that one can from the usbredir
library?
  [ibid]

[-- Attachment #2: Type: text/html, Size: 2082 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ethernet-over-usb with linux guest using USB Device Controller ?
  2021-05-03 21:27   ` Doug Evans
@ 2021-05-04  6:35     ` Gerd Hoffmann
  0 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2021-05-04  6:35 UTC (permalink / raw)
  To: Doug Evans; +Cc: QEMU Developers

On Mon, May 03, 2021 at 02:27:39PM -0700, Doug Evans wrote:
> On Tue, Apr 27, 2021 at 12:31 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
> 
> >   Hi,
> >
> > > Questions: Is this support in QEMU and if so got any pointers to source
> > for
> > > existing examples?
> > > If not, any guidance on how to proceed?
> >
> > qemu has only usb host controller emulation, not any usb device
> > controller emulation.  So you are entering new territory and there are
> > no existing code exsamples, sorry.
> >
> 
> 
> Thanks. Any suggestions on how you would do it? Even just high level design
> points would be helpful.
> 
> As far as implementation goes:
> 1) Is there a "libusb" kinda thing for devices?
>   [any sort of utility library that takes the device's point of view]

No clue, sorry.

> 2) Would it make sense to use the usbredir protocol for speaking USB over
> sockets?
>   [where in this case QEMU is the device and not the host]
>   ref: https://www.spice-space.org/usbredir.html

Depends on how you design this.  Running usbredir-over-vsock is clearly
one option, and it would for the most part take qemu out of the loop.
Drawback is that this wouldn't be transparent to the guest, the guest
would have to implement the usb device as usbredir server instead of
using the usual usb gadget interfaces which one would use on physical
hardware.

Another obvious option would be to implement a usb device controller in
qemu (either emulate existing hardware, or design something paravirtual,
probably using virtio).  Reusing existing software would be easier that
way.

take care,
  Gerd



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-04  7:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 16:48 Ethernet-over-usb with linux guest using USB Device Controller ? Doug Evans
2021-04-27  7:30 ` Gerd Hoffmann
2021-05-03 21:27   ` Doug Evans
2021-05-04  6:35     ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.