patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Jianfeng Tan <jianfeng.tan@intel.com>
To: dev@dpdk.org
Cc: yuanhan.liu@linux.intel.com, olivier.matz@6wind.com,
	Jianfeng Tan <jianfeng.tan@intel.com>,
	stable@dpdk.org
Subject: [dpdk-stable] [PATCH] net/virtio-user: fix not working on 32-bit system
Date: Thu, 13 Apr 2017 14:12:56 +0000	[thread overview]
Message-ID: <1492092776-57008-1-git-send-email-jianfeng.tan@intel.com> (raw)

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 <jianfeng.tan@intel.com>
---
 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

             reply	other threads:[~2017-04-13 14:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13 14:12 Jianfeng Tan [this message]
2017-04-14  5:32 ` Yuanhan Liu
2017-04-14  5:53   ` Tan, Jianfeng
2017-04-14  6:20     ` Yuanhan Liu
2017-04-14  6:56       ` Tan, Jianfeng
2017-04-14  7:01         ` Yuanhan Liu
2017-04-14  7:14           ` Tan, Jianfeng
2017-04-19  2:30 ` [dpdk-stable] [PATCH v2] " Jianfeng Tan
2017-04-19  5:53   ` Yuanhan Liu
2017-04-19  6:21     ` Tan, Jianfeng
2017-04-19  6:24       ` Yuanhan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1492092776-57008-1-git-send-email-jianfeng.tan@intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    --cc=yuanhan.liu@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).