Staging: hv: remove PFN_CHANNEL_CALLBACK
[linux-2.6-block.git] / drivers / staging / hv / netvsc_drv.c
CommitLineData
fceaf24a 1/*
fceaf24a
HJ
2 * Copyright (c) 2009, Microsoft Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Authors:
18 * Hank Janssen <hjanssen@microsoft.com>
fceaf24a 19 */
fceaf24a
HJ
20#include <linux/init.h>
21#include <linux/module.h>
22#include <linux/highmem.h>
23#include <linux/device.h>
fceaf24a 24#include <linux/io.h>
fceaf24a
HJ
25#include <linux/delay.h>
26#include <linux/netdevice.h>
27#include <linux/inetdevice.h>
28#include <linux/etherdevice.h>
29#include <linux/skbuff.h>
30#include <linux/in.h>
31#include <net/arp.h>
32#include <net/route.h>
33#include <net/sock.h>
34#include <net/pkt_sched.h>
4983b39a 35#include "osd.h"
645954c5 36#include "logging.h"
870cde80 37#include "vmbus.h"
cc211812 38#include "NetVscApi.h"
fceaf24a
HJ
39
40MODULE_LICENSE("GPL");
41
fceaf24a 42struct net_device_context {
02fafbc6
GKH
43 /* point back to our device context */
44 struct device_context *device_ctx;
fceaf24a
HJ
45 struct net_device_stats stats;
46};
47
48struct netvsc_driver_context {
454f18a9 49 /* !! These must be the first 2 fields !! */
7e23a6e9 50 /* Which is a bug FIXME! */
02fafbc6 51 struct driver_context drv_ctx;
7e23a6e9 52 struct netvsc_driver drv_obj;
fceaf24a
HJ
53};
54
fceaf24a
HJ
55static int netvsc_ringbuffer_size = NETVSC_DEVICE_RING_BUFFER_SIZE;
56
454f18a9 57/* The one and only one */
fceaf24a
HJ
58static struct netvsc_driver_context g_netvsc_drv;
59
fceaf24a
HJ
60static struct net_device_stats *netvsc_get_stats(struct net_device *net)
61{
62 struct net_device_context *net_device_ctx = netdev_priv(net);
63
64 return &net_device_ctx->stats;
65}
66
4e9bfefa 67static void netvsc_set_multicast_list(struct net_device *net)
fceaf24a
HJ
68{
69}
70
fceaf24a
HJ
71static int netvsc_open(struct net_device *net)
72{
fceaf24a 73 struct net_device_context *net_device_ctx = netdev_priv(net);
02fafbc6
GKH
74 struct driver_context *driver_ctx =
75 driver_to_driver_context(net_device_ctx->device_ctx->device.driver);
76 struct netvsc_driver_context *net_drv_ctx =
77 (struct netvsc_driver_context *)driver_ctx;
7e23a6e9 78 struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
3d3b5518 79 struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
02fafbc6 80 int ret = 0;
fceaf24a
HJ
81
82 DPRINT_ENTER(NETVSC_DRV);
83
02fafbc6
GKH
84 if (netif_carrier_ok(net)) {
85 memset(&net_device_ctx->stats, 0,
86 sizeof(struct net_device_stats));
fceaf24a 87
454f18a9 88 /* Open up the device */
fceaf24a 89 ret = net_drv_obj->OnOpen(device_obj);
02fafbc6
GKH
90 if (ret != 0) {
91 DPRINT_ERR(NETVSC_DRV,
92 "unable to open device (ret %d).", ret);
fceaf24a
HJ
93 return ret;
94 }
95
96 netif_start_queue(net);
02fafbc6 97 } else {
fceaf24a
HJ
98 DPRINT_ERR(NETVSC_DRV, "unable to open device...link is down.");
99 }
100
101 DPRINT_EXIT(NETVSC_DRV);
102 return ret;
103}
104
fceaf24a
HJ
105static int netvsc_close(struct net_device *net)
106{
fceaf24a 107 struct net_device_context *net_device_ctx = netdev_priv(net);
02fafbc6
GKH
108 struct driver_context *driver_ctx =
109 driver_to_driver_context(net_device_ctx->device_ctx->device.driver);
110 struct netvsc_driver_context *net_drv_ctx =
111 (struct netvsc_driver_context *)driver_ctx;
7e23a6e9 112 struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
3d3b5518 113 struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
02fafbc6 114 int ret;
fceaf24a
HJ
115
116 DPRINT_ENTER(NETVSC_DRV);
117
118 netif_stop_queue(net);
119
120 ret = net_drv_obj->OnClose(device_obj);
121 if (ret != 0)
fceaf24a 122 DPRINT_ERR(NETVSC_DRV, "unable to close device (ret %d).", ret);
fceaf24a
HJ
123
124 DPRINT_EXIT(NETVSC_DRV);
125
126 return ret;
127}
128
fceaf24a
HJ
129static void netvsc_xmit_completion(void *context)
130{
4193d4f4 131 struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context;
02fafbc6
GKH
132 struct sk_buff *skb = (struct sk_buff *)
133 (unsigned long)packet->Completion.Send.SendCompletionTid;
134 struct net_device *net;
fceaf24a
HJ
135
136 DPRINT_ENTER(NETVSC_DRV);
137
138 kfree(packet);
139
02fafbc6 140 if (skb) {
fceaf24a 141 net = skb->dev;
fceaf24a
HJ
142 dev_kfree_skb_any(skb);
143
02fafbc6
GKH
144 if (netif_queue_stopped(net)) {
145 DPRINT_INFO(NETVSC_DRV, "net device (%p) waking up...",
146 net);
fceaf24a
HJ
147
148 netif_wake_queue(net);
149 }
150 }
151
152 DPRINT_EXIT(NETVSC_DRV);
153}
154
02fafbc6 155static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
fceaf24a 156{
fceaf24a 157 struct net_device_context *net_device_ctx = netdev_priv(net);
02fafbc6
GKH
158 struct driver_context *driver_ctx =
159 driver_to_driver_context(net_device_ctx->device_ctx->device.driver);
160 struct netvsc_driver_context *net_drv_ctx =
161 (struct netvsc_driver_context *)driver_ctx;
7e23a6e9 162 struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
4193d4f4 163 struct hv_netvsc_packet *packet;
02fafbc6
GKH
164 int i;
165 int ret;
fceaf24a 166 int num_frags;
02fafbc6 167 int retries = 0;
fceaf24a
HJ
168
169 DPRINT_ENTER(NETVSC_DRV);
170
454f18a9 171 /* Support only 1 chain of frags */
fceaf24a
HJ
172 ASSERT(skb_shinfo(skb)->frag_list == NULL);
173 ASSERT(skb->dev == net);
174
02fafbc6
GKH
175 DPRINT_DBG(NETVSC_DRV, "xmit packet - len %d data_len %d",
176 skb->len, skb->data_len);
fceaf24a 177
454f18a9 178 /* Add 1 for skb->data and any additional ones requested */
02fafbc6
GKH
179 num_frags = skb_shinfo(skb)->nr_frags + 1 +
180 net_drv_obj->AdditionalRequestPageBufferCount;
fceaf24a 181
454f18a9 182 /* Allocate a netvsc packet based on # of frags. */
02fafbc6
GKH
183 packet = kzalloc(sizeof(struct hv_netvsc_packet) +
184 (num_frags * sizeof(struct hv_page_buffer)) +
185 net_drv_obj->RequestExtSize, GFP_ATOMIC);
186 if (!packet) {
4193d4f4 187 DPRINT_ERR(NETVSC_DRV, "unable to allocate hv_netvsc_packet");
fceaf24a
HJ
188 return -1;
189 }
190
02fafbc6
GKH
191 packet->Extension = (void *)(unsigned long)packet +
192 sizeof(struct hv_netvsc_packet) +
193 (num_frags * sizeof(struct hv_page_buffer));
fceaf24a 194
454f18a9 195 /* Setup the rndis header */
fceaf24a
HJ
196 packet->PageBufferCount = num_frags;
197
454f18a9
BP
198 /* TODO: Flush all write buffers/ memory fence ??? */
199 /* wmb(); */
fceaf24a 200
454f18a9 201 /* Initialize it from the skb */
fceaf24a
HJ
202 ASSERT(skb->data);
203 packet->TotalDataBufferLength = skb->len;
204
02fafbc6
GKH
205 /*
206 * Start filling in the page buffers starting at
207 * AdditionalRequestPageBufferCount offset
208 */
209 packet->PageBuffers[net_drv_obj->AdditionalRequestPageBufferCount].Pfn = virt_to_phys(skb->data) >> PAGE_SHIFT;
210 packet->PageBuffers[net_drv_obj->AdditionalRequestPageBufferCount].Offset = (unsigned long)skb->data & (PAGE_SIZE - 1);
211 packet->PageBuffers[net_drv_obj->AdditionalRequestPageBufferCount].Length = skb->len - skb->data_len;
fceaf24a
HJ
212
213 ASSERT((skb->len - skb->data_len) <= PAGE_SIZE);
214
02fafbc6
GKH
215 for (i = net_drv_obj->AdditionalRequestPageBufferCount + 1;
216 i < num_frags; i++) {
217 packet->PageBuffers[i].Pfn =
218 page_to_pfn(skb_shinfo(skb)->frags[i-(net_drv_obj->AdditionalRequestPageBufferCount+1)].page);
219 packet->PageBuffers[i].Offset =
220 skb_shinfo(skb)->frags[i-(net_drv_obj->AdditionalRequestPageBufferCount+1)].page_offset;
221 packet->PageBuffers[i].Length =
222 skb_shinfo(skb)->frags[i-(net_drv_obj->AdditionalRequestPageBufferCount+1)].size;
fceaf24a
HJ
223 }
224
454f18a9 225 /* Set the completion routine */
fceaf24a
HJ
226 packet->Completion.Send.OnSendCompletion = netvsc_xmit_completion;
227 packet->Completion.Send.SendCompletionContext = packet;
c4b0bc94 228 packet->Completion.Send.SendCompletionTid = (unsigned long)skb;
fceaf24a
HJ
229
230retry_send:
02fafbc6
GKH
231 ret = net_drv_obj->OnSend(&net_device_ctx->device_ctx->device_obj,
232 packet);
fceaf24a 233
02fafbc6 234 if (ret == 0) {
fceaf24a
HJ
235 ret = NETDEV_TX_OK;
236 net_device_ctx->stats.tx_bytes += skb->len;
237 net_device_ctx->stats.tx_packets++;
02fafbc6 238 } else {
fceaf24a 239 retries++;
02fafbc6
GKH
240 if (retries < 4) {
241 DPRINT_ERR(NETVSC_DRV, "unable to send..."
242 "retrying %d...", retries);
fceaf24a
HJ
243 udelay(100);
244 goto retry_send;
245 }
246
454f18a9 247 /* no more room or we are shutting down */
02fafbc6
GKH
248 DPRINT_ERR(NETVSC_DRV, "unable to send (%d)..."
249 "marking net device (%p) busy", ret, net);
fceaf24a
HJ
250 DPRINT_INFO(NETVSC_DRV, "net device (%p) stopping", net);
251
252 ret = NETDEV_TX_BUSY;
253 net_device_ctx->stats.tx_dropped++;
254
255 netif_stop_queue(net);
256
02fafbc6
GKH
257 /*
258 * Null it since the caller will free it instead of the
259 * completion routine
260 */
fceaf24a
HJ
261 packet->Completion.Send.SendCompletionTid = 0;
262
02fafbc6
GKH
263 /*
264 * Release the resources since we will not get any send
265 * completion
266 */
267 netvsc_xmit_completion((void *)packet);
fceaf24a
HJ
268 }
269
02fafbc6
GKH
270 DPRINT_DBG(NETVSC_DRV, "# of xmits %lu total size %lu",
271 net_device_ctx->stats.tx_packets,
272 net_device_ctx->stats.tx_bytes);
fceaf24a
HJ
273
274 DPRINT_EXIT(NETVSC_DRV);
275 return ret;
276}
277
02fafbc6
GKH
278/**
279 * netvsc_linkstatus_callback - Link up/down notification
280 */
281static void netvsc_linkstatus_callback(struct hv_device *device_obj,
282 unsigned int status)
fceaf24a 283{
02fafbc6
GKH
284 struct device_context *device_ctx = to_device_context(device_obj);
285 struct net_device *net = dev_get_drvdata(&device_ctx->device);
fceaf24a
HJ
286
287 DPRINT_ENTER(NETVSC_DRV);
288
02fafbc6
GKH
289 if (!net) {
290 DPRINT_ERR(NETVSC_DRV, "got link status but net device "
291 "not initialized yet");
fceaf24a
HJ
292 return;
293 }
294
02fafbc6 295 if (status == 1) {
fceaf24a
HJ
296 netif_carrier_on(net);
297 netif_wake_queue(net);
02fafbc6 298 } else {
fceaf24a
HJ
299 netif_carrier_off(net);
300 netif_stop_queue(net);
301 }
302 DPRINT_EXIT(NETVSC_DRV);
303}
304
02fafbc6
GKH
305/**
306 * netvsc_recv_callback - Callback when we receive a packet from the "wire" on the specified device.
307 */
308static int netvsc_recv_callback(struct hv_device *device_obj,
309 struct hv_netvsc_packet *packet)
fceaf24a 310{
fceaf24a 311 struct device_context *device_ctx = to_device_context(device_obj);
621d7fb7 312 struct net_device *net = dev_get_drvdata(&device_ctx->device);
fceaf24a 313 struct net_device_context *net_device_ctx;
fceaf24a
HJ
314 struct sk_buff *skb;
315 void *data;
02fafbc6
GKH
316 int ret;
317 int i;
fceaf24a
HJ
318 unsigned long flags;
319
320 DPRINT_ENTER(NETVSC_DRV);
321
02fafbc6
GKH
322 if (!net) {
323 DPRINT_ERR(NETVSC_DRV, "got receive callback but net device "
324 "not initialized yet");
fceaf24a
HJ
325 return 0;
326 }
327
328 net_device_ctx = netdev_priv(net);
329
454f18a9 330 /* Allocate a skb - TODO preallocate this */
02fafbc6
GKH
331 /* Pad 2-bytes to align IP header to 16 bytes */
332 skb = dev_alloc_skb(packet->TotalDataBufferLength + 2);
fceaf24a
HJ
333 ASSERT(skb);
334 skb_reserve(skb, 2);
335 skb->dev = net;
336
454f18a9 337 /* for kmap_atomic */
fceaf24a
HJ
338 local_irq_save(flags);
339
02fafbc6
GKH
340 /*
341 * Copy to skb. This copy is needed here since the memory pointed by
342 * hv_netvsc_packet cannot be deallocated
343 */
344 for (i = 0; i < packet->PageBufferCount; i++) {
345 data = kmap_atomic(pfn_to_page(packet->PageBuffers[i].Pfn),
346 KM_IRQ1);
347 data = (void *)(unsigned long)data +
348 packet->PageBuffers[i].Offset;
349
350 memcpy(skb_put(skb, packet->PageBuffers[i].Length), data,
351 packet->PageBuffers[i].Length);
352
353 kunmap_atomic((void *)((unsigned long)data -
354 packet->PageBuffers[i].Offset), KM_IRQ1);
fceaf24a
HJ
355 }
356
357 local_irq_restore(flags);
358
359 skb->protocol = eth_type_trans(skb, net);
360
361 skb->ip_summed = CHECKSUM_NONE;
362
02fafbc6
GKH
363 /*
364 * Pass the skb back up. Network stack will deallocate the skb when it
365 * is done
366 */
fceaf24a
HJ
367 ret = netif_rx(skb);
368
02fafbc6 369 switch (ret) {
fceaf24a
HJ
370 case NET_RX_DROP:
371 net_device_ctx->stats.rx_dropped++;
372 break;
373 default:
374 net_device_ctx->stats.rx_packets++;
375 net_device_ctx->stats.rx_bytes += skb->len;
376 break;
377
378 }
02fafbc6
GKH
379 DPRINT_DBG(NETVSC_DRV, "# of recvs %lu total size %lu",
380 net_device_ctx->stats.rx_packets,
381 net_device_ctx->stats.rx_bytes);
fceaf24a
HJ
382
383 DPRINT_EXIT(NETVSC_DRV);
384
385 return 0;
386}
387
df2fff28
GKH
388static const struct net_device_ops device_ops = {
389 .ndo_open = netvsc_open,
390 .ndo_stop = netvsc_close,
391 .ndo_start_xmit = netvsc_start_xmit,
392 .ndo_get_stats = netvsc_get_stats,
393 .ndo_set_multicast_list = netvsc_set_multicast_list,
394};
395
396static int netvsc_probe(struct device *device)
397{
398 struct driver_context *driver_ctx =
399 driver_to_driver_context(device->driver);
400 struct netvsc_driver_context *net_drv_ctx =
401 (struct netvsc_driver_context *)driver_ctx;
402 struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
403 struct device_context *device_ctx = device_to_device_context(device);
404 struct hv_device *device_obj = &device_ctx->device_obj;
405 struct net_device *net = NULL;
406 struct net_device_context *net_device_ctx;
407 struct netvsc_device_info device_info;
408 int ret;
409
410 DPRINT_ENTER(NETVSC_DRV);
411
412 if (!net_drv_obj->Base.OnDeviceAdd)
413 return -1;
414
415 net = alloc_netdev(sizeof(struct net_device_context), "seth%d",
416 ether_setup);
417 if (!net)
418 return -1;
419
420 /* Set initial state */
421 netif_carrier_off(net);
422 netif_stop_queue(net);
423
424 net_device_ctx = netdev_priv(net);
425 net_device_ctx->device_ctx = device_ctx;
426 dev_set_drvdata(device, net);
427
428 /* Notify the netvsc driver of the new device */
429 ret = net_drv_obj->Base.OnDeviceAdd(device_obj, &device_info);
430 if (ret != 0) {
431 free_netdev(net);
432 dev_set_drvdata(device, NULL);
433
434 DPRINT_ERR(NETVSC_DRV, "unable to add netvsc device (ret %d)",
435 ret);
436 return ret;
437 }
438
439 /*
440 * If carrier is still off ie we did not get a link status callback,
441 * update it if necessary
442 */
443 /*
444 * FIXME: We should use a atomic or test/set instead to avoid getting
445 * out of sync with the device's link status
446 */
447 if (!netif_carrier_ok(net))
448 if (!device_info.LinkState)
449 netif_carrier_on(net);
450
451 memcpy(net->dev_addr, device_info.MacAddr, ETH_ALEN);
452
453 net->netdev_ops = &device_ops;
454
455 SET_NETDEV_DEV(net, device);
456
457 ret = register_netdev(net);
458 if (ret != 0) {
459 /* Remove the device and release the resource */
460 net_drv_obj->Base.OnDeviceRemove(device_obj);
461 free_netdev(net);
462 }
463
464 DPRINT_EXIT(NETVSC_DRV);
465 return ret;
466}
467
468static int netvsc_remove(struct device *device)
469{
470 struct driver_context *driver_ctx =
471 driver_to_driver_context(device->driver);
472 struct netvsc_driver_context *net_drv_ctx =
473 (struct netvsc_driver_context *)driver_ctx;
474 struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
475 struct device_context *device_ctx = device_to_device_context(device);
476 struct net_device *net = dev_get_drvdata(&device_ctx->device);
477 struct hv_device *device_obj = &device_ctx->device_obj;
478 int ret;
479
480 DPRINT_ENTER(NETVSC_DRV);
481
482 if (net == NULL) {
483 DPRINT_INFO(NETVSC, "no net device to remove");
484 DPRINT_EXIT(NETVSC_DRV);
485 return 0;
486 }
487
488 if (!net_drv_obj->Base.OnDeviceRemove) {
489 DPRINT_EXIT(NETVSC_DRV);
490 return -1;
491 }
492
493 /* Stop outbound asap */
494 netif_stop_queue(net);
495 /* netif_carrier_off(net); */
496
497 unregister_netdev(net);
498
499 /*
500 * Call to the vsc driver to let it know that the device is being
501 * removed
502 */
503 ret = net_drv_obj->Base.OnDeviceRemove(device_obj);
504 if (ret != 0) {
505 /* TODO: */
506 DPRINT_ERR(NETVSC, "unable to remove vsc device (ret %d)", ret);
507 }
508
509 free_netdev(net);
510 DPRINT_EXIT(NETVSC_DRV);
511 return ret;
512}
513
fceaf24a
HJ
514static int netvsc_drv_exit_cb(struct device *dev, void *data)
515{
516 struct device **curr = (struct device **)data;
02fafbc6 517
fceaf24a 518 *curr = dev;
02fafbc6
GKH
519 /* stop iterating */
520 return 1;
fceaf24a
HJ
521}
522
bd1de709 523static void netvsc_drv_exit(void)
fceaf24a 524{
02fafbc6
GKH
525 struct netvsc_driver *netvsc_drv_obj = &g_netvsc_drv.drv_obj;
526 struct driver_context *drv_ctx = &g_netvsc_drv.drv_ctx;
527 struct device *current_dev;
2295ba2e 528 int ret;
fceaf24a
HJ
529
530 DPRINT_ENTER(NETVSC_DRV);
531
02fafbc6 532 while (1) {
fceaf24a
HJ
533 current_dev = NULL;
534
454f18a9 535 /* Get the device */
2295ba2e 536 ret = driver_for_each_device(&drv_ctx->driver, NULL,
02fafbc6 537 &current_dev, netvsc_drv_exit_cb);
2295ba2e
BP
538 if (ret)
539 DPRINT_WARN(NETVSC_DRV,
540 "driver_for_each_device returned %d", ret);
541
fceaf24a
HJ
542 if (current_dev == NULL)
543 break;
544
454f18a9 545 /* Initiate removal from the top-down */
02fafbc6
GKH
546 DPRINT_INFO(NETVSC_DRV, "unregistering device (%p)...",
547 current_dev);
fceaf24a
HJ
548
549 device_unregister(current_dev);
550 }
551
552 if (netvsc_drv_obj->Base.OnCleanup)
553 netvsc_drv_obj->Base.OnCleanup(&netvsc_drv_obj->Base);
554
555 vmbus_child_driver_unregister(drv_ctx);
556
557 DPRINT_EXIT(NETVSC_DRV);
558
559 return;
560}
561
df2fff28
GKH
562static int netvsc_drv_init(PFN_DRIVERINITIALIZE pfn_drv_init)
563{
564 struct netvsc_driver *net_drv_obj = &g_netvsc_drv.drv_obj;
565 struct driver_context *drv_ctx = &g_netvsc_drv.drv_ctx;
566 int ret;
567
568 DPRINT_ENTER(NETVSC_DRV);
569
570 vmbus_get_interface(&net_drv_obj->Base.VmbusChannelInterface);
571
572 net_drv_obj->RingBufferSize = netvsc_ringbuffer_size;
573 net_drv_obj->OnReceiveCallback = netvsc_recv_callback;
574 net_drv_obj->OnLinkStatusChanged = netvsc_linkstatus_callback;
575
576 /* Callback to client driver to complete the initialization */
577 pfn_drv_init(&net_drv_obj->Base);
578
579 drv_ctx->driver.name = net_drv_obj->Base.name;
580 memcpy(&drv_ctx->class_id, &net_drv_obj->Base.deviceType,
581 sizeof(struct hv_guid));
582
583 drv_ctx->probe = netvsc_probe;
584 drv_ctx->remove = netvsc_remove;
585
586 /* The driver belongs to vmbus */
587 ret = vmbus_child_driver_register(drv_ctx);
588
589 DPRINT_EXIT(NETVSC_DRV);
590
591 return ret;
592}
593
fceaf24a
HJ
594static int __init netvsc_init(void)
595{
596 int ret;
597
598 DPRINT_ENTER(NETVSC_DRV);
599 DPRINT_INFO(NETVSC_DRV, "Netvsc initializing....");
600
601 ret = netvsc_drv_init(NetVscInitialize);
602
603 DPRINT_EXIT(NETVSC_DRV);
604
605 return ret;
606}
607
608static void __exit netvsc_exit(void)
609{
610 DPRINT_ENTER(NETVSC_DRV);
fceaf24a 611 netvsc_drv_exit();
fceaf24a
HJ
612 DPRINT_EXIT(NETVSC_DRV);
613}
614
615module_param(netvsc_ringbuffer_size, int, S_IRUGO);
616
617module_init(netvsc_init);
618module_exit(netvsc_exit);