All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Draper <ben@xrsa.net>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Ben Draper <ben@xrsa.net>, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] vmxnet3: Pad short frames to minimum size (60 bytes)
Date: Fri, 22 Aug 2014 11:23:02 +0100	[thread overview]
Message-ID: <CAGNXWDMV-zHmN+dgyJmc53cx_W_WPBQmbudMxChrXoXtnYzKnQ@mail.gmail.com> (raw)
In-Reply-To: <1408537634-3812-1-git-send-email-ben@xrsa.net>

[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]

Interestingly this does not appear to affect Windows guests on the same
host/bridge as the ESXi guest, as
Windows pads the frames before sending them out. However it does affect
Linux guests on the same host/bridge
from communicating with the ESXi guest itself and the guests ESXi hosts.


--

*View My LinkedIn Profile*

http://uk.linkedin.com/in/bendraper00


On 20 August 2014 13:27, Ben Draper <ben@xrsa.net> wrote:

> When running VMware ESXi under qemu-kvm the guest discards frames
> that are too short. Short ARP Requests will be dropped, this prevents
> guests on the same bridge as VMware ESXi from communicating. This patch
> simply adds the padding on the network device itself.
>
> Signed-off-by: Ben Draper <ben@xrsa.net>
> ---
>  hw/net/vmxnet3.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
> index 791321f..f246fa1 100644
> --- a/hw/net/vmxnet3.c
> +++ b/hw/net/vmxnet3.c
> @@ -34,6 +34,7 @@
>
>  #define PCI_DEVICE_ID_VMWARE_VMXNET3_REVISION 0x1
>  #define VMXNET3_MSIX_BAR_SIZE 0x2000
> +#define MIN_BUF_SIZE 60
>
>  #define VMXNET3_BAR0_IDX      (0)
>  #define VMXNET3_BAR1_IDX      (1)
> @@ -1871,12 +1872,21 @@ vmxnet3_receive(NetClientState *nc, const uint8_t
> *buf, size_t size)
>  {
>      VMXNET3State *s = qemu_get_nic_opaque(nc);
>      size_t bytes_indicated;
> +    uint8_t min_buf[MIN_BUF_SIZE];
>
>      if (!vmxnet3_can_receive(nc)) {
>          VMW_PKPRN("Cannot receive now");
>          return -1;
>      }
>
> +    /* Pad to minimum Ethernet frame length */
> +    if (size < sizeof(min_buf)) {
> +        memcpy(min_buf, buf, size);
> +        memset(&min_buf[size], 0, sizeof(min_buf) - size);
> +        buf = min_buf;
> +        size = sizeof(min_buf);
> +    }
> +
>      if (s->peer_has_vhdr) {
>          vmxnet_rx_pkt_set_vhdr(s->rx_pkt, (struct virtio_net_hdr *)buf);
>          buf += sizeof(struct virtio_net_hdr);
> --
> 1.7.10.4
>
>

[-- Attachment #2: Type: text/html, Size: 2798 bytes --]

  reply	other threads:[~2014-08-22 10:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 12:27 [Qemu-devel] [PATCH] vmxnet3: Pad short frames to minimum size (60 bytes) Ben Draper
2014-08-22 10:23 ` Ben Draper [this message]
2014-08-24 12:06 ` Michael Tokarev
2014-08-24 12:28   ` Dmitry Fleytman
2014-08-24 13:10     ` Michael Tokarev
2014-08-24 13:27       ` Dmitry Fleytman
2014-08-25  7:41         ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGNXWDMV-zHmN+dgyJmc53cx_W_WPBQmbudMxChrXoXtnYzKnQ@mail.gmail.com \
    --to=ben@xrsa.net \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.