Commit dcc055e3 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: move RDMA internal structs into rdma.c



Clean up everything that isn't strictly necessary in rdma.h.

Change-Id: Ied9acbed5f5b64860eae39816cdcb74620009a79
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 1ade6e1d
Loading
Loading
Loading
Loading
+35 −1
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@
 *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "rdma.h"

#include <arpa/inet.h>
#include <fcntl.h>
#include <infiniband/verbs.h>
@@ -46,7 +48,7 @@
#include <rte_malloc.h>

#include "conn.h"
#include "rdma.h"
#include "request.h"
#include "port.h"
#include "host.h"
#include "spdk/assert.h"
@@ -63,6 +65,38 @@
#define NVMF_DEFAULT_TX_SGE		1
#define NVMF_DEFAULT_RX_SGE		2

struct spdk_nvmf_rdma_conn {
	struct spdk_nvmf_conn			conn;

	struct rdma_cm_id			*cm_id;
	struct ibv_context			*ctx;
	struct ibv_comp_channel			*comp_channel;
	struct ibv_cq				*cq;
	struct ibv_qp				*qp;

	uint16_t				queue_depth;

	STAILQ_HEAD(, spdk_nvmf_rdma_request)	rdma_reqs;
};

struct spdk_nvmf_rdma_request {
	struct spdk_nvmf_request		req;
	STAILQ_ENTRY(spdk_nvmf_rdma_request)	link;

	union nvmf_h2c_msg			cmd;
	struct ibv_mr				*cmd_mr;

	union nvmf_c2h_msg			rsp;
	struct ibv_mr				*rsp_mr;

	struct ibv_sge				send_sgl;
	struct ibv_sge				recv_sgl[2];

	struct ibv_mr				*bb_mr;
	uint8_t					*bb;
	uint32_t				bb_len;
};

struct spdk_nvmf_rdma {
	struct rte_timer		acceptor_timer;
	struct rdma_event_channel	*acceptor_event_channel;
+2 −39
Original line number Diff line number Diff line
@@ -34,45 +34,8 @@
#ifndef _NVMF_RDMA_H_
#define _NVMF_RDMA_H_

#include <infiniband/verbs.h>

#include "nvmf_internal.h"
#include "conn.h"
#include "request.h"
#include "spdk/nvmf_spec.h"
#include "spdk/queue.h"

struct spdk_nvmf_rdma_conn {
	struct spdk_nvmf_conn		conn;

	struct rdma_cm_id		*cm_id;
	struct ibv_context		*ctx;
	struct ibv_comp_channel		*comp_channel;
	struct ibv_cq			*cq;
	struct ibv_qp			*qp;

	uint16_t			queue_depth;

	STAILQ_HEAD(, spdk_nvmf_rdma_request)		rdma_reqs;
};

struct spdk_nvmf_rdma_request {
	struct spdk_nvmf_request		req;
	STAILQ_ENTRY(spdk_nvmf_rdma_request)	link;

	union nvmf_h2c_msg			cmd;
	struct ibv_mr				*cmd_mr;

	union nvmf_c2h_msg			rsp;
	struct ibv_mr				*rsp_mr;

	struct ibv_sge				send_sgl;
	struct ibv_sge				recv_sgl[2];

	struct ibv_mr				*bb_mr;
	uint8_t					*bb;
	uint32_t				bb_len;
};
struct spdk_nvmf_conn;
struct spdk_nvmf_request;

int spdk_nvmf_rdma_init(void);
int spdk_nvmf_rdma_fini(void);