public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob ce910699b4d7a2ef771da40a8f15339183351006 1991 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
 
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright (c) 2022 Red Hat GmbH
 * Author: Stefano Brivio <sbrivio@redhat.com>
 */

#ifndef PACKET_H
#define PACKET_H

#include <stdbool.h>
#include "iov.h"

/* Maximum size of a single packet stored in pool, including headers */
#define PACKET_MAX_LEN	((size_t)UINT16_MAX)

/**
 * struct pool - Generic pool of packets stored in a buffer
 * @buf:	Buffer storing packet descriptors,
 * 		a struct vu_dev_region array for passt vhost-user mode
 * @buf_size:	Total size of buffer,
 * 		0 for passt vhost-user mode
 * @size:	Number of usable descriptors for the pool
 * @count:	Number of used descriptors for the pool
 * @pkt:	Descriptors: see macros below
 */
struct pool {
	char *buf;
	size_t buf_size;
	size_t size;
	size_t count;
	struct iovec pkt[];
};

int vu_packet_check_range(void *buf, const char *ptr, size_t len);
void packet_add_do(struct pool *p, struct iov_tail *data,
		   const char *func, int line);
bool packet_data_do(const struct pool *p, const size_t idx,
		    struct iov_tail *data,
		    const char *func, int line);
bool pool_full(const struct pool *p);
void pool_flush(struct pool *p);

#define packet_add(p, data)					\
	packet_add_do(p, data, __func__, __LINE__)
#define packet_data(p, idx, data)					\
	packet_data_do(p, idx, data, __func__, __LINE__)

#define PACKET_POOL_DECL(_name, _size, _buf)				\
struct _name ## _t {							\
	char *buf;							\
	size_t buf_size;						\
	size_t size;							\
	size_t count;							\
	struct iovec pkt[_size];					\
}

#define PACKET_POOL_INIT_NOCAST(_size, _buf, _buf_size)			\
{									\
	.buf_size = _buf_size,						\
	.buf = _buf,							\
	.size = _size,							\
}

#define PACKET_INIT(name, size, buf, buf_size)				\
	(struct name ## _t) PACKET_POOL_INIT_NOCAST(size, buf, buf_size)

#define PACKET_POOL_NOINIT(name, size, buf)				\
	PACKET_POOL_DECL(name, size, buf) name ## _storage;		\
	static struct pool *name = (struct pool *)&name ## _storage
#endif /* PACKET_H */

debug log:

solving ce910699b4d7 ...
found ce910699b4d7 in https://archives.passt.top/passt-dev/20250417165136.2688884-27-lvivier@redhat.com/ ||
	https://archives.passt.top/passt-dev/20250416152605.3947623-27-lvivier@redhat.com/
found dab8274fa5c5 in https://archives.passt.top/passt-dev/20250417165136.2688884-21-lvivier@redhat.com/ ||
	https://archives.passt.top/passt-dev/20250416152605.3947623-21-lvivier@redhat.com/ ||
	https://archives.passt.top/passt-dev/20250415094300.65794-21-lvivier@redhat.com/
found 062afb978124 in https://archives.passt.top/passt-dev/20250417165136.2688884-7-lvivier@redhat.com/ ||
	https://archives.passt.top/passt-dev/20250416152605.3947623-7-lvivier@redhat.com/ ||
	https://archives.passt.top/passt-dev/20250415094300.65794-7-lvivier@redhat.com/
found af40b39b5251 in https://archives.passt.top/passt-dev/20250417165136.2688884-6-lvivier@redhat.com/ ||
	https://archives.passt.top/passt-dev/20250416152605.3947623-6-lvivier@redhat.com/ ||
	https://archives.passt.top/passt-dev/20250415094300.65794-6-lvivier@redhat.com/ ||
	https://archives.passt.top/passt-dev/20250411131031.1398006-6-lvivier@redhat.com/
found c94780a5ea54 in https://passt.top/passt
preparing index
index prepared:
100644 c94780a5ea54816e7a92751ac78f09d817e66b8f	packet.h

applying [1/4] https://archives.passt.top/passt-dev/20250417165136.2688884-6-lvivier@redhat.com/
diff --git a/packet.h b/packet.h
index c94780a5ea54..af40b39b5251 100644

Checking patch packet.h...
Applied patch packet.h cleanly.

skipping https://archives.passt.top/passt-dev/20250416152605.3947623-6-lvivier@redhat.com/ for af40b39b5251
skipping https://archives.passt.top/passt-dev/20250415094300.65794-6-lvivier@redhat.com/ for af40b39b5251
skipping https://archives.passt.top/passt-dev/20250411131031.1398006-6-lvivier@redhat.com/ for af40b39b5251
index at:
100644 af40b39b5251337185387c387fd108fcf3f3a628	packet.h

applying [2/4] https://archives.passt.top/passt-dev/20250417165136.2688884-7-lvivier@redhat.com/
diff --git a/packet.h b/packet.h
index af40b39b5251..062afb978124 100644

Checking patch packet.h...
Applied patch packet.h cleanly.

skipping https://archives.passt.top/passt-dev/20250416152605.3947623-7-lvivier@redhat.com/ for 062afb978124
skipping https://archives.passt.top/passt-dev/20250415094300.65794-7-lvivier@redhat.com/ for 062afb978124
index at:
100644 062afb9781248e7c498333937a6c77f407260f6c	packet.h

applying [3/4] https://archives.passt.top/passt-dev/20250417165136.2688884-21-lvivier@redhat.com/
diff --git a/packet.h b/packet.h
index 062afb978124..dab8274fa5c5 100644

Checking patch packet.h...
Applied patch packet.h cleanly.

skipping https://archives.passt.top/passt-dev/20250416152605.3947623-21-lvivier@redhat.com/ for dab8274fa5c5
skipping https://archives.passt.top/passt-dev/20250415094300.65794-21-lvivier@redhat.com/ for dab8274fa5c5
index at:
100644 dab8274fa5c5ecfc83d4678bd4e32b3efce05b26	packet.h

applying [4/4] https://archives.passt.top/passt-dev/20250417165136.2688884-27-lvivier@redhat.com/
diff --git a/packet.h b/packet.h
index dab8274fa5c5..ce910699b4d7 100644

Checking patch packet.h...
Applied patch packet.h cleanly.

skipping https://archives.passt.top/passt-dev/20250416152605.3947623-27-lvivier@redhat.com/ for ce910699b4d7
index at:
100644 ce910699b4d7a2ef771da40a8f15339183351006	packet.h

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).