diff options
author | Laurent Vivier <lvivier@redhat.com> | 2024-11-22 17:43:28 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-11-27 16:11:18 +0100 |
commit | dd143e38901af1c0c48f483d93558ba0773667db (patch) | |
tree | e63d66c95d772dabbfde4a79d5b2b252bc20f020 /packet.h | |
parent | c0fbc7ef2ae2919bf6162b4149d341f448289836 (diff) | |
download | passt-dd143e38901af1c0c48f483d93558ba0773667db.tar passt-dd143e38901af1c0c48f483d93558ba0773667db.tar.gz passt-dd143e38901af1c0c48f483d93558ba0773667db.tar.bz2 passt-dd143e38901af1c0c48f483d93558ba0773667db.tar.lz passt-dd143e38901af1c0c48f483d93558ba0773667db.tar.xz passt-dd143e38901af1c0c48f483d93558ba0773667db.tar.zst passt-dd143e38901af1c0c48f483d93558ba0773667db.zip |
packet: replace struct desc by struct iovec
To be able to manage buffers inside a shared memory provided
by a VM via a vhost-user interface, we cannot rely on the fact
that buffers are located in a pre-defined memory area and use
a base address and a 32bit offset to address them.
We need a 64bit address, so replace struct desc by struct iovec
and update range checking.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'packet.h')
-rw-r--r-- | packet.h | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -7,16 +7,6 @@ #define PACKET_H /** - * struct desc - Generic offset-based descriptor within buffer - * @offset: Offset of descriptor relative to buffer start, 32-bit limit - * @len: Length of descriptor, host order, 16-bit limit - */ -struct desc { - uint32_t offset; - uint16_t len; -}; - -/** * struct pool - Generic pool of packets stored in a buffer * @buf: Buffer storing packet descriptors * @buf_size: Total size of buffer @@ -29,7 +19,7 @@ struct pool { size_t buf_size; size_t size; size_t count; - struct desc pkt[1]; + struct iovec pkt[1]; }; void packet_add_do(struct pool *p, size_t len, const char *start, @@ -54,7 +44,7 @@ struct _name ## _t { \ size_t buf_size; \ size_t size; \ size_t count; \ - struct desc pkt[_size]; \ + struct iovec pkt[_size]; \ } #define PACKET_POOL_INIT_NOCAST(_size, _buf, _buf_size) \ |