Commit a725ee3e authored by Andy Lutomirski's avatar Andy Lutomirski Committed by David S. Miller

virtio-net: Remove more stack DMA

VLAN and MQ control was doing DMA from the stack.  Fix it.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cbce91ca
...@@ -144,8 +144,10 @@ struct virtnet_info { ...@@ -144,8 +144,10 @@ struct virtnet_info {
/* Control VQ buffers: protected by the rtnl lock */ /* Control VQ buffers: protected by the rtnl lock */
struct virtio_net_ctrl_hdr ctrl_hdr; struct virtio_net_ctrl_hdr ctrl_hdr;
virtio_net_ctrl_ack ctrl_status; virtio_net_ctrl_ack ctrl_status;
struct virtio_net_ctrl_mq ctrl_mq;
u8 ctrl_promisc; u8 ctrl_promisc;
u8 ctrl_allmulti; u8 ctrl_allmulti;
u16 ctrl_vid;
/* Ethtool settings */ /* Ethtool settings */
u8 duplex; u8 duplex;
...@@ -1058,14 +1060,13 @@ static void virtnet_ack_link_announce(struct virtnet_info *vi) ...@@ -1058,14 +1060,13 @@ static void virtnet_ack_link_announce(struct virtnet_info *vi)
static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs) static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs)
{ {
struct scatterlist sg; struct scatterlist sg;
struct virtio_net_ctrl_mq s;
struct net_device *dev = vi->dev; struct net_device *dev = vi->dev;
if (!vi->has_cvq || !virtio_has_feature(vi->vdev, VIRTIO_NET_F_MQ)) if (!vi->has_cvq || !virtio_has_feature(vi->vdev, VIRTIO_NET_F_MQ))
return 0; return 0;
s.virtqueue_pairs = cpu_to_virtio16(vi->vdev, queue_pairs); vi->ctrl_mq.virtqueue_pairs = cpu_to_virtio16(vi->vdev, queue_pairs);
sg_init_one(&sg, &s, sizeof(s)); sg_init_one(&sg, &vi->ctrl_mq, sizeof(vi->ctrl_mq));
if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MQ, if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MQ,
VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET, &sg)) { VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET, &sg)) {
...@@ -1172,7 +1173,8 @@ static int virtnet_vlan_rx_add_vid(struct net_device *dev, ...@@ -1172,7 +1173,8 @@ static int virtnet_vlan_rx_add_vid(struct net_device *dev,
struct virtnet_info *vi = netdev_priv(dev); struct virtnet_info *vi = netdev_priv(dev);
struct scatterlist sg; struct scatterlist sg;
sg_init_one(&sg, &vid, sizeof(vid)); vi->ctrl_vid = vid;
sg_init_one(&sg, &vi->ctrl_vid, sizeof(vi->ctrl_vid));
if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
VIRTIO_NET_CTRL_VLAN_ADD, &sg)) VIRTIO_NET_CTRL_VLAN_ADD, &sg))
...@@ -1186,7 +1188,8 @@ static int virtnet_vlan_rx_kill_vid(struct net_device *dev, ...@@ -1186,7 +1188,8 @@ static int virtnet_vlan_rx_kill_vid(struct net_device *dev,
struct virtnet_info *vi = netdev_priv(dev); struct virtnet_info *vi = netdev_priv(dev);
struct scatterlist sg; struct scatterlist sg;
sg_init_one(&sg, &vid, sizeof(vid)); vi->ctrl_vid = vid;
sg_init_one(&sg, &vi->ctrl_vid, sizeof(vi->ctrl_vid));
if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
VIRTIO_NET_CTRL_VLAN_DEL, &sg)) VIRTIO_NET_CTRL_VLAN_DEL, &sg))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment