From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Jianfeng Tan <jianfeng.tan@intel.com>
Cc: dev@dpdk.org, olivier.matz@6wind.com, stable@dpdk.org
Subject: Re: [PATCH v2] net/virtio-user: fix not working on 32-bit system
Date: Wed, 19 Apr 2017 13:53:49 +0800 [thread overview]
Message-ID: <20170419055349.GA31523@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <1492569033-140348-1-git-send-email-jianfeng.tan@intel.com>
On Wed, Apr 19, 2017 at 02:30:33AM +0000, Jianfeng Tan wrote:
> 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>
> ---
> drivers/net/virtio/virtqueue.h | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
> index f9e3736..2e67460 100644
> --- a/drivers/net/virtio/virtqueue.h
> +++ b/drivers/net/virtio/virtqueue.h
> @@ -69,10 +69,16 @@ struct rte_mbuf;
>
> #ifdef RTE_VIRTIO_USER
> /**
> - * Return the physical address (or virtual address in case of
> - * virtio-user) of mbuf data buffer.
> + *
> + * Return the physical address of mbuf data buffer for virtio pci:
> + * on 32-bit system, offset equals 4, return the second four bytes of mbuf;
> + * on 64-bit system, offset equals 8, return the second eight bytes of mbuf.
> + * Return the virtual address of mbuf data buffer for virtio-user.
> + * on 32-bit system, offset equals 0, return the first four bytes of mbuf;
> + * on 64-bit system, offset equals 0, return the first eight bytes of mbuf;
I've expected it to be plain english, something like following:
/*
* 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).
*/
Okay to you?
--yliu
next prev parent reply other threads:[~2017-04-19 5:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-13 14:12 [PATCH] net/virtio-user: fix not working on 32-bit system Jianfeng Tan
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 ` [PATCH v2] " Jianfeng Tan
2017-04-19 5:53 ` Yuanhan Liu [this message]
2017-04-19 6:21 ` Tan, Jianfeng
2017-04-19 6:24 ` Yuanhan Liu
-- strict thread matches above, loose matches on Subject: below --
2017-09-19 22:24 Jim Murphy
2017-09-20 2:17 ` Tan, Jianfeng
2017-09-20 2:55 ` Jim Murphy
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=20170419055349.GA31523@yliu-dev.sh.intel.com \
--to=yuanhan.liu@linux.intel.com \
--cc=dev@dpdk.org \
--cc=jianfeng.tan@intel.com \
--cc=olivier.matz@6wind.com \
--cc=stable@dpdk.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.