1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * VMware VMCI Driver
4 *
5 * Copyright (C) 2012 VMware, Inc. All rights reserved.
6 */
7
8#ifndef _VMCI_DATAGRAM_H_
9#define _VMCI_DATAGRAM_H_
10
11#include <linux/types.h>
12#include <linux/list.h>
13
14#include "vmci_context.h"
15
16#define VMCI_MAX_DELAYED_DG_HOST_QUEUE_SIZE 256
17
18/*
19 * The struct vmci_datagram_queue_entry is a queue header for the in-kernel VMCI
20 * datagram queues. It is allocated in non-paged memory, as the
21 * content is accessed while holding a spinlock. The pending datagram
22 * itself may be allocated from paged memory. We shadow the size of
23 * the datagram in the non-paged queue entry as this size is used
24 * while holding the same spinlock as above.
25 */
26struct vmci_datagram_queue_entry {
27	struct list_head list_item;	/* For queuing. */
28	size_t dg_size;		/* Size of datagram. */
29	struct vmci_datagram *dg;	/* Pending datagram. */
30};
31
32/* VMCIDatagramSendRecvInfo */
33struct vmci_datagram_snd_rcv_info {
34	u64 addr;
35	u32 len;
36	s32 result;
37};
38
39/* Datagram API for non-public use. */
40int vmci_datagram_dispatch(u32 context_id, struct vmci_datagram *dg,
41			   bool from_guest);
42int vmci_datagram_invoke_guest_handler(struct vmci_datagram *dg);
43
44#endif /* _VMCI_DATAGRAM_H_ */
45