qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 4/5] Adding packet abstraction for VMWARE net


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v9 4/5] Adding packet abstraction for VMWARE network devices
Date: Wed, 16 Jan 2013 15:48:00 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>
> + * Tamir Shomer <address@hidden>
> + * Yan Vugenfirer <address@hidden>
> + *
> + * 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.



reply via email to

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