From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60578 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZmQZ-0004XX-Oc for qemu-devel@nongnu.org; Fri, 16 Jul 2010 11:02:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OZmQY-00084M-FF for qemu-devel@nongnu.org; Fri, 16 Jul 2010 11:02:15 -0400 Received: from mail-iw0-f173.google.com ([209.85.214.173]:58613) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OZmQY-00084B-9n for qemu-devel@nongnu.org; Fri, 16 Jul 2010 11:02:14 -0400 Received: by iwn6 with SMTP id 6so2307856iwn.4 for ; Fri, 16 Jul 2010 08:02:13 -0700 (PDT) Message-ID: <4C407470.7060403@codemonkey.ws> Date: Fri, 16 Jul 2010 10:02:08 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1279225380-28790-1-git-send-email-miguel.filho@gmail.com> In-Reply-To: <1279225380-28790-1-git-send-email-miguel.filho@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH RFC 0/4] Dumping traffic when using netdev devices List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Miguel Di Ciurcio Filho Cc: avi@redhat.com, jan.kiszka@web.de, qemu-devel@nongnu.org, armbru@redhat.com On 07/15/2010 03:22 PM, Miguel Di Ciurcio Filho wrote: > Hello, > > This is a prototype suggestion. I mostly copied and pasted the code from > net/dump.c into net.c and made some adjustments. There is no command line > parsing involved yet, just the internals and small changes in net/tap.c and > net/slirp.c do make the thing work. > > In my tests, using tap as backend, e1000 as a guest device and running iperf from > guest to host, the overhead of dumping the traffic caused a loss of around 30% > of performance. > > I opened the dumped files in wireshark and they looked fine. When using slirp > all requests were dumped fine too. > A less invasive way to do this would be to chain netdev devices. Basically: -netdev tap,fd=X,id=foo -netdev dump,file=foo.pcap,netdev=foo,id=bar -net nic,model=virtio,netdev=bar I think this has some clear advantages to this architecturally. From a user perspective, the only loss is that you have to add the dump device at startup (you can still enable/disable capture dynamically). Regards, Anthony Liguori > Bugs/limitations: > - I have no clue on how to deal with tap+vhost, is it necessary? > - When using virtio-net, I'm not sure how to handle iovec when vnet_hdr=on > - Create a function to add dump to a netdev on the fly, is it necessary? > - Handle cleanups > > Miguel Di Ciurcio Filho (4): > net/dump: Make pcap structures public > net: Introduce NetClientDump and auxiliary functions > net/tap: Suggested support for NetClientDump > net/slirp: Suggested support for NetClientDump > > net.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > net.h | 8 +++++ > net/dump.c | 21 ------------- > net/dump.h | 21 +++++++++++++ > net/slirp.c | 3 ++ > net/tap.c | 3 ++ > qemu-common.h | 1 + > 7 files changed, 126 insertions(+), 21 deletions(-) > >