DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] virtio: use pointer to replace memcpy
@ 2017-08-11  2:13 Zhiyong Yang
  2017-10-05  9:31 ` Zhang, Roy Fan
  0 siblings, 1 reply; 3+ messages in thread
From: Zhiyong Yang @ 2017-08-11  2:13 UTC (permalink / raw)
  To: dev; +Cc: maxime.coquelin, yliu, Zhiyong Yang

To use pointer instead of memcpy can save many cycles in the funciton
virtio_send_command.

cc: maxime.coquelin@redhat.com
cc: yliu@fridaylinux.org

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index e320811ed..dff3c4de4 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -162,7 +162,7 @@ virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,
 	uint32_t head, i;
 	int k, sum = 0;
 	virtio_net_ctrl_ack status = ~0;
-	struct virtio_pmd_ctrl result;
+	struct virtio_pmd_ctrl *result;
 	struct virtqueue *vq;
 
 	ctrl->status = status;
@@ -253,10 +253,9 @@ virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,
 	PMD_INIT_LOG(DEBUG, "vq->vq_free_cnt=%d\nvq->vq_desc_head_idx=%d",
 			vq->vq_free_cnt, vq->vq_desc_head_idx);
 
-	memcpy(&result, cvq->virtio_net_hdr_mz->addr,
-			sizeof(struct virtio_pmd_ctrl));
+	result = cvq->virtio_net_hdr_mz->addr;
 
-	return result.status;
+	return result->status;
 }
 
 static int
-- 
2.13.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-06  6:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-11  2:13 [dpdk-dev] [PATCH] virtio: use pointer to replace memcpy Zhiyong Yang
2017-10-05  9:31 ` Zhang, Roy Fan
2017-10-06  6:29   ` Yuanhan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).