From owner-freebsd-net@FreeBSD.ORG  Mon Jan  5 17:24:40 2015
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: net@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 18DF7F7A;
 Mon,  5 Jan 2015 17:24:40 +0000 (UTC)
Received: from mail-qc0-x22a.google.com (mail-qc0-x22a.google.com
 [IPv6:2607:f8b0:400d:c01::22a])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id C1B9D3448;
 Mon,  5 Jan 2015 17:24:39 +0000 (UTC)
Received: by mail-qc0-f170.google.com with SMTP id x3so15797211qcv.1;
 Mon, 05 Jan 2015 09:24:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :cc:content-type;
 bh=tGn0eqXokYQ3VloU40/JdqF4Lqt7MvzUlJ4uJncqFEU=;
 b=jA2ynq8YglO+2EraRdE03H7SPyacCCUyJyjG3PN7+U1ZpDplnmSfbKLIVF3/76AOQW
 D93ppUe/8nHwvS6mx463TdWZKIDrUl6F5lC79WXUijex9gOLfQhwc0cY1epLDwLP3tz4
 mGu+JauJiCgP2p35N6hQkw2NBo7paZn6EB2kIb6/ggMfMMwqNc+z9JyYgvecUSGvTISH
 XA/uLKlpjhlPppcqzAbyT5Cg1uLtMs+j6V6SXnzjivSO3yn8Cnh9RiQ4vuW+iCqxNTbH
 41x4W9gbgAsY+xx0/NPk2qLJQL7llkB1dQrk5QHvnKqshNo5JdVlWNY65OOGsEWMAF8k
 RpgA==
MIME-Version: 1.0
X-Received: by 10.140.95.71 with SMTP id h65mr75218570qge.92.1420478678950;
 Mon, 05 Jan 2015 09:24:38 -0800 (PST)
Received: by 10.96.76.201 with HTTP; Mon, 5 Jan 2015 09:24:38 -0800 (PST)
In-Reply-To: <20150105170530.GB22916@onelab2.iet.unipi.it>
References: <CADJyuDg-PujV+tknoSBi3fDd3+K+Owvjgwh1+=Z-eoBUkP2gPg@mail.gmail.com>
 <CA+hQ2+gRz0Q-f5N-C_CrC27qE1i-zSvb3rjWDH0JPCq4Q1+A8A@mail.gmail.com>
 <CAJ-VmonqqMedqnAwHfq+TSAEKwdSdxXfRpkmuTm2eLrB_uCV2w@mail.gmail.com>
 <20150105170530.GB22916@onelab2.iet.unipi.it>
Date: Mon, 5 Jan 2015 09:24:38 -0800
Message-ID: <CADJyuDjLn6Lu12=gozbGoWxYwzYcmRVAnEQSMQqMe5Yo0AFMpQ@mail.gmail.com>
Subject: Re: netmap over virtio giving packets with extra 12 bytes
From: Avinash Sridharan <avinash.sridharan@gmail.com>
To: Luigi Rizzo <rizzo@iet.unipi.it>
Content-Type: text/plain; charset=UTF-8
X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1
Cc: Adrian Chadd <adrian@freebsd.org>, Vincenzo Maffione <v.maffione@gmail.com>,
 "freebsd-net@freebsd.org" <net@freebsd.org>
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net/>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Jan 2015 17:24:40 -0000

I used virsh to start the VM over qemu-kvm. Here is a dump of the network
XML that was fed to libvirt, while creating the domain:

<interface type='bridge'>

      <mac address='52:54:00:0f:8f:af'/>

      <source bridge='br0'/>

      <target dev='vnet3'/>

      <model type='virtio'/>

      <alias name='net0'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
function='0x0'/>

    </interface>

    <interface type='bridge'>

      <mac address='52:54:00:0f:8f:bf'/>

      <source bridge='br0'/>

      <target dev='vnet4'/>

      <model type='virtio'/>

      <alias name='net1'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x0'/>

    </interface>


The network backend is a bridge interface running over gentoo. The bridge
has a single port, which is a realtek r8169 NIC.


I didn't quite understand the question about using "virtio in native or
emulated netmap mode "?

While running the above experiment I just replaced the virtio-net drivers
with the netmap enabled virtio-net drivers.


*asridharan@stitch-dp-1** ~/stitch-click/kernel $* lsmod

Module                  Size  Used by

virtio_net             24612  0

netmap                 95166  1 virtio_net

mii                     3875  0


*asridharan@stitch-dp-1** ~/stitch-click/kernel $* modinfo ./virtio_net.ko

filename:       /home/asridharan/stitch-click/kernel/./virtio_net.ko

license:        GPL

description:    Virtio network driver

alias:          virtio:d00000001v*

depends:        netmap

vermagic:       3.14.14-gentoo SMP mod_unload

parm:           napi_weight:int

parm:           csum:bool

parm:           gso:bool


*asridharan@stitch-dp-1** ~/stitch-click/kernel $* modinfo ./netmap.ko

filename:       /home/asridharan/stitch-click/kernel/./netmap.ko

license:        Dual BSD/GPL

description:    The netmap packet I/O framework

author:         http://info.iet.unipi.it/~luigi/netmap/

depends:

vermagic:       3.14.14-gentoo SMP mod_unload

parm:           verbose:int

parm:           no_timestamp:int

parm:           mitigate:int

parm:           no_pendintr:int

parm:           txsync_retry:int

parm:           adaptive_io:int

parm:           flags:int

parm:           fwd:int

parm:           mmap_unreg:int

parm:           admode:int

parm:           generic_mit:int

parm:           generic_ringsize:int

parm:           generic_rings:int

parm:           default_pipes:int

parm:           bridge_batch:int

parm:           if_size:int

parm:           if_curr_size:int

parm:           if_num:int

parm:           if_curr_num:int

parm:           priv_if_size:int

parm:           priv_if_num:int

parm:           ring_size:int

parm:           ring_curr_size:int

parm:           ring_num:int

parm:           ring_curr_num:int

parm:           priv_ring_size:int

parm:           priv_ring_num:int

parm:           buf_size:int

parm:           buf_curr_size:int

parm:           buf_num:int

parm:           buf_curr_num:int

parm:           priv_buf_size:int

parm:           priv_buf_num:int


Please ping me if I haven't given enough data.


Thanks,

Avinash

On Mon, Jan 5, 2015 at 9:05 AM, Luigi Rizzo <rizzo@iet.unipi.it> wrote:

> On Mon, Jan 05, 2015 at 08:33:17AM -0800, Adrian Chadd wrote:
> > ... surely virtio should be skipping over those bytes in the netmap rx
> > side before handing them up?
> >
> > (It won't be the only hardware that puts the RX descriptor status in
> > the RX frame itself..)
>
> it is not the rx descriptor, those 12 bytes are also present on the tx
> side.
> Think of them as an encapsulation whose presence is negotiated when KVM
> connects
> to the TAP port, and after that is present on all packets bidirectionally.
>
> Now, surely we could add/remove those bytes in the virtio-netmap code
> (at the price of an additional data copy).
>
> I need to investigate further.
> Avinash, could you tell us exactly your configuration -- what is the
> network backend for QEMU/KVM, and whether you are using virtio in
> native or emulated netmap mode ?
>
> cheers
> luigi
>