From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvUHh-0008M8-Mn for qemu-devel@nongnu.org; Wed, 16 Jan 2013 09:48:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvUHc-00058S-Ip for qemu-devel@nongnu.org; Wed, 16 Jan 2013 09:48:09 -0500 Received: from mail-wi0-f175.google.com ([209.85.212.175]:43994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvUHc-00058D-Cb for qemu-devel@nongnu.org; Wed, 16 Jan 2013 09:48:04 -0500 Received: by mail-wi0-f175.google.com with SMTP id hm11so3521568wib.14 for ; Wed, 16 Jan 2013 06:48:03 -0800 (PST) Date: Wed, 16 Jan 2013 15:48:00 +0100 From: Stefan Hajnoczi Message-ID: <20130116144800.GB9679@stefanha-thinkpad.redhat.com> References: <1358006986-7248-1-git-send-email-dmitry@daynix.com> <1358006986-7248-5-git-send-email-dmitry@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1358006986-7248-5-git-send-email-dmitry@daynix.com> Subject: Re: [Qemu-devel] [PATCH v9 4/5] Adding packet abstraction for VMWARE network devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dmitry Fleytman Cc: Yan Vugenfirer , Gerhard Wiesinger , qemu-devel@nongnu.org, Anthony Liguori , Paolo Bonzini On Sat, Jan 12, 2013 at 06:09:45PM +0200, Dmitry Fleytman wrote: > --- > hw/vmxnet_rx_pkt.c | 187 ++++++++++++++++++ > hw/vmxnet_rx_pkt.h | 173 ++++++++++++++++ > hw/vmxnet_tx_pkt.c | 567 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > hw/vmxnet_tx_pkt.h | 148 ++++++++++++++ > 4 files changed, 1075 insertions(+) > create mode 100644 hw/vmxnet_rx_pkt.c > create mode 100644 hw/vmxnet_rx_pkt.h > create mode 100644 hw/vmxnet_tx_pkt.c > create mode 100644 hw/vmxnet_tx_pkt.h There are other VMware-specific hw/ files. Please create hw/vmware/ and put source files in there without the prefix. Check hw/pci/ or other subdirectories for how to setup Makefile.objs, it's pretty simple. > diff --git a/hw/vmxnet_rx_pkt.c b/hw/vmxnet_rx_pkt.c > new file mode 100644 > index 0000000..947042a > --- /dev/null > +++ b/hw/vmxnet_rx_pkt.c > @@ -0,0 +1,187 @@ > +/* > + * QEMU VMWARE VMXNET* paravirtual NICs - RX packets abstractions > + * > + * Copyright (c) 2012 Ravello Systems LTD (http://ravellosystems.com) > + * > + * Developed by Daynix Computing LTD (http://www.daynix.com) > + * > + * Authors: > + * Dmitry Fleytman > + * Tamir Shomer > + * Yan Vugenfirer > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or later. > + * See the COPYING file in the top-level directory. > + * > + */ > + > +#include "vmxnet_rx_pkt.h" > +#include "qemu/eth.h" > +#include "qemu-common.h" > +#include "qemu/iov.h" > +#include "net/checksum.h" > +#include "net/tap.h" > + > +/* > + * RX packet may contain up to 2 fragments - rebuilt eth header > + * in case of VLAN tag stripping > + * and payload received from QEMU - in any case > + */ > +#define VMXNET_MAX_RX_PACKET_FRAGMENTS (2) > + > +struct VmxnetRxPkt{ > + struct virtio_net_hdr virt_hdr; > + uint8_t ehdr_buf[ETH_MAX_L2_HDR_LEN]; > + struct iovec vec[VMXNET_MAX_RX_PACKET_FRAGMENTS]; > + uint16_t vec_len; > + uint32_t tot_len; > + uint16_t tci; > + bool vlan_stripped; > + bool has_virt_hdr; > + eth_pkt_types_e packet_type; > + > + /* Analysis results */ > + bool isip4; > + bool isip6; > + bool isudp; > + bool istcp; > +}; > + > +void vmxnet_rx_pkt_init(struct VmxnetRxPkt **pkt, bool has_virt_hdr) > +{ > + struct VmxnetRxPkt *p = g_malloc0(sizeof *p); > + p->has_virt_hdr = has_virt_hdr; > + *pkt = p; > +} > + > +void vmxnet_rx_pkt_uninit(struct VmxnetRxPkt *pkt) > +{ > + g_free(pkt); 4-space indentation please.