1 /* 2 * VMware VMCI Driver 3 * 4 * Copyright (C) 2012 VMware, Inc. All rights reserved. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License as published by the 8 * Free Software Foundation version 2 and no later version. 9 * 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * for more details. 14 */ 15 16 #ifndef _VMCI_DATAGRAM_H_ 17 #define _VMCI_DATAGRAM_H_ 18 19 #include <linux/types.h> 20 #include <linux/list.h> 21 22 #include "vmci_context.h" 23 24 #define VMCI_MAX_DELAYED_DG_HOST_QUEUE_SIZE 256 25 26 /* 27 * The struct vmci_datagram_queue_entry is a queue header for the in-kernel VMCI 28 * datagram queues. It is allocated in non-paged memory, as the 29 * content is accessed while holding a spinlock. The pending datagram 30 * itself may be allocated from paged memory. We shadow the size of 31 * the datagram in the non-paged queue entry as this size is used 32 * while holding the same spinlock as above. 33 */ 34 struct vmci_datagram_queue_entry { 35 struct list_head list_item; /* For queuing. */ 36 size_t dg_size; /* Size of datagram. */ 37 struct vmci_datagram *dg; /* Pending datagram. */ 38 }; 39 40 /* VMCIDatagramSendRecvInfo */ 41 struct vmci_datagram_snd_rcv_info { 42 u64 addr; 43 u32 len; 44 s32 result; 45 }; 46 47 /* Datagram API for non-public use. */ 48 int vmci_datagram_dispatch(u32 context_id, struct vmci_datagram *dg, 49 bool from_guest); 50 int vmci_datagram_invoke_guest_handler(struct vmci_datagram *dg); 51 52 #endif /* _VMCI_DATAGRAM_H_ */ 53