aboutgitcodebugslistschat
path: root/packet.h
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2024-11-22 17:43:28 +0100
committerStefano Brivio <sbrivio@redhat.com>2024-11-27 16:11:18 +0100
commitdd143e38901af1c0c48f483d93558ba0773667db (patch)
treee63d66c95d772dabbfde4a79d5b2b252bc20f020 /packet.h
parentc0fbc7ef2ae2919bf6162b4149d341f448289836 (diff)
downloadpasst-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.h14
1 files changed, 2 insertions, 12 deletions
diff --git a/packet.h b/packet.h
index a784b07..8377dcf 100644
--- a/packet.h
+++ b/packet.h
@@ -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) \