On Tue, Oct 17, 2023 at 12:09 PM Akihiko Odaki <akihiko.od...@daynix.com> wrote: > > While netmap implements virtio-net header, it does not implement > receive_raw().
The only user for raw is the announcing. Netmap probably doesn't it at all. > Instead of implementing receive_raw for netmap, add > virtio-net headers in the common code and use receive_iov()/receive() > instead. This also fixes the buffer size for the virtio-net header. > > Fixes: fbbdbddec0 ("tap: allow extended virtio header with hash info") > Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com> > --- > include/net/net.h | 1 - > include/net/queue.h | 1 - > net/net.c | 17 +++++++++-------- > net/queue.c | 30 ++++++++++-------------------- > net/tap.c | 1 - > 5 files changed, 19 insertions(+), 31 deletions(-) > > diff --git a/include/net/net.h b/include/net/net.h > index 011031ef77..971dc54897 100644 > --- a/include/net/net.h > +++ b/include/net/net.h > @@ -71,7 +71,6 @@ typedef struct NetClientInfo { > NetClientDriver type; > size_t size; > NetReceive *receive; > - NetReceive *receive_raw; > NetReceiveIOV *receive_iov; > NetCanReceive *can_receive; > NetStart *start; > diff --git a/include/net/queue.h b/include/net/queue.h > index 9f2f289d77..7a43863be2 100644 > --- a/include/net/queue.h > +++ b/include/net/queue.h > @@ -31,7 +31,6 @@ typedef struct NetQueue NetQueue; > typedef void (NetPacketSent) (NetClientState *sender, ssize_t ret); > > #define QEMU_NET_PACKET_FLAG_NONE 0 > -#define QEMU_NET_PACKET_FLAG_RAW (1<<0) > > /* Returns: > * >0 - success > diff --git a/net/net.c b/net/net.c > index 6d2fa8d40f..2d94d23c07 100644 > --- a/net/net.c > +++ b/net/net.c > @@ -752,8 +752,13 @@ ssize_t qemu_receive_packet_iov(NetClientState *nc, > const struct iovec *iov, > > ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int > size) > { > - return qemu_send_packet_async_with_flags(nc, QEMU_NET_PACKET_FLAG_RAW, > - buf, size, NULL); > + struct virtio_net_hdr_v1_hash vnet_hdr = { }; > + struct iovec iov[] = { > + { .iov_base = &vnet_hdr, .iov_len = nc->vnet_hdr_len }, > + { .iov_base = (void *)buf, .iov_len = size } > + }; Having virtio-net specific code in the net layer is a layer violation. I'd leave it to tap. Thanks