nvme: use rte_memcpy() to submit commands

GCC generates a series of 64-bit MOV instructions for the memcpy() into
the submission queue.  We can do better with 128-bit SSE2 instructions.

DPDK already has a memcpy implementation that is optimized for small
inline copies, so use it instead of memcpy.

Change-Id: I5f09259b4d5cb089ace4a8ea6d2078c03fee84f3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2015-09-23 17:49:22 -07:00 committed by Gerrit Code Review
parent 8d424e6e71
commit 325b7db392
3 changed files with 12 additions and 1 deletions

View File

@ -40,6 +40,7 @@
#include <rte_malloc.h>
#include <rte_config.h>
#include <rte_mempool.h>
#include <rte_memcpy.h>
/**
* \file
@ -161,4 +162,9 @@ nvme_mutex_init_recursive(nvme_mutex_t *mtx)
return rc;
}
/**
* Copy a struct nvme_command from one memory location to another.
*/
#define nvme_copy_command(dst, src) rte_memcpy((dst), (src), sizeof(struct nvme_command))
#endif /* __NVME_IMPL_H__ */

View File

@ -624,7 +624,7 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr)
qpair->act_tr[tr->cid] = tr;
/* Copy the command from the tracker to the submission queue. */
memcpy(&qpair->cmd[qpair->sq_tail], &req->cmd, sizeof(req->cmd));
nvme_copy_command(&qpair->cmd[qpair->sq_tail], &req->cmd);
if (++qpair->sq_tail == qpair->num_entries) {
qpair->sq_tail = 0;

View File

@ -107,4 +107,9 @@ nvme_mutex_init_recursive(nvme_mutex_t *mtx)
return pthread_mutex_init(mtx, &attr);
}
/**
* Copy a struct nvme_command from one memory location to another.
*/
#define nvme_copy_command(dst, src) memcpy((dst), (src), sizeof(struct nvme_command))
#endif /* __NVME_IMPL_H__ */