net/virtio-user: fix address on 32-bit system
authorJianfeng Tan <jianfeng.tan@intel.com>
Wed, 19 Apr 2017 02:30:33 +0000 (02:30 +0000)
committerYuanhan Liu <yuanhan.liu@linux.intel.com>
Wed, 19 Apr 2017 08:49:06 +0000 (10:49 +0200)
commit260aae9ad9621e3e758f1443abb8fcbc25ece07c
tree50334414a727727aa75a7891f82497e04ac92019
parentcca5c0c0082c93532a56444b93e42dfac589ba4b
net/virtio-user: fix address on 32-bit system

virtio-user cannot work on 32-bit system as higher 32-bit of the
addr field (64-bit) in the desc is filled with non-zero value
which should not happen for a 32-bit system.

In case of virtio-user, we use buf_addr of mbuf to fill the
virtqueue desc addr. This is a regression bug. For 32-bit system,
the first 4 bytes of mbuf is buf_addr, with following 8 bytes for
buf_phyaddr. With below wrong definition, both buf_addr and lower
4 bytes buf_phyaddr are obtained to fill the virtqueue desc.
  #define VIRTIO_MBUF_ADDR(mb, vq) \
(*(uint64_t *)((uintptr_t)(mb) + (vq)->offset))

Fixes: 25f80d108780 ("net/virtio: fix packet corruption")
Cc: stable@dpdk.org
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
drivers/net/virtio/virtqueue.h