]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/virtio_net.c
Merge branch 'master' into tk71
[mv-sheeva.git] / drivers / net / virtio_net.c
index 4598e9d2608f7ca4c098d8745432a8a6151de757..82dba5aaf423e386a96a4d4fa1e2eef54d7db34d 100644 (file)
@@ -446,6 +446,20 @@ static void skb_recv_done(struct virtqueue *rvq)
        }
 }
 
+static void virtnet_napi_enable(struct virtnet_info *vi)
+{
+       napi_enable(&vi->napi);
+
+       /* If all buffers were filled by other side before we napi_enabled, we
+        * 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 (napi_schedule_prep(&vi->napi)) {
+               virtqueue_disable_cb(vi->rvq);
+               __napi_schedule(&vi->napi);
+       }
+}
+
 static void refill_work(struct work_struct *work)
 {
        struct virtnet_info *vi;
@@ -454,7 +468,7 @@ static void refill_work(struct work_struct *work)
        vi = container_of(work, struct virtnet_info, refill.work);
        napi_disable(&vi->napi);
        still_empty = !try_fill_recv(vi, GFP_KERNEL);
-       napi_enable(&vi->napi);
+       virtnet_napi_enable(vi);
 
        /* In theory, this can happen: if we don't get any buffers in
         * we will *never* try to fill again. */
@@ -519,7 +533,7 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
 
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
                hdr->hdr.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
-               hdr->hdr.csum_start = skb->csum_start - skb_headroom(skb);
+               hdr->hdr.csum_start = skb_checksum_start_offset(skb);
                hdr->hdr.csum_offset = skb->csum_offset;
        } else {
                hdr->hdr.flags = 0;
@@ -638,16 +652,7 @@ static int virtnet_open(struct net_device *dev)
 {
        struct virtnet_info *vi = netdev_priv(dev);
 
-       napi_enable(&vi->napi);
-
-       /* If all buffers were filled by other side before we napi_enabled, we
-        * 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 (napi_schedule_prep(&vi->napi)) {
-               virtqueue_disable_cb(vi->rvq);
-               __napi_schedule(&vi->napi);
-       }
+       virtnet_napi_enable(vi);
        return 0;
 }
 
@@ -705,19 +710,6 @@ static int virtnet_close(struct net_device *dev)
        return 0;
 }
 
-static void virtnet_get_drvinfo(struct net_device *dev,
-                               struct ethtool_drvinfo *drvinfo)
-{
-       struct virtnet_info *vi = netdev_priv(dev);
-       struct virtio_device *vdev = vi->vdev;
-
-       strncpy(drvinfo->driver, KBUILD_MODNAME, ARRAY_SIZE(drvinfo->driver));
-       strncpy(drvinfo->version, "N/A", ARRAY_SIZE(drvinfo->version));
-       strncpy(drvinfo->fw_version, "N/A", ARRAY_SIZE(drvinfo->fw_version));
-       strncpy(drvinfo->bus_info, dev_name(&vdev->dev),
-               ARRAY_SIZE(drvinfo->bus_info));
-}
-
 static int virtnet_set_tx_csum(struct net_device *dev, u32 data)
 {
        struct virtnet_info *vi = netdev_priv(dev);
@@ -830,7 +822,6 @@ static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
 }
 
 static const struct ethtool_ops virtnet_ethtool_ops = {
-       .get_drvinfo = virtnet_get_drvinfo,
        .set_tx_csum = virtnet_set_tx_csum,
        .set_sg = ethtool_op_set_sg,
        .set_tso = ethtool_op_set_tso,
@@ -1000,9 +991,15 @@ static int virtnet_probe(struct virtio_device *vdev)
                goto unregister;
        }
 
-       vi->status = VIRTIO_NET_S_LINK_UP;
-       virtnet_update_status(vi);
-       netif_carrier_on(dev);
+       /* Assume link up if device can't report link status,
+          otherwise get link status from config. */
+       if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) {
+               netif_carrier_off(dev);
+               virtnet_update_status(vi);
+       } else {
+               vi->status = VIRTIO_NET_S_LINK_UP;
+               netif_carrier_on(dev);
+       }
 
        pr_debug("virtnet: registered device %s\n", dev->name);
        return 0;