]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/virtio_net.c
net: Remove redundant NAPI functions
[karo-tx-linux.git] / drivers / net / virtio_net.c
index e6b5d6ef9ea8223868375a0d2f184869b200b447..30ae6d9a12af7016f81c8d6d656417986cb0b96a 100644 (file)
@@ -374,9 +374,9 @@ static void skb_recv_done(struct virtqueue *rvq)
 {
        struct virtnet_info *vi = rvq->vdev->priv;
        /* Schedule NAPI, Suppress further interrupts if successful. */
-       if (netif_rx_schedule_prep(vi->dev, &vi->napi)) {
+       if (napi_schedule_prep(&vi->napi)) {
                rvq->vq_ops->disable_cb(rvq);
-               __netif_rx_schedule(vi->dev, &vi->napi);
+               __napi_schedule(&vi->napi);
        }
 }
 
@@ -402,11 +402,11 @@ again:
 
        /* Out of packets? */
        if (received < budget) {
-               netif_rx_complete(vi->dev, napi);
+               napi_complete(napi);
                if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq))
                    && napi_schedule_prep(napi)) {
                        vi->rvq->vq_ops->disable_cb(vi->rvq);
-                       __netif_rx_schedule(vi->dev, napi);
+                       __napi_schedule(napi);
                        goto again;
                }
        }
@@ -580,9 +580,9 @@ static int virtnet_open(struct net_device *dev)
         * won't get another interrupt, so process any outstanding packets
         * now.  virtnet_poll wants re-enable the queue, so we disable here.
         * We synchronize against interrupts via NAPI_STATE_SCHED */
-       if (netif_rx_schedule_prep(dev, &vi->napi)) {
+       if (napi_schedule_prep(&vi->napi)) {
                vi->rvq->vq_ops->disable_cb(vi->rvq);
-               __netif_rx_schedule(dev, &vi->napi);
+               __napi_schedule(&vi->napi);
        }
        return 0;
 }
@@ -613,6 +613,29 @@ static struct ethtool_ops virtnet_ethtool_ops = {
        .set_tso = ethtool_op_set_tso,
 };
 
+#define MIN_MTU 68
+#define MAX_MTU 65535
+
+static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
+{
+       if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
+               return -EINVAL;
+       dev->mtu = new_mtu;
+       return 0;
+}
+
+static const struct net_device_ops virtnet_netdev = {
+       .ndo_open            = virtnet_open,
+       .ndo_stop            = virtnet_close,
+       .ndo_start_xmit      = start_xmit,
+       .ndo_validate_addr   = eth_validate_addr,
+       .ndo_set_mac_address = eth_mac_addr,
+       .ndo_change_mtu      = virtnet_change_mtu,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller = virtnet_netpoll,
+#endif
+};
+
 static int virtnet_probe(struct virtio_device *vdev)
 {
        int err;
@@ -625,13 +648,8 @@ static int virtnet_probe(struct virtio_device *vdev)
                return -ENOMEM;
 
        /* Set up network device as normal. */
-       dev->open = virtnet_open;
-       dev->stop = virtnet_close;
-       dev->hard_start_xmit = start_xmit;
+       dev->netdev_ops = &virtnet_netdev;
        dev->features = NETIF_F_HIGHDMA;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = virtnet_netpoll;
-#endif
        SET_ETHTOOL_OPS(dev, &virtnet_ethtool_ops);
        SET_NETDEV_DEV(dev, &vdev->dev);