vmci_datagram.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #ifndef _VMCI_DATAGRAM_H_
  16. #define _VMCI_DATAGRAM_H_
  17. #include <linux/types.h>
  18. #include <linux/list.h>
  19. #include "vmci_context.h"
  20. #define VMCI_MAX_DELAYED_DG_HOST_QUEUE_SIZE 256
  21. /*
  22. * The struct vmci_datagram_queue_entry is a queue header for the in-kernel VMCI
  23. * datagram queues. It is allocated in non-paged memory, as the
  24. * content is accessed while holding a spinlock. The pending datagram
  25. * itself may be allocated from paged memory. We shadow the size of
  26. * the datagram in the non-paged queue entry as this size is used
  27. * while holding the same spinlock as above.
  28. */
  29. struct vmci_datagram_queue_entry {
  30. struct list_head list_item; /* For queuing. */
  31. size_t dg_size; /* Size of datagram. */
  32. struct vmci_datagram *dg; /* Pending datagram. */
  33. };
  34. /* VMCIDatagramSendRecvInfo */
  35. struct vmci_datagram_snd_rcv_info {
  36. u64 addr;
  37. u32 len;
  38. s32 result;
  39. };
  40. /* Datagram API for non-public use. */
  41. int vmci_datagram_dispatch(u32 context_id, struct vmci_datagram *dg,
  42. bool from_guest);
  43. int vmci_datagram_invoke_guest_handler(struct vmci_datagram *dg);
  44. #endif /* _VMCI_DATAGRAM_H_ */