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