netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, linux-kernel@vger.kernel.org
Cc: Mikulas Patocka <mpatocka@redhat.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	David Miller <davem@davemloft.net>,
	Thomas Huth <thuth@redhat.com>, Cornelia Huck <cohuck@redhat.com>,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2 net 2/3] virtio_net: fix adding vids on big-endian
Date: Thu, 19 Apr 2018 20:26:57 +0800	[thread overview]
Message-ID: <c7090eff-9bb7-a9a5-0d00-304fb73388d7@redhat.com> (raw)
In-Reply-To: <1524115776-334953-3-git-send-email-mst@redhat.com>



On 2018年04月19日 13:30, Michael S. Tsirkin wrote:
> Programming vids (adding or removing them) still passes
> guest-endian values in the DMA buffer. That's wrong
> if guest is big-endian and when virtio 1 is enabled.
>
> Note: this is on top of a previous patch:
> 	virtio_net: split out ctrl buffer
>
> Fixes: 9465a7a6f ("virtio_net: enable v1.0 support")
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   drivers/net/virtio_net.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 3d0eff53..f84fe04 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -154,7 +154,7 @@ struct control_buf {
>   	struct virtio_net_ctrl_mq mq;
>   	u8 promisc;
>   	u8 allmulti;
> -	u16 vid;
> +	__virtio16 vid;
>   	u64 offloads;
>   };
>   
> @@ -1718,7 +1718,7 @@ static int virtnet_vlan_rx_add_vid(struct net_device *dev,
>   	struct virtnet_info *vi = netdev_priv(dev);
>   	struct scatterlist sg;
>   
> -	vi->ctrl->vid = vid;
> +	vi->ctrl->vid = cpu_to_virtio16(vi->vdev, vid);
>   	sg_init_one(&sg, &vi->ctrl->vid, sizeof(vi->ctrl->vid));
>   
>   	if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
> @@ -1733,7 +1733,7 @@ static int virtnet_vlan_rx_kill_vid(struct net_device *dev,
>   	struct virtnet_info *vi = netdev_priv(dev);
>   	struct scatterlist sg;
>   
> -	vi->ctrl->vid = vid;
> +	vi->ctrl->vid = cpu_to_virtio16(vi->vdev, vid);
>   	sg_init_one(&sg, &vi->ctrl->vid, sizeof(vi->ctrl->vid));
>   
>   	if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,

Acked-by: Jason Wang <jasowang@redhat.com>

  reply	other threads:[~2018-04-19 12:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1524115776-334953-1-git-send-email-mst@redhat.com>
2018-04-19  5:30 ` [PATCH v2 net 1/3] virtio_net: split out ctrl buffer Michael S. Tsirkin
2018-04-19 12:26   ` Jason Wang
2018-04-19  5:30 ` [PATCH v2 net 2/3] virtio_net: fix adding vids on big-endian Michael S. Tsirkin
2018-04-19 12:26   ` Jason Wang [this message]
2018-04-19 13:26   ` Cornelia Huck
2018-04-19 14:56     ` Michael S. Tsirkin
2018-04-19  5:30 ` [PATCH v2 net 3/3] virtio_net: sparse annotation fix Michael S. Tsirkin
2018-04-19 12:27   ` Jason Wang

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=c7090eff-9bb7-a9a5-0d00-304fb73388d7@redhat.com \
    --to=jasowang@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=thuth@redhat.com \
    --cc=virtualization@lists.linux-foundation.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 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).