qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] using -net dump with tap networking


From: Laszlo Ersek
Subject: Re: [Qemu-devel] using -net dump with tap networking
Date: Wed, 13 Feb 2013 19:02:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130108 Thunderbird/10.0.12

On 02/13/13 15:48, Alexey Kardashevskiy wrote:
> Hi!
>
> I am running qemu as:
>
> qemu/ppc64-softmmu/qemu-system-ppc64 -m 1024 -M pseries -trace
> events=trace_events -netdev user,id=virtnet,hostfwd=tcp::5000-:22
> -device virtio-net-pci,netdev=virtnet -nographic -vga none -enable-kvm
> -kernel vml36_64k -initrd 1.cpio
>
> Now I want to enable network dump. With the old "-net" syntax I could do
> that with "-net dump" but I cannot with the new syntax, tried many
> variants, none works. What would the correct syntax be for the case above?

Ugh, I'm a bit confused, but if I say something stupid that should still
help "ignite" the discussion.

So, in general there are two ways to specify this:

(1) -net dump,id=dump0,vlan=VLAN_ID,len=SIZE_LIMIT,file=PATHNAME

(2) -netdev dump,id=dump0,len=SIZE_LIMIT,file=PATHNAME

I believe the first option (legacy) should work.

The second one will not work; actually I think it will trigger an
assert. The generic init code in net_client_init1() [net/net.c] says:

        NetClientState *peer = NULL;

        /* Do not add to a vlan if it's a -netdev or a nic with a netdev=
         * parameter. */
        if (!is_netdev &&
            (opts->kind != NET_CLIENT_OPTIONS_KIND_NIC ||
             !opts->nic->has_netdev)) {
            peer = net_hub_add_port(u.net->has_vlan ? u.net->vlan : 0, NULL);
        }

        if (net_client_init_fun[opts->kind](opts, name, peer) < 0) {

So in (2) we don't add the dump netdev to any hub/vlan; however the
specific code (net_init_dump(), [net/dump.c]) asserts (peer != NULL).

Otherwise I think the idea would be to add the dump netdev *afterwards*
to a vlan/hub, by changing its vlan property. See set_vlan() in
[hw/qdev-properties-system.c]; it calls net_hub_port_find() [net/hub.c]
whose task is to "Find a available port on a hub; otherwise create one
new port".

See
<http://lists.nongnu.org/archive/html/qemu-devel/2012-07/msg03182.html>.

Hence I think you're back to (1), the legacy format. Assuming qemu
doesn't barf on that option immediately, I believe you *also* have to
add your "-netdev user" to the same hub as the dumper is on.

In total you have to create both netdevs (a, b) and assign both to a
common hub/vlan (c, d). Again, unfortunately the dump netdev only works
with the legacy format, but that already includes the assignment to the
hub (a, c). So you have to take care of creating the other netdev
(-netdev user, b), and assign it through its vlan qdev property to the
same hub (d), so that data can flow from it to the dump netdev.

Hm... Looks like you can't do that directly on "-netdev user" (it seems
to have no such property). "virtio-net-pci" does have it however. At
least in a quick "info qtree" check:

bus: main-system-bus
  type System
  dev: i440FX-pcihost, id ""
    bus: pci.0
      type PCI
      dev: virtio-net-pci, id "net0"
        dev-prop: vlan = <null>

Also confirmed by "qemu-system-x86_64 -device virtio-net-pci,help".

So

-netdev user,id=virtnet,hostfwd=tcp::5000-:22 \
-device virtio-net-pci,netdev=virtnet,vlan=2 \
-net dump,vlan=2,len=SIZE_LIMIT,file=PATHNAME

Or some such...

Laszlo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]