From owner-freebsd-net@FreeBSD.ORG Mon Jan 5 12:19:47 2015 Return-Path: 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 0AF5424E for ; Mon, 5 Jan 2015 12:19:47 +0000 (UTC) Received: from mail-lb0-x234.google.com (mail-lb0-x234.google.com [IPv6:2a00:1450:4010:c04::234]) (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 7E9C464D37 for ; Mon, 5 Jan 2015 12:19:46 +0000 (UTC) Received: by mail-lb0-f180.google.com with SMTP id l4so17779065lbv.11 for ; Mon, 05 Jan 2015 04:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=BiyvOswKDXd7072Wyktz9T8FKwENMisV1f0ChHAg9Pc=; b=J8h1y8UFEc2+2yv9Q8HC9U8SW1u+w0BnKUs1oI3MrLLDCbtTq11B39RJnHlLTF7rEk 62lG5TfRTzU3GQPenBCPV7Y9RtQ16YpA1J5YNZr+HZ/3GcOQFU2q6q6bYTDztsqrec/c wTxKA0Ht3lrtcRtSFi+5eZEuYDgERRo+urEx8oT12mWIOyJTAL1p/cX/Aw6/AePfSocZ 4VLnSQHI1XsYnUD9qgdkNVKAhmGFjTEyatkibCSETRAHNNKLPBQ7DBzkgIFciDOiUKAC UtUHeoIXAt9fqAATd1jUB0QFVQKvz0VcuGzyd/5Q/3JeHuH4klVDVMVwZW/lXs1e+Y4V nt2g== MIME-Version: 1.0 X-Received: by 10.152.19.71 with SMTP id c7mr91830093lae.79.1420460384384; Mon, 05 Jan 2015 04:19:44 -0800 (PST) Sender: rizzo.unipi@gmail.com Received: by 10.114.10.168 with HTTP; Mon, 5 Jan 2015 04:19:44 -0800 (PST) In-Reply-To: References: Date: Mon, 5 Jan 2015 13:19:44 +0100 X-Google-Sender-Auth: Z68FiKdQPw8HVNgNO7PxRIlNuDk Message-ID: Subject: Re: netmap over virtio giving packets with extra 12 bytes From: Luigi Rizzo To: Avinash Sridharan Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: Vincenzo Maffione , "freebsd-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2015 12:19:47 -0000 What you see is a virtio issue. virtio prepends a 10 or 12-byte "virtio header" to all packets, which is used to define what sort of NIC accelerations (checksum, tso etc.) are expected on the link. I do not remember if there is a way in qemu-kvm to remove the header. Maybe Vincenzo (in Cc) remembers. cheers luigi On Mon, Jan 5, 2015 at 6:54 AM, Avinash Sridharan < avinash.sridharan@gmail.com> wrote: > I am using netmap with the click modular router, running the click-modular > router in user space. A while back I was using this combination with the > e1000 device driver, with a slightly older netmap code-base. > > Recently I updated my netmap code base and am trying to use the > click-modular router with netmap over a virtio-net device driver (over > KVM). With this combination, though I was able to receive packets I was > unable to interpret any packets coming from the FromDevice element. > > To debug this issue (and to negate any changes I made to the click-modular > router), I ran the pkt-gen application with the "dump payload" option: > > sudo ~/pkt-gen -i eth1 -f rx -X > > This showed that packets are being received correctly from the > netmap-enabled interface, but there are an extra "12" bytes appended to the > packet. > > 381.088570 main_thread [1446] 1 pps (1 pkts in 1001088 usec) > > ring 0x7f133bca6000 cur 1 [buf 516 flags 0x0000 len 72] > > 0: 00 00 00 00 00 00 00 00 00 00 01 00 01 80 c2 00 ................ << > extra 12 bytes > > 16: 00 00 40 16 7e 5b 50 f0 00 26 42 42 03 00 00 00 ..@.~[P..&BB.... > > 32: 00 00 80 00 40 16 7e 5b 50 f0 00 00 00 00 80 00 ....@.~[P....... > > 48: 40 16 7e 5b 50 f0 80 01 00 00 14 00 02 00 00 00 @.~[P........... > > 64: 00 00 00 00 bc 9b f6 74 > > > As we can see, the above is an STP BPDU, and there are 12 leading bytes in > the payload. > > > The extra leading bytes screw up the packet interpretation. > > > So is this is an artifact of the virtio-net driver or has something > changed in the netmap device driver? > > > Thanks, > > Avinash > -- -----------------------------------------+------------------------------- Prof. Luigi RIZZO, rizzo@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/ . Universita` di Pisa TEL +39-050-2211611 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -----------------------------------------+-------------------------------