diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2018-04-19 01:30:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-19 16:33:20 -0400 |
commit | d7fad4c840f33a6bd333dd7fbb3006edbcf0017a (patch) | |
tree | a175512973cb6d5897590ead3ba947de5bb1f503 | |
parent | 12e571693837d6164bda61e316b1944972ee0d97 (diff) |
virtio_net: fix adding vids on big-endian
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>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/virtio_net.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 9a675250107f..16b0c7db431b 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -154,7 +154,7 @@ struct control_buf { | |||
154 | struct virtio_net_ctrl_mq mq; | 154 | struct virtio_net_ctrl_mq mq; |
155 | u8 promisc; | 155 | u8 promisc; |
156 | u8 allmulti; | 156 | u8 allmulti; |
157 | u16 vid; | 157 | __virtio16 vid; |
158 | u64 offloads; | 158 | u64 offloads; |
159 | }; | 159 | }; |
160 | 160 | ||
@@ -1725,7 +1725,7 @@ static int virtnet_vlan_rx_add_vid(struct net_device *dev, | |||
1725 | struct virtnet_info *vi = netdev_priv(dev); | 1725 | struct virtnet_info *vi = netdev_priv(dev); |
1726 | struct scatterlist sg; | 1726 | struct scatterlist sg; |
1727 | 1727 | ||
1728 | vi->ctrl->vid = vid; | 1728 | vi->ctrl->vid = cpu_to_virtio16(vi->vdev, vid); |
1729 | sg_init_one(&sg, &vi->ctrl->vid, sizeof(vi->ctrl->vid)); | 1729 | sg_init_one(&sg, &vi->ctrl->vid, sizeof(vi->ctrl->vid)); |
1730 | 1730 | ||
1731 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, | 1731 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, |
@@ -1740,7 +1740,7 @@ static int virtnet_vlan_rx_kill_vid(struct net_device *dev, | |||
1740 | struct virtnet_info *vi = netdev_priv(dev); | 1740 | struct virtnet_info *vi = netdev_priv(dev); |
1741 | struct scatterlist sg; | 1741 | struct scatterlist sg; |
1742 | 1742 | ||
1743 | vi->ctrl->vid = vid; | 1743 | vi->ctrl->vid = cpu_to_virtio16(vi->vdev, vid); |
1744 | sg_init_one(&sg, &vi->ctrl->vid, sizeof(vi->ctrl->vid)); | 1744 | sg_init_one(&sg, &vi->ctrl->vid, sizeof(vi->ctrl->vid)); |
1745 | 1745 | ||
1746 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, | 1746 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, |