Lines Matching +full:guest +full:- +full:side
1 // SPDX-License-Identifier: GPL-2.0-only
6 * Simple descriptor-based ring. virtio 0.9 compatible event index is used for
15 /* Next - Where next entry will be written.
16 * Prev - "Next" value when event triggered previously.
17 * Event - Peer requested event after writing this entry.
23 return (unsigned short)(next - event - 1) < (unsigned short)(next - prev); in need_event()
27 * Guest adds descriptors with unique index values and DESC_HW in flags.
46 unsigned char reserved0[HOST_GUEST_PADDING - 2];
48 unsigned char reserved1[HOST_GUEST_PADDING - 2];
59 struct guest { struct
64 unsigned char reserved[HOST_GUEST_PADDING - 12];
65 } guest; argument
73 unsigned char reserved[HOST_GUEST_PADDING - 4];
92 guest.avail_idx = 0; in alloc_ring()
93 guest.kicked_avail_idx = -1; in alloc_ring()
94 guest.last_used_idx = 0; in alloc_ring()
96 host.called_used_idx = -1; in alloc_ring()
103 guest.num_free = ring_size; in alloc_ring()
111 /* guest side */
116 if (!guest.num_free) in add_inbuf()
117 return -1; in add_inbuf()
119 guest.num_free--; in add_inbuf()
120 head = (ring_size - 1) & (guest.avail_idx++); in add_inbuf()
145 unsigned head = (ring_size - 1) & guest.last_used_idx; in get_buf()
154 index = ring[head].index & (ring_size - 1); in get_buf()
159 guest.num_free++; in get_buf()
160 guest.last_used_idx++; in get_buf()
166 unsigned head = (ring_size - 1) & guest.last_used_idx; in used_empty()
180 event->call_index = guest.last_used_idx; in enable_call()
194 need = need_event(event->kick_index, in kick_available()
195 guest.avail_idx, in kick_available()
196 guest.kicked_avail_idx); in kick_available()
198 guest.kicked_avail_idx = guest.avail_idx; in kick_available()
203 /* host side */
213 event->kick_index = host.used_idx; in enable_kick()
221 unsigned head = (ring_size - 1) & host.used_idx; in avail_empty()
228 unsigned head = (ring_size - 1) & host.used_idx; in use_buf()
237 /* simple in-order completion: we don't need in use_buf()
239 * can just modify the descriptor in-place. in use_buf()
241 ring[head].len--; in use_buf()
243 * Note: alternative is to write len and flags in one access - in use_buf()
262 need = need_event(event->call_index, in call_used()