From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 51A832C6E; Thu, 13 Apr 2017 16:12:11 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP; 13 Apr 2017 07:12:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,194,1488873600"; d="scan'208";a="955733192" Received: from dpdk06.sh.intel.com ([10.239.129.195]) by orsmga003.jf.intel.com with ESMTP; 13 Apr 2017 07:12:08 -0700 From: Jianfeng Tan To: dev@dpdk.org Cc: yuanhan.liu@linux.intel.com, olivier.matz@6wind.com, Jianfeng Tan , stable@dpdk.org Date: Thu, 13 Apr 2017 14:12:56 +0000 Message-Id: <1492092776-57008-1-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-stable] [PATCH] net/virtio-user: fix not working on 32-bit system X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Apr 2017 14:12:12 -0000 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. This is a regression bug. For 32-bit system, the first 4 bytes is the virtual address, with following 8 bytes pointing to physical addr. With below wrong definition, both virtual address and lower 4 bytes of physical addr are obtained. #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 --- drivers/net/virtio/virtqueue.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index f9e3736..f43ea70 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -72,7 +72,8 @@ struct rte_mbuf; * Return the physical address (or virtual address in case of * virtio-user) of mbuf data buffer. */ -#define VIRTIO_MBUF_ADDR(mb, vq) (*(uint64_t *)((uintptr_t)(mb) + (vq)->offset)) +#define VIRTIO_MBUF_ADDR(mb, vq) \ + ((uint64_t)((uintptr_t)(*(void **)((uintptr_t)(mb) + (vq)->offset)))) #else #define VIRTIO_MBUF_ADDR(mb, vq) ((mb)->buf_physaddr) #endif -- 2.7.4