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:
parent
8d424e6e71
commit
325b7db392
@ -40,6 +40,7 @@
|
|||||||
#include <rte_malloc.h>
|
#include <rte_malloc.h>
|
||||||
#include <rte_config.h>
|
#include <rte_config.h>
|
||||||
#include <rte_mempool.h>
|
#include <rte_mempool.h>
|
||||||
|
#include <rte_memcpy.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
@ -161,4 +162,9 @@ nvme_mutex_init_recursive(nvme_mutex_t *mtx)
|
|||||||
return rc;
|
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__ */
|
#endif /* __NVME_IMPL_H__ */
|
||||||
|
@ -624,7 +624,7 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr)
|
|||||||
qpair->act_tr[tr->cid] = tr;
|
qpair->act_tr[tr->cid] = tr;
|
||||||
|
|
||||||
/* Copy the command from the tracker to the submission queue. */
|
/* 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) {
|
if (++qpair->sq_tail == qpair->num_entries) {
|
||||||
qpair->sq_tail = 0;
|
qpair->sq_tail = 0;
|
||||||
|
@ -107,4 +107,9 @@ nvme_mutex_init_recursive(nvme_mutex_t *mtx)
|
|||||||
return pthread_mutex_init(mtx, &attr);
|
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__ */
|
#endif /* __NVME_IMPL_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user