From: Phil Dennis-Jordan <lists@philjordan.eu>
To: William Hooper <wsh@wshooper.org>
Cc: qemu-devel@nongnu.org, "Bin Meng" <bin.meng@windriver.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: Ping: [PATCH v2] net/vmnet: Pad short Ethernet frames
Date: Wed, 30 Oct 2024 13:49:57 +0100 [thread overview]
Message-ID: <CAGCz3vsusRSsT8-Fi3a2Z4aeQMtxCzDZ73D8ZgefxVZvm=qY6Q@mail.gmail.com> (raw)
In-Reply-To: <CANto9c5u+-Wg+XPxu4CCEE733MuXJbL35nWgTEPxk9y12PH7mA@mail.gmail.com>
On Sun, 20 Oct 2024 at 05:17, William Hooper <wsh@wshooper.org> wrote:
>
> On Sat, Aug 17, 2024 at 11:33 PM William Hooper <wsh@wshooper.org> wrote:
> > At least on macOS 12.7.2, vmnet doesn't pad Ethernet frames, such as the
> > host's ARP replies, to the minimum size (60 bytes before the frame check
> > sequence) defined in IEEE Std 802.3-2022, so guests' Ethernet device
> > drivers may drop them with "frame too short" errors.
> >
> > This patch calls eth_pad_short_frame() to add padding, as in net/tap.c
> > and net/slirp.c. Thanks to Bin Meng and Philippe Mathieu-Daudé for
> > reviewing an earlier version.
> >
> > Signed-off-by: William Hooper <wsh@wshooper.org>
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2058
> > ---
> > net/vmnet-common.m | 22 +++++++++++++++++++---
> > 1 file changed, 19 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/vmnet-common.m b/net/vmnet-common.m
> > index 30c4e53c13..bce1cc590d 100644
> > --- a/net/vmnet-common.m
> > +++ b/net/vmnet-common.m
> > @@ -18,6 +18,7 @@
> > #include "qemu/error-report.h"
> > #include "qapi/error.h"
> > #include "sysemu/runstate.h"
> > +#include "net/eth.h"
> >
> > #include <vmnet/vmnet.h>
> > #include <dispatch/dispatch.h>
> > @@ -147,10 +148,25 @@ static int vmnet_read_packets(VmnetState *s)
> > */
> > static void vmnet_write_packets_to_qemu(VmnetState *s)
> > {
> > + uint8_t *pkt;
> > + size_t pktsz;
> > + uint8_t min_pkt[ETH_ZLEN];
> > + size_t min_pktsz;
> > +
> > while (s->packets_send_current_pos < s->packets_send_end_pos) {
> > - ssize_t size = qemu_send_packet_async(&s->nc,
> > - s->iov_buf[s->packets_send_current_pos].iov_base,
> > - s->packets_buf[s->packets_send_current_pos].vm_pkt_size,
> > + pkt = s->iov_buf[s->packets_send_current_pos].iov_base;
> > + pktsz = s->packets_buf[s->packets_send_current_pos].vm_pkt_size;
> > +
> > + if (net_peer_needs_padding(&s->nc)) {
> > + min_pktsz = sizeof(min_pkt);
> > +
> > + if (eth_pad_short_frame(min_pkt, &min_pktsz, pkt, pktsz)) {
> > + pkt = min_pkt;
> > + pktsz = min_pktsz;
> > + }
> > + }
> > +
> > + ssize_t size = qemu_send_packet_async(&s->nc, pkt, pktsz,
> > vmnet_send_completed);
Nit: Move the declaration of 'size' up to the function header with the
rest of the variables for consistency.
Apart from that:
Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu>
> > if (size == 0) {
> > --
> > 2.37.1
>
> Ping?
>
next prev parent reply other threads:[~2024-10-30 12:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-06 22:35 [PATCH] net/vmnet: Pad short Ethernet frames William Hooper
2024-01-07 22:23 ` Bin Meng
2024-01-08 15:36 ` Philippe Mathieu-Daudé
2024-01-10 5:34 ` William Hooper
2024-08-18 6:33 ` [PATCH v2] " William Hooper
2024-10-20 3:16 ` Ping: " William Hooper
2024-10-30 12:49 ` Phil Dennis-Jordan [this message]
2024-11-02 20:56 ` [PATCH v3] " William Hooper
2024-11-17 2:08 ` Ping: " William Hooper
2024-12-30 21:05 ` Ping (2): " William Hooper
2024-12-31 17:42 ` Philippe Mathieu-Daudé
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='CAGCz3vsusRSsT8-Fi3a2Z4aeQMtxCzDZ73D8ZgefxVZvm=qY6Q@mail.gmail.com' \
--to=lists@philjordan.eu \
--cc=bin.meng@windriver.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=wsh@wshooper.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).