* [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
* Re: [dpdk-dev] [PATCH] virtio: use pointer to replace memcpy
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
0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Roy Fan @ 2017-10-05 9:31 UTC (permalink / raw)
To: Yang, Zhiyong, dev; +Cc: maxime.coquelin, yliu, Yang, Zhiyong
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhiyong Yang
> Sent: Friday, August 11, 2017 3:13 AM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; yliu@fridaylinux.org; Yang, Zhiyong
> <zhiyong.yang@intel.com>
> Subject: [dpdk-dev] [PATCH] virtio: use pointer to replace memcpy
>
> 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(-)
>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] virtio: use pointer to replace memcpy
2017-10-05 9:31 ` Zhang, Roy Fan
@ 2017-10-06 6:29 ` Yuanhan Liu
0 siblings, 0 replies; 3+ messages in thread
From: Yuanhan Liu @ 2017-10-06 6:29 UTC (permalink / raw)
To: Zhang, Roy Fan; +Cc: Yang, Zhiyong, dev, maxime.coquelin
On Thu, Oct 05, 2017 at 09:31:25AM +0000, Zhang, Roy Fan wrote:
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhiyong Yang
> > Sent: Friday, August 11, 2017 3:13 AM
> > To: dev@dpdk.org
> > Cc: maxime.coquelin@redhat.com; yliu@fridaylinux.org; Yang, Zhiyong
> > <zhiyong.yang@intel.com>
> > Subject: [dpdk-dev] [PATCH] virtio: use pointer to replace memcpy
> >
> > 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(-)
> >
>
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Applied to dpdk-next-virtio.
Thanks.
--yliu
^ 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).