[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/29] net/vmnet: Pad short Ethernet frames
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 28/29] net/vmnet: Pad short Ethernet frames |
Date: |
Tue, 31 Dec 2024 21:22:27 +0100 |
From: William Hooper <wsh@wshooper.org>
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, Philippe Mathieu-Daudé, and Phil
Dennis-Jordan for reviewing earlier versions.
Signed-off-by: William Hooper <wsh@wshooper.org>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2058
Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu>
Message-ID: <20241102205653.30476-1-wsh@wshooper.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
net/vmnet-common.m | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/net/vmnet-common.m b/net/vmnet-common.m
index dba5b5bab13..54d900ba679 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 "system/runstate.h"
+#include "net/eth.h"
#include <vmnet/vmnet.h>
#include <dispatch/dispatch.h>
@@ -147,10 +148,26 @@ 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;
+ ssize_t size;
+
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;
+ }
+ }
+
+ size = qemu_send_packet_async(&s->nc, pkt, pktsz,
vmnet_send_completed);
if (size == 0) {
--
2.47.1
- [PULL 18/29] hw/misc/vmcoreinfo: Rename opaque pointer as 'opaque', (continued)
- [PULL 18/29] hw/misc/vmcoreinfo: Rename opaque pointer as 'opaque', Philippe Mathieu-Daudé, 2024/12/31
- [PULL 19/29] hw/i386/amd_iommu: Simplify non-KVM checks on XTSup feature, Philippe Mathieu-Daudé, 2024/12/31
- [PULL 20/29] hw/block/virtio-blk: Replaces request free function with g_free, Philippe Mathieu-Daudé, 2024/12/31
- [PULL 22/29] hw/usb/hcd-xhci: Unimplemented/guest error logging for port MMIO, Philippe Mathieu-Daudé, 2024/12/31
- [PULL 21/29] hw/usb/hcd-xhci-pci: Move msi/msix properties from NEC to superclass, Philippe Mathieu-Daudé, 2024/12/31
- [PULL 23/29] ui & main loop: Redesign of system-specific main thread event handling, Philippe Mathieu-Daudé, 2024/12/31
- [PULL 24/29] hw/display/apple-gfx: Introduce ParavirtualizedGraphics.Framework support, Philippe Mathieu-Daudé, 2024/12/31
- [PULL 25/29] hw/display/apple-gfx: Adds PCI implementation, Philippe Mathieu-Daudé, 2024/12/31
- [PULL 26/29] hw/display/apple-gfx: Adds configurable mode list, Philippe Mathieu-Daudé, 2024/12/31
- [PULL 27/29] MAINTAINERS: Add myself as maintainer for apple-gfx, reviewer for HVF, Philippe Mathieu-Daudé, 2024/12/31
- [PULL 28/29] net/vmnet: Pad short Ethernet frames,
Philippe Mathieu-Daudé <=
- [PULL 29/29] hw/display/qxl: Do not use C99 // comments, Philippe Mathieu-Daudé, 2024/12/31