net/virtio: fix packet corruption
authorOlivier Matz <olivier.matz@6wind.com>
Tue, 19 Jul 2016 12:31:59 +0000 (14:31 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 21 Jul 2016 22:27:29 +0000 (00:27 +0200)
commit25f80d1087809b6efedc85923310f571aae2668f
tree3052652f556c04abde8b851efc513af702bac099
parent164fd396788d666d6cb48adc305a38419cd176c4
net/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.

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@6wind.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
drivers/net/virtio/virtio_ethdev.c
drivers/net/virtio/virtio_rxtx.c
drivers/net/virtio/virtio_rxtx_simple.c
drivers/net/virtio/virtqueue.h