Skip to content

Commit

Permalink
osd: fix dpdk memzon mz_name setting issue
Browse files Browse the repository at this point in the history
Signed-off-by: chunmei Liu <chunmei.liu@intel.com>
  • Loading branch information
liu-chunmei committed Jan 8, 2018
1 parent 01f9b59 commit 623c6bd
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/msg/async/dpdk/DPDK.cc
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,6 @@ bool DPDKQueuePair::init_rx_mbuf_pool()
{
std::string name = std::string(pktmbuf_pool_name) + std::to_string(_qid) + "_rx";

int bufs_count = cct->_conf->ms_dpdk_rx_buffer_count_per_core - mbufs_per_queue_rx;
int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
char mz_name[RTE_MEMZONE_NAMESIZE];
// reserve the memory for Rx buffers containers
_rx_free_pkts.reserve(mbufs_per_queue_rx);
_rx_free_bufs.reserve(mbufs_per_queue_rx);
Expand Down Expand Up @@ -528,17 +525,12 @@ bool DPDKQueuePair::init_rx_mbuf_pool()
}

//
// 1) Pull all entries from the pool.
// 2) Bind data buffers to each of them.
// 3) Return them back to the pool.
//
int ret = snprintf(mz_name, sizeof(mz_name),
"%s", "rx_buffer_data" + std::to_string(_qid));
if (ret < 0 || ret >= (int)sizeof(mz_name)) {
return false;
}
const struct rte_memzone *mz = rte_memzone_reserve_aligned(mz_name, mbuf_data_size*bufs_count,
_pktmbuf_pool_rx->socket_id, mz_flags, mbuf_data_size);
// allocate more data buffer
int bufs_count = cct->_conf->ms_dpdk_rx_buffer_count_per_core - mbufs_per_queue_rx;
int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
std::string mz_name = "rx_buffer_data" + std::to_string(_qid);
const struct rte_memzone *mz = rte_memzone_reserve_aligned(mz_name.c_str(),
mbuf_data_size*bufs_count, _pktmbuf_pool_rx->socket_id, mz_flags, mbuf_data_size);
assert(mz);
void* m = mz->addr;
for (int i = 0; i < bufs_count; i++) {
Expand Down

0 comments on commit 623c6bd

Please sign in to comment.