[dpdk-dev] [PATCH] virtio: fix packet corruption

Tan, Jianfeng jianfeng.tan at intel.com
Tue Jul 19 15:03:02 CEST 2016


Hi Oliver,

> -----Original Message-----
> From: Olivier Matz [mailto:olivier.matz at 6wind.com]
> Sent: Tuesday, July 19, 2016 8:32 PM
> To: dev at dpdk.org; Tan, Jianfeng; Xie, Huawei; yuanhan.liu at linux.intel.com
> Subject: [PATCH] virtio: fix packet corruption
> 
> The support of virtio-user changed the way the mbuf dma address is
> retrieved, using a physical address in case of virtio-pci and a virtual
> address in case of virtio-user.
> 
> This change introduced some possible memory corruption in packets,
> replacing:
>   m->buf_physaddr + RTE_PKTMBUF_HEADROOM
> by:
>   m->buf_physaddr + m->data_off     (through a macro)
> 
> This patch fixes this issue, restoring the original behavior.

Could you be more specific on why we cannot use m->data_off here?

Thanks,
Jianfeng

> 
> By the way, it also rework the macros, adding a "VIRTIO_" prefix and
> API comments.
> 
> Fixes: f24f8f9fee8a ("net/virtio: allow virtual address to fill vring descriptors")
> 
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c      |  2 +-
>  drivers/net/virtio/virtio_rxtx.c        |  5 +++--
>  drivers/net/virtio/virtio_rxtx_simple.c | 13 +++++++------
>  drivers/net/virtio/virtqueue.h          | 25 +++++++++++++++++--------
>  4 files changed, 28 insertions(+), 17 deletions(-)
> 



More information about the dev mailing list