public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
ef490a54b2debe941f304d6ca610c41c5291f285 blob 2344 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
70
71
72
73
74
75
76
77
78
79
 
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright Red Hat
 * Author: Ammar Yasser <aerosound161@gmail.com>
 *
 * vhost.h - vhost-net (vhost-kernel) acceleration for pasta mode
 */

#ifndef VHOST_H
#define VHOST_H

#include <assert.h>
#include <stddef.h>
#include <stdint.h>

#include <linux/vhost.h>
#include <linux/vhost_types.h>
#include <linux/virtio_config.h>
#include <linux/virtio_net.h>
#include <linux/virtio_ring.h>

#include "passt.h"

/**
 * struct vq_state - Per-virtqueue local descriptor tracking
 * @num_free:		Number of descriptors ready to be announced to the
 *			kernel via vhost_rx_descriptor_handoff()
 * @last_used_idx:	Number of used-ring entries consumed so far;
 *			lagging read cursor vs. vring_used->idx (the
 *			kernel's write cursor)
 */
extern struct vq_state {
	uint16_t num_free;
	uint16_t last_used_idx;
	uint16_t next_free;
} vhost_vq_state[2];


extern struct vring_desc vring_desc[2][VHOST_NDESCS];
union vring_avail_u {
	struct vring_avail avail;
	char buf[offsetof(struct vring_avail, ring[VHOST_NDESCS])];
};
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
extern union vring_avail_u vring_avail_all[2];
#pragma GCC diagnostic pop

union vring_used_u {
	struct vring_used used;
	char buf[offsetof(struct vring_used, ring[VHOST_NDESCS])];
};
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
extern union vring_used_u vring_used_all[2];
#pragma GCC diagnostic pop

#define N_VHOST_REGIONS 2
union vhost_memory_u {
	struct vhost_memory mem;
	char buf[offsetof(struct vhost_memory, regions[N_VHOST_REGIONS])];
};
extern union vhost_memory_u vhost_memory;

#define VHOST_MEMORY_REGION_PTR(addr, size) \
    (struct vhost_memory_region) { \
        .guest_phys_addr = (uintptr_t)addr, \
        .memory_size = size, \
        .userspace_addr  = (uintptr_t)addr, \
    }
#define VHOST_MEMORY_REGION(buf) VHOST_MEMORY_REGION_PTR(&buf, sizeof(buf))

void vhost_set_vring(struct ctx *c, int queue_idx, int tap_fd);
int vhost_setup_memory_table(struct ctx *c);
int vhost_setup_net(struct ctx *c);
void vhost_setup_eventfds(struct ctx *c, int queue_idx);
void vhost_rx_descriptor_handoff(struct ctx *c);
void vhost_kick(struct vring_used *used, int kick_fd);

#endif /* VHOST_H */
debug log:

solving aaa937d ...
found aaa937d in https://archives.passt.top/passt-dev/20260905162528.43564-2-aerosound161@gmail.com/ ||
	https://archives.passt.top/passt-dev/20260904212826.41027-4-aerosound161@gmail.com/

applying [1/2] https://archives.passt.top/passt-dev/20260905162528.43564-2-aerosound161@gmail.com/
diff --git a/vhost.h b/vhost.h\r
new file mode 100644\r
index 0000000..aaa937d\r

1:7: trailing whitespace.
/* SPDX-License-Identifier: GPL-2.0-or-later\r
1:8: trailing whitespace.
 * Copyright Red Hat\r
1:9: trailing whitespace.
 * Author: Ammar Yasser <aerosound161@gmail.com>\r
1:10: trailing whitespace.
 *\r
1:11: trailing whitespace.
 * vhost.h - vhost-net (vhost-kernel) acceleration for pasta mode\r
Checking patch vhost.h...
Applied patch vhost.h cleanly.
warning: squelched 74 whitespace errors
warning: 79 lines add whitespace errors.

skipping https://archives.passt.top/passt-dev/20260904212826.41027-4-aerosound161@gmail.com/ for aaa937d
index at:
100644 ef490a54b2debe941f304d6ca610c41c5291f285	vhost.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).