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