NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
urom_sandbox.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 NVIDIA CORPORATION AND AFFILIATES. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are permitted
5  * provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice, this list of
7  * conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright notice, this list of
9  * conditions and the following disclaimer in the documentation and/or other materials
10  * provided with the distribution.
11  * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12  * to endorse or promote products derived from this software without specific prior written
13  * permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21  * STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  */
25 
26 #ifndef UROM_SANDBOX_H_
27 #define UROM_SANDBOX_H_
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include "ucp/api/ucp.h"
34 
35 /* Sandbox serializing next raw, iter points to the offset place and returns the buffer start */
36 #define urom_sandbox_serialize_next_raw(_iter, _type, _offset) \
37  ({ \
38  _type *_result = (_type *)(*(_iter)); \
39  *(_iter) = UCS_PTR_BYTE_OFFSET(*(_iter), _offset); \
40  _result; \
41  })
42 
43 /* Sandbox command types */
45  UROM_WORKER_CMD_SANDBOX_MEM_MAP, /* Sandbox memory map command */
46  UROM_WORKER_CMD_SANDBOX_TAG_SEND, /* Sandbox tag send command */
47  UROM_WORKER_CMD_SANDBOX_TAG_RECV, /* Sandbox tag recv command */
48 };
49 
50 /* Sandbox memory map command structure */
52  uint64_t context; /* User context returned in notify */
53  ucp_mem_map_params_t map_params; /* UCX memory map params */
54  size_t exported_memh_buffer_len; /* Mapped memory handle length */
55 };
56 
57 /* Sandbox tag send command structure */
59  uint64_t context; /* User context returned in notify */
60  uint64_t dest; /* Domain id of destination */
61  uint64_t buffer; /* Buffer address */
62  uint64_t count; /* Buffer bytes count */
63  uint64_t tag; /* Buffer UCX tag send */
64  uint64_t memh_id; /* Buffer memh id, 0 if inline send */
65 };
66 
67 /* Sandbox tag recv command structure */
69  uint64_t context; /* User context returned in notify */
70  uint64_t buffer; /* Buffer address */
71  uint64_t count; /* Buffer bytes count */
72  uint64_t tag; /* Buffer UCX tag recv */
73  uint64_t tag_mask; /* Buffer UCX tag recv mask */
74  uint64_t memh_id; /* Buffer memh id, 0 if inline recv */
75 };
76 
77 /* UROM sandbox worker command structure */
79  uint64_t type; /* Type of command as defined urom_worker_sandbox_cmd_type */
80  union {
81  struct urom_worker_sandbox_cmd_mem_map mem_map; /* Memory map command */
82  struct urom_worker_sandbox_cmd_tag_send tag_send; /* Tag send command */
83  struct urom_worker_sandbox_cmd_tag_recv tag_recv; /* Tag recv command */
84  };
85 };
86 
87 /* Sandbox notification types */
89  UROM_WORKER_NOTIFY_SANDBOX_MEM_MAP, /* Sandbox memory map notification */
90  UROM_WORKER_NOTIFY_SANDBOX_TAG_SEND, /* Sandbox tag send notification */
91  UROM_WORKER_NOTIFY_SANDBOX_TAG_RECV, /* Sandbox tag recv notification */
92 };
93 
94 /* Sandbox memory map notification structure */
96  uint64_t context; /* User context from map command */
97  uint64_t memh_id; /* Buffer memh id */
98 };
99 
100 /* Sandbox tag send notification structure */
102  uint64_t context; /* User context from send command */
103  ucs_status_t status; /* Tag send command execution status */
104 };
105 
106 /* Sandbox tag recv notification structure */
108  uint64_t context; /* User context from recv command */
109  void *buffer; /* Inline receive data, NULL if RDMA */
110  uint64_t count; /* Received data bytes count */
111  uint64_t sender_tag; /* Sender tag */
112  ucs_status_t status; /* Tag recv command execution status */
113 };
114 
115 /* UROM sandbox worker notification structure */
117  uint64_t type; /* Notify type as defined by urom_worker_sandbox_notify_type */
118  union {
119  struct urom_worker_sandbox_notify_mem_map mem_map; /* Memory map notification */
120  struct urom_worker_sandbox_notify_tag_send tag_send; /* Tag send notification */
121  struct urom_worker_sandbox_notify_tag_recv tag_recv; /* Tag recv notification */
122  };
123 };
124 
125 #ifdef __cplusplus
126 } /* extern "C" */
127 #endif
128 
129 #endif
struct urom_worker_sandbox_notify_mem_map mem_map
Definition: urom_sandbox.h:119
struct urom_worker_sandbox_notify_tag_recv tag_recv
Definition: urom_sandbox.h:121
struct urom_worker_sandbox_notify_tag_send tag_send
Definition: urom_sandbox.h:120
ucp_mem_map_params_t map_params
Definition: urom_sandbox.h:53
struct urom_worker_sandbox_cmd_tag_send tag_send
Definition: urom_sandbox.h:82
struct urom_worker_sandbox_cmd_tag_recv tag_recv
Definition: urom_sandbox.h:83
struct urom_worker_sandbox_cmd_mem_map mem_map
Definition: urom_sandbox.h:81
urom_worker_sandbox_notify_type
Definition: urom_sandbox.h:88
@ UROM_WORKER_NOTIFY_SANDBOX_TAG_RECV
Definition: urom_sandbox.h:91
@ UROM_WORKER_NOTIFY_SANDBOX_MEM_MAP
Definition: urom_sandbox.h:89
@ UROM_WORKER_NOTIFY_SANDBOX_TAG_SEND
Definition: urom_sandbox.h:90
urom_worker_sandbox_cmd_type
Definition: urom_sandbox.h:44
@ UROM_WORKER_CMD_SANDBOX_MEM_MAP
Definition: urom_sandbox.h:45
@ UROM_WORKER_CMD_SANDBOX_TAG_RECV
Definition: urom_sandbox.h:47
@ UROM_WORKER_CMD_SANDBOX_TAG_SEND
Definition: urom_sandbox.h:46