Merge tag 'driver-core-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / net / hyperv / netvsc_drv.c
index 1a1ca6cfc74aada9edf64b494cefa743b95276ae..610860f28968a4460aaa63d5004cd69d668216aa 100644 (file)
@@ -123,7 +123,7 @@ static int netvsc_close(struct net_device *net)
        struct hv_device *device_obj = net_device_ctx->device_ctx;
        int ret;
 
-       netif_stop_queue(net);
+       netif_tx_disable(net);
 
        ret = rndis_filter_close(device_obj);
        if (ret != 0)
@@ -151,10 +151,10 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
        int ret;
        unsigned int i, num_pages, npg_data;
 
-       /* Add multipage for skb->data and additional one for RNDIS */
+       /* Add multipages for skb->data and additional 2 for RNDIS */
        npg_data = (((unsigned long)skb->data + skb_headlen(skb) - 1)
                >> PAGE_SHIFT) - ((unsigned long)skb->data >> PAGE_SHIFT) + 1;
-       num_pages = skb_shinfo(skb)->nr_frags + npg_data + 1;
+       num_pages = skb_shinfo(skb)->nr_frags + npg_data + 2;
 
        /* Allocate a netvsc packet based on # of frags. */
        packet = kzalloc(sizeof(struct hv_netvsc_packet) +
@@ -166,15 +166,15 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
 
                dev_kfree_skb(skb);
                net->stats.tx_dropped++;
-               return NETDEV_TX_BUSY;
+               return NETDEV_TX_OK;
        }
 
        packet->extension = (void *)(unsigned long)packet +
                                sizeof(struct hv_netvsc_packet) +
                                    (num_pages * sizeof(struct hv_page_buffer));
 
-       /* Setup the rndis header */
-       packet->page_buf_cnt = num_pages;
+       /* If the rndis msg goes beyond 1 page, we will add 1 later */
+       packet->page_buf_cnt = num_pages - 1;
 
        /* Initialize it from the skb */
        packet->total_data_buflen = skb->len;
@@ -226,7 +226,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
                dev_kfree_skb_any(skb);
        }
 
-       return ret ? NETDEV_TX_BUSY : NETDEV_TX_OK;
+       return NETDEV_TX_OK;
 }
 
 /*
@@ -256,7 +256,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj,
                schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20));
        } else {
                netif_carrier_off(net);
-               netif_stop_queue(net);
+               netif_tx_disable(net);
        }
 }
 
@@ -298,7 +298,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
        skb->ip_summed = CHECKSUM_NONE;
 
        net->stats.rx_packets++;
-       net->stats.rx_bytes += skb->len;
+       net->stats.rx_bytes += packet->total_data_buflen;
 
        /*
         * Pass the skb back up. Network stack will deallocate the skb when it
@@ -313,7 +313,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
 static void netvsc_get_drvinfo(struct net_device *net,
                               struct ethtool_drvinfo *info)
 {
-       strcpy(info->driver, "hv_netvsc");
+       strcpy(info->driver, KBUILD_MODNAME);
        strcpy(info->version, HV_DRV_VERSION);
        strcpy(info->fw_version, "N/A");
 }
@@ -337,7 +337,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
 
        nvdev->start_remove = true;
        cancel_delayed_work_sync(&ndevctx->dwork);
-       netif_stop_queue(ndev);
+       netif_tx_disable(ndev);
        rndis_filter_device_remove(hdev);
 
        ndev->mtu = mtu;
@@ -460,7 +460,7 @@ static int netvsc_remove(struct hv_device *dev)
        cancel_delayed_work_sync(&ndev_ctx->dwork);
 
        /* Stop outbound asap */
-       netif_stop_queue(net);
+       netif_tx_disable(net);
 
        unregister_netdev(net);
 
@@ -485,7 +485,7 @@ MODULE_DEVICE_TABLE(vmbus, id_table);
 
 /* The one and only one */
 static struct  hv_driver netvsc_drv = {
-       .name = "netvsc",
+       .name = KBUILD_MODNAME,
        .id_table = id_table,
        .probe = netvsc_probe,
        .remove = netvsc_remove,