From: Zhiyong Yang Date: Fri, 11 Aug 2017 02:13:18 +0000 (+0800) Subject: net/virtio: use pointer to replace memcpy X-Git-Tag: spdx-start~1636 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;ds=sidebyside;h=da4f2e4bb76e09a88fe2aabde1f89a7fc0dc9d0f;p=dpdk.git net/virtio: use pointer to replace memcpy To use pointer instead of memcpy can save many cycles in the funciton virtio_send_command. Signed-off-by: Zhiyong Yang Acked-by: Fan Zhang Acked-by: Yuanhan Liu --- diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index a006d4982d..42c2836713 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -163,7 +163,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; @@ -254,10 +254,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