From 50947d55579f49a7c77e027ddc393f71460bcd82 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 13 Mar 2017 15:14:12 -0700 Subject: [PATCH] nvmf/rdma: use SPDK_COUNTOF to count SGL elements This clarifies the relation between the values assigned to sg_list and num_sge (no functional change). Change-Id: I8e81d47dd97a033b17cd3b813b06e4887127146c Signed-off-by: Daniel Verkamp --- lib/nvmf/rdma.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index f4a0dd561..c518c4ac2 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -52,6 +52,7 @@ #include "spdk/nvmf_spec.h" #include "spdk/string.h" #include "spdk/trace.h" +#include "spdk/util.h" #include "spdk_internal/log.h" @@ -351,7 +352,7 @@ spdk_nvmf_rdma_conn_create(struct rdma_cm_id *id, struct ibv_comp_channel *chann rdma_req->cmd.wr.wr_id = (uintptr_t)rdma_req; rdma_req->cmd.wr.sg_list = rdma_req->cmd.sgl; - rdma_req->cmd.wr.num_sge = NVMF_DEFAULT_RX_SGE; + rdma_req->cmd.wr.num_sge = SPDK_COUNTOF(rdma_req->cmd.sgl); if (nvmf_post_rdma_recv(&rdma_req->req)) { SPDK_ERRLOG("Unable to post capsule for RDMA RECV\n"); @@ -371,14 +372,14 @@ spdk_nvmf_rdma_conn_create(struct rdma_cm_id *id, struct ibv_comp_channel *chann rdma_req->rsp.wr.opcode = IBV_WR_SEND; rdma_req->rsp.wr.send_flags = IBV_SEND_SIGNALED; rdma_req->rsp.wr.sg_list = rdma_req->rsp.sgl; - rdma_req->rsp.wr.num_sge = NVMF_DEFAULT_TX_SGE; + rdma_req->rsp.wr.num_sge = SPDK_COUNTOF(rdma_req->rsp.sgl); /* Set up memory for data buffers */ rdma_req->data.wr.wr_id = (uint64_t)rdma_req; rdma_req->data.wr.next = NULL; rdma_req->data.wr.send_flags = IBV_SEND_SIGNALED; rdma_req->data.wr.sg_list = rdma_req->data.sgl; - rdma_req->data.wr.num_sge = NVMF_DEFAULT_TX_SGE; + rdma_req->data.wr.num_sge = SPDK_COUNTOF(rdma_req->data.sgl); } return rdma_conn;