LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: 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>,
Jason Wang <jasowang@redhat.com>,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org
Subject: [PATCH v2 net 2/3] virtio_net: fix adding vids on big-endian
Date: Thu, 19 Apr 2018 08:30:49 +0300 [thread overview]
Message-ID: <1524115776-334953-3-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1524115776-334953-1-git-send-email-mst@redhat.com>
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,
--
MST
next prev parent reply other threads:[~2018-04-19 5:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 5:30 [PATCH v2 net 0/3] virtio: ctrl buffer fixes Michael S. Tsirkin
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 ` Michael S. Tsirkin [this message]
2018-04-19 12:26 ` [PATCH v2 net 2/3] virtio_net: fix adding vids on big-endian Jason Wang
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
2018-04-19 20:34 ` [PATCH v2 net 0/3] virtio: ctrl buffer fixes David Miller
2018-04-20 0:49 ` Michael S. Tsirkin
2018-04-20 1:10 ` David Miller
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=1524115776-334953-3-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=cohuck@redhat.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=thuth@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--subject='Re: [PATCH v2 net 2/3] virtio_net: fix adding vids on big-endian' \
/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
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).