Commit 325b7db3 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Gerrit Code Review
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 8d424e6e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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__ */
+1 −1
Original line number Diff line number Diff line
@@ -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;
+5 −0
Original line number Diff line number Diff line
@@ -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__ */