nvmf: remove bb pools and replace with rte_malloc

The mempool functionality is never used at runtime - all bounce buffers
were immediately assigned to a rx_desc.

Change-Id: Ie2195059858e34b30b07e104739f046c13abc335
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-06-23 16:00:09 -07:00
parent 31d2a116c8
commit f0242ce745
3 changed files with 8 additions and 62 deletions

View File

@ -108,36 +108,6 @@ spdk_nvmf_initialize_pools(struct spdk_nvmf_globals *spdk_nvmf)
request_mempool,
(unsigned int)(SPDK_NVMF_DESC_POOL_SIZE(spdk_nvmf) * spdk_nvme_request_size()));
spdk_nvmf->bb_small_pool =
rte_mempool_create("bb_small_pool",
SPDK_NVMF_ADMINQ_POOL_SIZE(spdk_nvmf),
SMALL_BB_MAX_SIZE,
128, 0,
NULL, NULL, NULL, NULL,
SOCKET_ID_ANY, 0);
if (!spdk_nvmf->bb_small_pool) {
SPDK_ERRLOG("create bb small pool failed\n");
return -1;
}
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "Small data buffer pool %p, size 0x%x bytes\n",
spdk_nvmf->bb_small_pool,
(SPDK_NVMF_ADMINQ_POOL_SIZE(spdk_nvmf) * SMALL_BB_MAX_SIZE));
spdk_nvmf->bb_large_pool =
rte_mempool_create("bb_large_pool",
SPDK_NVMF_IOQ_POOL_SIZE(spdk_nvmf),
LARGE_BB_MAX_SIZE,
32, 0,
NULL, NULL, NULL, NULL,
SOCKET_ID_ANY, 0);
if (!spdk_nvmf->bb_large_pool) {
SPDK_ERRLOG("create bb large pool failed\n");
return -1;
}
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "Large data buffer pool %p, size 0x%x bytes\n",
spdk_nvmf->bb_large_pool,
(SPDK_NVMF_IOQ_POOL_SIZE(spdk_nvmf) * LARGE_BB_MAX_SIZE));
return 0;
}
@ -159,8 +129,6 @@ spdk_nvmf_check_pools(void)
int rc = 0;
rc += spdk_nvmf_check_pool(spdk_nvmf->nvme_request_pool, SPDK_NVMF_DESC_POOL_SIZE(spdk_nvmf));
rc += spdk_nvmf_check_pool(spdk_nvmf->bb_small_pool, SPDK_NVMF_ADMINQ_POOL_SIZE(spdk_nvmf));
rc += spdk_nvmf_check_pool(spdk_nvmf->bb_large_pool, SPDK_NVMF_IOQ_POOL_SIZE(spdk_nvmf));
if (rc == 0) {
return 0;

View File

@ -114,8 +114,6 @@ struct spdk_nvmf_globals {
int MaxRecvDataSegmentLength;
struct rte_mempool *nvme_request_pool;
struct rte_mempool *bb_small_pool;
struct rte_mempool *bb_large_pool;
uint16_t sin_port;
};

View File

@ -43,7 +43,6 @@
#include <rte_cycles.h>
#include <rte_timer.h>
#include <rte_malloc.h>
#include <rte_mempool.h>
#include "conn.h"
#include "rdma.h"
@ -176,11 +175,7 @@ free_qp_desc(struct spdk_nvmf_conn *conn)
SPDK_ERRLOG("Unable to de-register rx bb mr\n");
}
if (conn->type == CONN_TYPE_AQ) {
rte_mempool_put(g_nvmf_tgt.bb_small_pool, (void *)tmp_rx->bb);
} else {
rte_mempool_put(g_nvmf_tgt.bb_large_pool, (void *)tmp_rx->bb);
}
rte_free(tmp_rx->bb);
rc = rdma_dereg_mr(tmp_rx->msg_buf_mr);
if (rc) {
@ -941,20 +936,15 @@ alloc_qp_rx_desc(struct spdk_nvmf_conn *conn)
data.
*/
if (conn->type == CONN_TYPE_AQ) {
rc = rte_mempool_get(g_nvmf_tgt.bb_small_pool, (void **)&rx_desc->bb);
if ((rc < 0) || !rx_desc->bb) {
SPDK_ERRLOG("Unable to get small bb object\n");
goto fail;
}
rx_desc->bb_len = SMALL_BB_MAX_SIZE;
} else { // for IO queues
rc = rte_mempool_get(g_nvmf_tgt.bb_large_pool, (void **)&rx_desc->bb);
if ((rc < 0) || !rx_desc->bb) {
SPDK_ERRLOG("Unable to get large bb object\n");
goto fail;
}
rx_desc->bb_len = LARGE_BB_MAX_SIZE;
}
rx_desc->bb = rte_zmalloc("nvmf_bb", rx_desc->bb_len, 0);
if (!rx_desc->bb) {
SPDK_ERRLOG("Unable to get %u-byte bounce buffer\n", rx_desc->bb_len);
goto fail;
}
rx_desc->bb_mr = rdma_reg_read(conn->rdma.cm_id,
(void *)rx_desc->bb,
rx_desc->bb_len);
@ -983,13 +973,7 @@ fail:
}
}
if (rx_desc->bb) {
if (conn->type == CONN_TYPE_AQ) {
rte_mempool_put(g_nvmf_tgt.bb_small_pool, (void *)rx_desc->bb);
} else {
rte_mempool_put(g_nvmf_tgt.bb_large_pool, (void *)rx_desc->bb);
}
}
rte_free(rx_desc->bb);
if (rx_desc->msg_buf_mr) {
rc = rdma_dereg_mr(rx_desc->msg_buf_mr);
@ -1009,11 +993,7 @@ fail:
SPDK_ERRLOG("Unable to de-register rx bb mr\n");
}
if (conn->type == CONN_TYPE_AQ) {
rte_mempool_put(g_nvmf_tgt.bb_small_pool, (void *)tmp->bb);
} else {
rte_mempool_put(g_nvmf_tgt.bb_large_pool, (void *)tmp->bb);
}
rte_free(tmp->bb);
rc = rdma_dereg_mr(tmp->msg_buf_mr);
if (rc) {