We can remove the short-frame padding code from the net backends that were previously doing it, because the qemu_send_packet and qemu_sendv_packet calls they use now do the padding for them.
Signed-off-by: Peter Maydell <[email protected]> --- net/slirp.c | 9 --------- net/tap-win32.c | 15 ++------------- net/tap.c | 9 --------- net/vmnet-common.m | 11 ----------- 4 files changed, 2 insertions(+), 42 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 451c0fd1ba4..eea12e79816 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -120,15 +120,6 @@ static ssize_t net_slirp_send_packet(const void *pkt, size_t pkt_len, void *opaque) { SlirpState *s = opaque; - uint8_t min_pkt[ETH_ZLEN]; - size_t min_pktsz = sizeof(min_pkt); - - if (net_peer_needs_padding(&s->nc)) { - if (eth_pad_short_frame(min_pkt, &min_pktsz, pkt, pkt_len)) { - pkt = min_pkt; - pkt_len = min_pktsz; - } - } return qemu_send_packet(&s->nc, pkt, pkt_len); } diff --git a/net/tap-win32.c b/net/tap-win32.c index 38baf90e0b3..2fccfdbaacf 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -682,25 +682,14 @@ static ssize_t tap_receive(NetClientState *nc, const uint8_t *buf, size_t size) static void tap_win32_send(void *opaque) { TAPState *s = opaque; - uint8_t *buf, *orig_buf; + uint8_t *buf; int max_size = 4096; int size; - uint8_t min_pkt[ETH_ZLEN]; - size_t min_pktsz = sizeof(min_pkt); size = tap_win32_read(s->handle, &buf, max_size); if (size > 0) { - orig_buf = buf; - - if (net_peer_needs_padding(&s->nc)) { - if (eth_pad_short_frame(min_pkt, &min_pktsz, buf, size)) { - buf = min_pkt; - size = min_pktsz; - } - } - qemu_send_packet(&s->nc, buf, size); - tap_win32_free_buffer(s->handle, orig_buf); + tap_win32_free_buffer(s->handle, buf); } } diff --git a/net/tap.c b/net/tap.c index ada69a21021..786c31f5adf 100644 --- a/net/tap.c +++ b/net/tap.c @@ -261,8 +261,6 @@ static void tap_send(void *opaque) while (true) { uint8_t *buf = s->buf; - uint8_t min_pkt[ETH_ZLEN]; - size_t min_pktsz = sizeof(min_pkt); size = tap_read_packet(s->fd, s->buf, sizeof(s->buf)); if (size <= 0) { @@ -279,13 +277,6 @@ static void tap_send(void *opaque) size -= s->host_vnet_hdr_len; } - if (net_peer_needs_padding(&s->nc)) { - if (eth_pad_short_frame(min_pkt, &min_pktsz, buf, size)) { - buf = min_pkt; - size = min_pktsz; - } - } - size = qemu_send_packet_async(&s->nc, buf, size, tap_send_completed); if (size == 0) { tap_read_poll(s, false); diff --git a/net/vmnet-common.m b/net/vmnet-common.m index ab33ce2b0c2..4dfc8abbc15 100644 --- a/net/vmnet-common.m +++ b/net/vmnet-common.m @@ -150,23 +150,12 @@ 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) { 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); -- 2.43.0
