Subject: s/tap_hdr file/tap_hdr structure/ On 9/4/26 23:28, aerosouund wrote:
From: Ammar Yasser
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: Eugenio Pérez
If Eugenio is the author, you should set it as the author, otherwise you should remove his Signed-off-by
Signed-off-by: Ammar Yasser
--- 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
#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..aa270b7 --- /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: Stefano Brivio
+ */ + +#ifndef TAP_HDR_H +#define TAP_HDR_H + +#include +#include + +/** + * struct tap_hdr - tap backend specific headers + * @vnet_len: Frame length (for qemu socket transport)
missing @hdr description
+ */ +struct tap_hdr { + union { + uint32_t vnet_len; + struct virtio_net_hdr_mrg_rxbuf hdr; + }; +};
This will break passt. In tap.h, we have: static inline struct iovec tap_hdr_iov(const struct ctx *c, struct tap_hdr *thdr) { return (struct iovec){ .iov_base = thdr, .iov_len = c->mode == MODE_PASST ? sizeof(*thdr) : 0, }; } before this patch sizeof(*thdr) is 4, now it's 12.
+ +#endif /* TAP_HDR_H */