Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / net / virtio_net.c
index d88d436..3c23fdc 100644 (file)
@@ -153,7 +153,7 @@ struct padded_vnet_hdr {
  */
 static int vq2txq(struct virtqueue *vq)
 {
-       return (virtqueue_get_queue_index(vq) - 1) / 2;
+       return (vq->index - 1) / 2;
 }
 
 static int txq2vq(int txq)
@@ -163,7 +163,7 @@ static int txq2vq(int txq)
 
 static int vq2rxq(struct virtqueue *vq)
 {
-       return virtqueue_get_queue_index(vq) / 2;
+       return vq->index / 2;
 }
 
 static int rxq2vq(int rxq)
@@ -581,7 +581,7 @@ static void refill_work(struct work_struct *work)
        bool still_empty;
        int i;
 
-       for (i = 0; i < vi->max_queue_pairs; i++) {
+       for (i = 0; i < vi->curr_queue_pairs; i++) {
                struct receive_queue *rq = &vi->rq[i];
 
                napi_disable(&rq->napi);
@@ -636,7 +636,7 @@ static int virtnet_open(struct net_device *dev)
        struct virtnet_info *vi = netdev_priv(dev);
        int i;
 
-       for (i = 0; i < vi->max_queue_pairs; i++) {
+       for (i = 0; i < vi->curr_queue_pairs; i++) {
                /* Make sure we have some buffers: if oom use wq. */
                if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
                        schedule_delayed_work(&vi->refill, 0);
@@ -900,6 +900,7 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs)
        struct scatterlist sg;
        struct virtio_net_ctrl_mq s;
        struct net_device *dev = vi->dev;
+       int i;
 
        if (!vi->has_cvq || !virtio_has_feature(vi->vdev, VIRTIO_NET_F_MQ))
                return 0;
@@ -912,8 +913,12 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs)
                dev_warn(&dev->dev, "Fail to set num of queue pairs to %d\n",
                         queue_pairs);
                return -EINVAL;
-       } else
+       } else {
+               for (i = vi->curr_queue_pairs; i < queue_pairs; i++)
+                       if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
+                               schedule_delayed_work(&vi->refill, 0);
                vi->curr_queue_pairs = queue_pairs;
+       }
 
        return 0;
 }
@@ -1006,7 +1011,8 @@ static void virtnet_set_rx_mode(struct net_device *dev)
        kfree(buf);
 }
 
-static int virtnet_vlan_rx_add_vid(struct net_device *dev, u16 vid)
+static int virtnet_vlan_rx_add_vid(struct net_device *dev,
+                                  __be16 proto, u16 vid)
 {
        struct virtnet_info *vi = netdev_priv(dev);
        struct scatterlist sg;
@@ -1019,7 +1025,8 @@ static int virtnet_vlan_rx_add_vid(struct net_device *dev, u16 vid)
        return 0;
 }
 
-static int virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
+static int virtnet_vlan_rx_kill_vid(struct net_device *dev,
+                                   __be16 proto, u16 vid)
 {
        struct virtnet_info *vi = netdev_priv(dev);
        struct scatterlist sg;
@@ -1376,7 +1383,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
        if (vi->has_cvq) {
                vi->cvq = vqs[total_vqs - 1];
                if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN))
-                       vi->dev->features |= NETIF_F_HW_VLAN_FILTER;
+                       vi->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
        }
 
        for (i = 0; i < vi->max_queue_pairs; i++) {
@@ -1511,6 +1518,8 @@ static int virtnet_probe(struct virtio_device *vdev)
                /* (!csum && gso) case will be fixed by register_netdev() */
        }
 
+       dev->vlan_features = dev->features;
+
        /* Configuration may specify what MAC to use.  Otherwise random. */
        if (virtio_config_val_len(vdev, VIRTIO_NET_F_MAC,
                                  offsetof(struct virtio_net_config, mac),
@@ -1566,7 +1575,7 @@ static int virtnet_probe(struct virtio_device *vdev)
        }
 
        /* Last of all, set up some receive buffers. */
-       for (i = 0; i < vi->max_queue_pairs; i++) {
+       for (i = 0; i < vi->curr_queue_pairs; i++) {
                try_fill_recv(&vi->rq[i], GFP_KERNEL);
 
                /* If we didn't even get one input buffer, we're useless. */
@@ -1690,7 +1699,7 @@ static int virtnet_restore(struct virtio_device *vdev)
 
        netif_device_attach(vi->dev);
 
-       for (i = 0; i < vi->max_queue_pairs; i++)
+       for (i = 0; i < vi->curr_queue_pairs; i++)
                if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
                        schedule_delayed_work(&vi->refill, 0);