diff options
Diffstat (limited to 'drivers/net/hyperv/netvsc_drv.c')
-rw-r--r-- | drivers/net/hyperv/netvsc_drv.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 462d05f05e84..466c58a7353d 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -68,11 +68,11 @@ static void do_set_multicast(struct work_struct *w) | |||
68 | 68 | ||
69 | nvdev = hv_get_drvdata(ndevctx->device_ctx); | 69 | nvdev = hv_get_drvdata(ndevctx->device_ctx); |
70 | if (nvdev == NULL) | 70 | if (nvdev == NULL) |
71 | return; | 71 | goto out; |
72 | 72 | ||
73 | rdev = nvdev->extension; | 73 | rdev = nvdev->extension; |
74 | if (rdev == NULL) | 74 | if (rdev == NULL) |
75 | return; | 75 | goto out; |
76 | 76 | ||
77 | if (net->flags & IFF_PROMISC) | 77 | if (net->flags & IFF_PROMISC) |
78 | rndis_filter_set_packet_filter(rdev, | 78 | rndis_filter_set_packet_filter(rdev, |
@@ -83,6 +83,7 @@ static void do_set_multicast(struct work_struct *w) | |||
83 | NDIS_PACKET_TYPE_ALL_MULTICAST | | 83 | NDIS_PACKET_TYPE_ALL_MULTICAST | |
84 | NDIS_PACKET_TYPE_DIRECTED); | 84 | NDIS_PACKET_TYPE_DIRECTED); |
85 | 85 | ||
86 | out: | ||
86 | kfree(w); | 87 | kfree(w); |
87 | } | 88 | } |
88 | 89 | ||
@@ -122,7 +123,7 @@ static int netvsc_close(struct net_device *net) | |||
122 | struct hv_device *device_obj = net_device_ctx->device_ctx; | 123 | struct hv_device *device_obj = net_device_ctx->device_ctx; |
123 | int ret; | 124 | int ret; |
124 | 125 | ||
125 | netif_stop_queue(net); | 126 | netif_tx_disable(net); |
126 | 127 | ||
127 | ret = rndis_filter_close(device_obj); | 128 | ret = rndis_filter_close(device_obj); |
128 | if (ret != 0) | 129 | if (ret != 0) |
@@ -150,10 +151,10 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) | |||
150 | int ret; | 151 | int ret; |
151 | unsigned int i, num_pages, npg_data; | 152 | unsigned int i, num_pages, npg_data; |
152 | 153 | ||
153 | /* Add multipage for skb->data and additional one for RNDIS */ | 154 | /* Add multipages for skb->data and additional 2 for RNDIS */ |
154 | npg_data = (((unsigned long)skb->data + skb_headlen(skb) - 1) | 155 | npg_data = (((unsigned long)skb->data + skb_headlen(skb) - 1) |
155 | >> PAGE_SHIFT) - ((unsigned long)skb->data >> PAGE_SHIFT) + 1; | 156 | >> PAGE_SHIFT) - ((unsigned long)skb->data >> PAGE_SHIFT) + 1; |
156 | num_pages = skb_shinfo(skb)->nr_frags + npg_data + 1; | 157 | num_pages = skb_shinfo(skb)->nr_frags + npg_data + 2; |
157 | 158 | ||
158 | /* Allocate a netvsc packet based on # of frags. */ | 159 | /* Allocate a netvsc packet based on # of frags. */ |
159 | packet = kzalloc(sizeof(struct hv_netvsc_packet) + | 160 | packet = kzalloc(sizeof(struct hv_netvsc_packet) + |
@@ -172,8 +173,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) | |||
172 | sizeof(struct hv_netvsc_packet) + | 173 | sizeof(struct hv_netvsc_packet) + |
173 | (num_pages * sizeof(struct hv_page_buffer)); | 174 | (num_pages * sizeof(struct hv_page_buffer)); |
174 | 175 | ||
175 | /* Setup the rndis header */ | 176 | /* If the rndis msg goes beyond 1 page, we will add 1 later */ |
176 | packet->page_buf_cnt = num_pages; | 177 | packet->page_buf_cnt = num_pages - 1; |
177 | 178 | ||
178 | /* Initialize it from the skb */ | 179 | /* Initialize it from the skb */ |
179 | packet->total_data_buflen = skb->len; | 180 | packet->total_data_buflen = skb->len; |
@@ -255,7 +256,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, | |||
255 | schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); | 256 | schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); |
256 | } else { | 257 | } else { |
257 | netif_carrier_off(net); | 258 | netif_carrier_off(net); |
258 | netif_stop_queue(net); | 259 | netif_tx_disable(net); |
259 | } | 260 | } |
260 | } | 261 | } |
261 | 262 | ||
@@ -297,7 +298,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, | |||
297 | skb->ip_summed = CHECKSUM_NONE; | 298 | skb->ip_summed = CHECKSUM_NONE; |
298 | 299 | ||
299 | net->stats.rx_packets++; | 300 | net->stats.rx_packets++; |
300 | net->stats.rx_bytes += skb->len; | 301 | net->stats.rx_bytes += packet->total_data_buflen; |
301 | 302 | ||
302 | /* | 303 | /* |
303 | * 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 |
@@ -336,7 +337,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) | |||
336 | 337 | ||
337 | nvdev->start_remove = true; | 338 | nvdev->start_remove = true; |
338 | cancel_delayed_work_sync(&ndevctx->dwork); | 339 | cancel_delayed_work_sync(&ndevctx->dwork); |
339 | netif_stop_queue(ndev); | 340 | netif_tx_disable(ndev); |
340 | rndis_filter_device_remove(hdev); | 341 | rndis_filter_device_remove(hdev); |
341 | 342 | ||
342 | ndev->mtu = mtu; | 343 | ndev->mtu = mtu; |
@@ -459,7 +460,7 @@ static int netvsc_remove(struct hv_device *dev) | |||
459 | cancel_delayed_work_sync(&ndev_ctx->dwork); | 460 | cancel_delayed_work_sync(&ndev_ctx->dwork); |
460 | 461 | ||
461 | /* Stop outbound asap */ | 462 | /* Stop outbound asap */ |
462 | netif_stop_queue(net); | 463 | netif_tx_disable(net); |
463 | 464 | ||
464 | unregister_netdev(net); | 465 | unregister_netdev(net); |
465 | 466 | ||