| 
									
										
										
										
											2018-02-09 15:00:59 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  *  RDMA device: Definitions of Backend Device structures | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2018 Oracle | 
					
						
							|  |  |  |  * Copyright (C) 2018 Red Hat Inc | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Authors: | 
					
						
							|  |  |  |  *     Yuval Shaia <yuval.shaia@oracle.com> | 
					
						
							|  |  |  |  *     Marcel Apfelbaum <marcel@redhat.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This work is licensed under the terms of the GNU GPL, version 2 or later. | 
					
						
							|  |  |  |  * See the COPYING file in the top-level directory. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef RDMA_BACKEND_DEFS_H
 | 
					
						
							|  |  |  | #define RDMA_BACKEND_DEFS_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-21 17:22:07 +02:00
										 |  |  | #include "qemu/thread.h"
 | 
					
						
							| 
									
										
										
										
											2018-12-21 16:40:19 +02:00
										 |  |  | #include "chardev/char-fe.h"
 | 
					
						
							|  |  |  | #include <infiniband/verbs.h>
 | 
					
						
							| 
									
										
										
										
											2018-12-21 16:40:25 +02:00
										 |  |  | #include "contrib/rdmacm-mux/rdmacm-mux.h"
 | 
					
						
							| 
									
										
										
										
											2019-03-11 03:29:06 -07:00
										 |  |  | #include "rdma_utils.h"
 | 
					
						
							| 
									
										
										
										
											2018-02-09 15:00:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | typedef struct RdmaDeviceResources RdmaDeviceResources; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct RdmaBackendThread { | 
					
						
							|  |  |  |     QemuThread thread; | 
					
						
							| 
									
										
										
										
											2018-08-05 18:35:06 +03:00
										 |  |  |     bool run; /* Set by thread manager to let thread know it should exit */ | 
					
						
							|  |  |  |     bool is_running; /* Set by the thread to report its status */ | 
					
						
							| 
									
										
										
										
											2018-02-09 15:00:59 +02:00
										 |  |  | } RdmaBackendThread; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-21 16:40:25 +02:00
										 |  |  | typedef struct RdmaCmMux { | 
					
						
							|  |  |  |     CharBackend *chr_be; | 
					
						
							|  |  |  |     int can_receive; | 
					
						
							|  |  |  | } RdmaCmMux; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-09 15:00:59 +02:00
										 |  |  | typedef struct RdmaBackendDev { | 
					
						
							|  |  |  |     RdmaBackendThread comp_thread; | 
					
						
							|  |  |  |     PCIDevice *dev; | 
					
						
							|  |  |  |     RdmaDeviceResources *rdma_dev_res; | 
					
						
							|  |  |  |     struct ibv_device *ib_dev; | 
					
						
							|  |  |  |     struct ibv_context *context; | 
					
						
							|  |  |  |     struct ibv_comp_channel *channel; | 
					
						
							|  |  |  |     uint8_t port_num; | 
					
						
							| 
									
										
										
										
											2019-03-11 03:29:06 -07:00
										 |  |  |     RdmaProtectedQList recv_mads_list; | 
					
						
							| 
									
										
										
										
											2018-12-21 16:40:25 +02:00
										 |  |  |     RdmaCmMux rdmacm_mux; | 
					
						
							| 
									
										
										
										
											2018-02-09 15:00:59 +02:00
										 |  |  | } RdmaBackendDev; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct RdmaBackendPD { | 
					
						
							|  |  |  |     struct ibv_pd *ibpd; | 
					
						
							|  |  |  | } RdmaBackendPD; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct RdmaBackendMR { | 
					
						
							|  |  |  |     struct ibv_pd *ibpd; | 
					
						
							|  |  |  |     struct ibv_mr *ibmr; | 
					
						
							|  |  |  | } RdmaBackendMR; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct RdmaBackendCQ { | 
					
						
							|  |  |  |     RdmaBackendDev *backend_dev; | 
					
						
							|  |  |  |     struct ibv_cq *ibcq; | 
					
						
							|  |  |  | } RdmaBackendCQ; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct RdmaBackendQP { | 
					
						
							|  |  |  |     struct ibv_pd *ibpd; | 
					
						
							|  |  |  |     struct ibv_qp *ibqp; | 
					
						
							| 
									
										
										
										
											2018-12-21 16:40:25 +02:00
										 |  |  |     uint8_t sgid_idx; | 
					
						
							| 
									
										
										
										
											2019-03-11 03:29:11 -07:00
										 |  |  |     RdmaProtectedGSList cqe_ctx_list; | 
					
						
							| 
									
										
										
										
											2018-02-09 15:00:59 +02:00
										 |  |  | } RdmaBackendQP; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-03 14:33:40 +03:00
										 |  |  | typedef struct RdmaBackendSRQ { | 
					
						
							|  |  |  |     struct ibv_srq *ibsrq; | 
					
						
							|  |  |  |     RdmaProtectedGSList cqe_ctx_list; | 
					
						
							|  |  |  | } RdmaBackendSRQ; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-09 15:00:59 +02:00
										 |  |  | #endif
 |