aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hyperv/netvsc_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/hyperv/netvsc_drv.c')
-rw-r--r--drivers/net/hyperv/netvsc_drv.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 1a1ca6cfc74a..466c58a7353d 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -123,7 +123,7 @@ static int netvsc_close(struct net_device *net)
123 struct hv_device *device_obj = net_device_ctx->device_ctx; 123 struct hv_device *device_obj = net_device_ctx->device_ctx;
124 int ret; 124 int ret;
125 125
126 netif_stop_queue(net); 126 netif_tx_disable(net);
127 127
128 ret = rndis_filter_close(device_obj); 128 ret = rndis_filter_close(device_obj);
129 if (ret != 0) 129 if (ret != 0)
@@ -151,10 +151,10 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
151 int ret; 151 int ret;
152 unsigned int i, num_pages, npg_data; 152 unsigned int i, num_pages, npg_data;
153 153
154 /* Add multipage for skb->data and additional one for RNDIS */ 154 /* Add multipages for skb->data and additional 2 for RNDIS */
155 npg_data = (((unsigned long)skb->data + skb_headlen(skb) - 1) 155 npg_data = (((unsigned long)skb->data + skb_headlen(skb) - 1)
156 >> PAGE_SHIFT) - ((unsigned long)skb->data >> PAGE_SHIFT) + 1; 156 >> PAGE_SHIFT) - ((unsigned long)skb->data >> PAGE_SHIFT) + 1;
157 num_pages = skb_shinfo(skb)->nr_frags + npg_data + 1; 157 num_pages = skb_shinfo(skb)->nr_frags + npg_data + 2;
158 158
159 /* Allocate a netvsc packet based on # of frags. */ 159 /* Allocate a netvsc packet based on # of frags. */
160 packet = kzalloc(sizeof(struct hv_netvsc_packet) + 160 packet = kzalloc(sizeof(struct hv_netvsc_packet) +
@@ -173,8 +173,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
173 sizeof(struct hv_netvsc_packet) + 173 sizeof(struct hv_netvsc_packet) +
174 (num_pages * sizeof(struct hv_page_buffer)); 174 (num_pages * sizeof(struct hv_page_buffer));
175 175
176 /* Setup the rndis header */ 176 /* If the rndis msg goes beyond 1 page, we will add 1 later */
177 packet->page_buf_cnt = num_pages; 177 packet->page_buf_cnt = num_pages - 1;
178 178
179 /* Initialize it from the skb */ 179 /* Initialize it from the skb */
180 packet->total_data_buflen = skb->len; 180 packet->total_data_buflen = skb->len;
@@ -256,7 +256,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj,
256 schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); 256 schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20));
257 } else { 257 } else {
258 netif_carrier_off(net); 258 netif_carrier_off(net);
259 netif_stop_queue(net); 259 netif_tx_disable(net);
260 } 260 }
261} 261}
262 262
@@ -298,7 +298,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
298 skb->ip_summed = CHECKSUM_NONE; 298 skb->ip_summed = CHECKSUM_NONE;
299 299
300 net->stats.rx_packets++; 300 net->stats.rx_packets++;
301 net->stats.rx_bytes += skb->len; 301 net->stats.rx_bytes += packet->total_data_buflen;
302 302
303 /* 303 /*
304 * Pass the skb back up. Network stack will deallocate the skb when it 304 * Pass the skb back up. Network stack will deallocate the skb when it
@@ -337,7 +337,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
337 337
338 nvdev->start_remove = true; 338 nvdev->start_remove = true;
339 cancel_delayed_work_sync(&ndevctx->dwork); 339 cancel_delayed_work_sync(&ndevctx->dwork);
340 netif_stop_queue(ndev); 340 netif_tx_disable(ndev);
341 rndis_filter_device_remove(hdev); 341 rndis_filter_device_remove(hdev);
342 342
343 ndev->mtu = mtu; 343 ndev->mtu = mtu;
@@ -460,7 +460,7 @@ static int netvsc_remove(struct hv_device *dev)
460 cancel_delayed_work_sync(&ndev_ctx->dwork); 460 cancel_delayed_work_sync(&ndev_ctx->dwork);
461 461
462 /* Stop outbound asap */ 462 /* Stop outbound asap */
463 netif_stop_queue(net); 463 netif_tx_disable(net);
464 464
465 unregister_netdev(net); 465 unregister_netdev(net);
466 466