From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id BD0E69955 for ; Thu, 25 May 2017 11:51:46 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 May 2017 02:51:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,391,1491289200"; d="scan'208";a="91624535" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 25 May 2017 02:51:45 -0700 From: Yuanhan Liu To: Jianfeng Tan Cc: Yuanhan Liu , dpdk stable Date: Thu, 25 May 2017 17:49:05 +0800 Message-Id: <1495705809-21416-93-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1495705809-21416-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1495705809-21416-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-stable] patch 'net/virtio-user: fix address on 32-bit system' has been queued to stable release 17.02.1 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, 25 May 2017 09:51:47 -0000 Hi, FYI, your patch has been queued to stable release 17.02.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/28/17. So please shout if anyone has objections. Thanks. --yliu --- >>From c8b88c09b7fb33bf9cc43bb43edea285fcdccc21 Mon Sep 17 00:00:00 2001 From: Jianfeng Tan Date: Wed, 19 Apr 2017 02:30:33 +0000 Subject: [PATCH] net/virtio-user: fix address on 32-bit system [ upstream commit 260aae9ad9621e3e758f1443abb8fcbc25ece07c ] 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") Signed-off-by: Jianfeng Tan Acked-by: Yuanhan Liu --- drivers/net/virtio/virtqueue.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index f9e3736..2e12086 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -71,8 +71,14 @@ struct rte_mbuf; /** * Return the physical address (or virtual address in case of * virtio-user) of mbuf data buffer. + * + * The address is firstly casted to the word size (sizeof(uintptr_t)) + * before casting it to uint64_t. This is to make it work with different + * combination of word size (64 bit and 32 bit) and virtio device + * (virtio-pci and virtio-user). */ -#define VIRTIO_MBUF_ADDR(mb, vq) (*(uint64_t *)((uintptr_t)(mb) + (vq)->offset)) +#define VIRTIO_MBUF_ADDR(mb, vq) \ + ((uint64_t)(*(uintptr_t *)((uintptr_t)(mb) + (vq)->offset))) #else #define VIRTIO_MBUF_ADDR(mb, vq) ((mb)->buf_physaddr) #endif -- 1.9.0