* [PATCH v2 1/7] tap: Move the tap_hdr file to a separate file
@ 2026-10-16 20:35 Ammar Yasser
0 siblings, 0 replies; 3+ messages in thread
From: Ammar Yasser @ 2026-10-16 20:35 UTC (permalink / raw)
To: passt-dev; +Cc: Eugenio Pérez
It was defined in tap.h, put it on its own so that future callers won't
need to depend on all definitions in tap.h.
Also turn it into a union of a vnet_len and virtio_net_mrg_rxbuf
because for vhost acceleration the frames will have this virtio net
header prepended to them.
Signed-off-by: Ammar Yasser <aerosound161@gmail.com>
---
tap.h | 9 +--------
tap_hdr.h | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 8 deletions(-)
create mode 100644 tap_hdr.h
diff --git a/tap.h b/tap.h
index b335933..1625975 100644
--- a/tap.h
+++ b/tap.h
@@ -10,6 +10,7 @@
#include <stdint.h>
#include "passt.h"
+#include "tap_hdr.h"
/** L2_MAX_LEN_PASTA - Maximum frame length for pasta mode (with L2 header)
*
@@ -38,14 +39,6 @@
struct udphdr;
-/**
- * struct tap_hdr - tap backend specific headers
- * @vnet_len: Frame length (for qemu socket transport)
- */
-struct tap_hdr {
- uint32_t vnet_len;
-} __attribute__((packed));
-
/**
* tap_hdr_iov() - struct iovec for a tap header
* @c: Execution context
diff --git a/tap_hdr.h b/tap_hdr.h
new file mode 100644
index 0000000..4156f44
--- /dev/null
+++ b/tap_hdr.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright (c) 2021 Red Hat GmbH
+ * Author: David Gibson <david@gibson.dropbear.id.au>
+ */
+
+#ifndef TAP_HDR_H
+#define TAP_HDR_H
+
+#include <stdint.h>
+#include <linux/virtio_net.h>
+
+/**
+ * struct tap_hdr - tap backend specific headers
+ * @vnet_len: Frame length (for qemu socket transport)
+ */
+struct tap_hdr {
+ union {
+ uint32_t vnet_len;
+ struct virtio_net_hdr_mrg_rxbuf hdr;
+ };
+};
+
+#endif /* TAP_HDR_H */
--
2.39.5 (Apple Git-154)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/7] tap: Move the tap_hdr file to a separate file
2026-10-16 20:49 ` [PATCH v2 1/7] tap: Move the tap_hdr file to a separate file aerosouund
@ 2026-11-06 10:47 ` Laurent Vivier
0 siblings, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2026-11-06 10:47 UTC (permalink / raw)
To: aerosouund, passt-dev
On 10/16/26 22:49, aerosouund wrote:
> From: Ammar Yasser <aerosound161@gmail.com>
>
> It was defined in tap.h, put it on its own so that future callers won't
> need to depend on all definitions in tap.h.
> Also turn it into a union of a vnet_len and virtio_net_mrg_rxbuf
> because for vhost acceleration the frames will have this virtio net
> header prepended to them.
>
> Signed-off-by: Ammar Yasser <aerosound161@gmail.com>
> ---
> tap.h | 9 +--------
> tap_hdr.h | 23 +++++++++++++++++++++++
> 2 files changed, 24 insertions(+), 8 deletions(-)
> create mode 100644 tap_hdr.h
>
> diff --git a/tap.h b/tap.h
> index b335933..1625975 100644
> --- a/tap.h
> +++ b/tap.h
> @@ -10,6 +10,7 @@
> #include <stdint.h>
>
> #include "passt.h"
> +#include "tap_hdr.h"
>
> /** L2_MAX_LEN_PASTA - Maximum frame length for pasta mode (with L2 header)
> *
> @@ -38,14 +39,6 @@
>
> struct udphdr;
>
> -/**
> - * struct tap_hdr - tap backend specific headers
> - * @vnet_len: Frame length (for qemu socket transport)
> - */
> -struct tap_hdr {
> - uint32_t vnet_len;
> -} __attribute__((packed));
> -
> /**
> * tap_hdr_iov() - struct iovec for a tap header
> * @c: Execution context
> diff --git a/tap_hdr.h b/tap_hdr.h
> new file mode 100644
> index 0000000..4156f44
> --- /dev/null
> +++ b/tap_hdr.h
> @@ -0,0 +1,23 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later
> + * Copyright (c) 2021 Red Hat GmbH
> + * Author: David Gibson <david@gibson.dropbear.id.au>
> + */
> +
> +#ifndef TAP_HDR_H
> +#define TAP_HDR_H
> +
> +#include <stdint.h>
> +#include <linux/virtio_net.h>
> +
> +/**
> + * struct tap_hdr - tap backend specific headers
> + * @vnet_len: Frame length (for qemu socket transport)
Add the new entry @hdr in the description
> + */
> +struct tap_hdr {
> + union {
> + uint32_t vnet_len;
> + struct virtio_net_hdr_mrg_rxbuf hdr;
> + };
> +};
> +
As mentioned in my comment of v1, you need to update in this patch tap_hdr_iov() to use
sizeof(thdr->vnet_len) rather than sizeof(*thdr), otherwise it's broken.
> +#endif /* TAP_HDR_H */
> --
> 2.39.5 (Apple Git-154)
Thanks,
Laurent
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/7] tap: Move the tap_hdr file to a separate file
2026-10-16 20:49 [PATCH v2 0/7] Add vhost-net kernel support to pasta aerosouund
@ 2026-10-16 20:49 ` aerosouund
2026-11-06 10:47 ` Laurent Vivier
0 siblings, 1 reply; 3+ messages in thread
From: aerosouund @ 2026-10-16 20:49 UTC (permalink / raw)
To: aerosound161, passt-dev
From: Ammar Yasser <aerosound161@gmail.com>
It was defined in tap.h, put it on its own so that future callers won't
need to depend on all definitions in tap.h.
Also turn it into a union of a vnet_len and virtio_net_mrg_rxbuf
because for vhost acceleration the frames will have this virtio net
header prepended to them.
Signed-off-by: Ammar Yasser <aerosound161@gmail.com>
---
tap.h | 9 +--------
tap_hdr.h | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 8 deletions(-)
create mode 100644 tap_hdr.h
diff --git a/tap.h b/tap.h
index b335933..1625975 100644
--- a/tap.h
+++ b/tap.h
@@ -10,6 +10,7 @@
#include <stdint.h>
#include "passt.h"
+#include "tap_hdr.h"
/** L2_MAX_LEN_PASTA - Maximum frame length for pasta mode (with L2 header)
*
@@ -38,14 +39,6 @@
struct udphdr;
-/**
- * struct tap_hdr - tap backend specific headers
- * @vnet_len: Frame length (for qemu socket transport)
- */
-struct tap_hdr {
- uint32_t vnet_len;
-} __attribute__((packed));
-
/**
* tap_hdr_iov() - struct iovec for a tap header
* @c: Execution context
diff --git a/tap_hdr.h b/tap_hdr.h
new file mode 100644
index 0000000..4156f44
--- /dev/null
+++ b/tap_hdr.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright (c) 2021 Red Hat GmbH
+ * Author: David Gibson <david@gibson.dropbear.id.au>
+ */
+
+#ifndef TAP_HDR_H
+#define TAP_HDR_H
+
+#include <stdint.h>
+#include <linux/virtio_net.h>
+
+/**
+ * struct tap_hdr - tap backend specific headers
+ * @vnet_len: Frame length (for qemu socket transport)
+ */
+struct tap_hdr {
+ union {
+ uint32_t vnet_len;
+ struct virtio_net_hdr_mrg_rxbuf hdr;
+ };
+};
+
+#endif /* TAP_HDR_H */
--
2.39.5 (Apple Git-154)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-06 10:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16 20:35 [PATCH v2 1/7] tap: Move the tap_hdr file to a separate file Ammar Yasser
2026-10-16 20:49 [PATCH v2 0/7] Add vhost-net kernel support to pasta aerosouund
2026-10-16 20:49 ` [PATCH v2 1/7] tap: Move the tap_hdr file to a separate file aerosouund
2026-11-06 10:47 ` Laurent Vivier
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
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 IMAP folder(s).