1/*
2
3 * Copyright (c) 2004 Topspin Communications.  All rights reserved.
4 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
5 *
6 * This software is available to you under a choice of one of two
7 * licenses.  You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
11 *
12 *     Redistribution and use in source and binary forms, with or
13 *     without modification, are permitted provided that the following
14 *     conditions are met:
15 *
16 *      - Redistributions of source code must retain the above
17 *        copyright notice, this list of conditions and the following
18 *        disclaimer.
19 *
20 *      - Redistributions in binary form must reproduce the above
21 *        copyright notice, this list of conditions and the following
22 *        disclaimer in the documentation and/or other materials
23 *        provided with the distribution.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 * SOFTWARE.
33
34
35 #include <linux/module.h>
36 #include <linux/string.h>
37 #include <linux/errno.h>
38 #include <linux/kernel.h>
39 #include <linux/slab.h>
40 #include <linux/mutex.h>
41 #include <linux/workqueue.h>
42 */
43
44#include <linux/kernel.h>
45
46#include "core_priv.h"
47/*
48 MODULE_AUTHOR("Roland Dreier");
49 MODULE_DESCRIPTION("core kernel InfiniBand API");
50 MODULE_LICENSE("Dual BSD/GPL");
51
52 #ifdef __ia64__
53 workaround for a bug in hp chipset that would cause kernel
54 panic when dma resources are exhaused
55 int dma_map_sg_hp_wa = 0;
56 #endif
57
58 struct ib_client_data {
59 struct list_head  list;
60 struct ib_client *client;
61 void *            data;
62 };
63
64 static LIST_HEAD(device_list);
65 static LIST_HEAD(client_list);
66
67
68 * device_mutex protects access to both device_list and client_list.
69 * There's no real point to using multiple locks or something fancier
70 * like an rwsem: we always access both lists, and we're always
71 * modifying one list or the other list.  In any case this is not a
72 * hot path so there's no point in trying to optimize.
73
74 static DEFINE_MUTEX(device_mutex);
75
76 static int ib_device_check_mandatory(struct ib_device *device)
77 {
78 #define IB_MANDATORY_FUNC(x) { offsetof(struct ib_device, x), #x }
79 static const struct {
80 size_t offset;
81 char  *name;
82 } mandatory_table[] = {
83 IB_MANDATORY_FUNC(query_device),
84 IB_MANDATORY_FUNC(query_port),
85 IB_MANDATORY_FUNC(query_pkey),
86 IB_MANDATORY_FUNC(query_gid),
87 IB_MANDATORY_FUNC(alloc_pd),
88 IB_MANDATORY_FUNC(dealloc_pd),
89 IB_MANDATORY_FUNC(create_ah),
90 IB_MANDATORY_FUNC(destroy_ah),
91 IB_MANDATORY_FUNC(create_qp),
92 IB_MANDATORY_FUNC(modify_qp),
93 IB_MANDATORY_FUNC(destroy_qp),
94 IB_MANDATORY_FUNC(post_send),
95 IB_MANDATORY_FUNC(post_recv),
96 IB_MANDATORY_FUNC(create_cq),
97 IB_MANDATORY_FUNC(destroy_cq),
98 IB_MANDATORY_FUNC(poll_cq),
99 IB_MANDATORY_FUNC(req_notify_cq),
100 IB_MANDATORY_FUNC(get_dma_mr),
101 IB_MANDATORY_FUNC(dereg_mr)
102 };
103 int i;
104
105 for (i = 0; i < ARRAY_SIZE(mandatory_table); ++i) {
106 if (!*(void **) ((u_char *) device + mandatory_table[i].offset)) {
107 printk(KERN_WARNING "Device %s is missing mandatory function %s\n",
108 device->name, mandatory_table[i].name);
109 return -EINVAL;
110 }
111 }
112
113 return 0;
114 }
115
116 static struct ib_device *__ib_device_get_by_name(const char *name)
117 {
118 struct ib_device *device;
119
120 list_for_each_entry(device, &device_list, core_list)
121 if (!strncmp(name, device->name, IB_DEVICE_NAME_MAX))
122 return device;
123
124 return NULL;
125 }
126
127
128 static int alloc_name(char *name)
129 {
130 unsigned long *inuse;
131 char buf[IB_DEVICE_NAME_MAX];
132 struct ib_device *device;
133 int i;
134
135 inuse = (unsigned long *) get_zeroed_page(GFP_KERNEL);
136 if (!inuse)
137 return -ENOMEM;
138
139 list_for_each_entry(device, &device_list, core_list) {
140 if (!sscanf(device->name, name, &i))
141 continue;
142 if (i < 0 || i >= PAGE_SIZE * 8)
143 continue;
144 snprintf(buf, sizeof buf, name, i);
145 if (!strncmp(buf, device->name, IB_DEVICE_NAME_MAX))
146 set_bit(i, inuse);
147 }
148
149 i = find_first_zero_bit(inuse, PAGE_SIZE * 8);
150 free_page((unsigned long) inuse);
151 snprintf(buf, sizeof buf, name, i);
152
153 if (__ib_device_get_by_name(buf))
154 return -ENFILE;
155
156 strlcpy(name, buf, IB_DEVICE_NAME_MAX);
157 return 0;
158 }
159 */
160static int start_port(struct ib_device *device) {
161	return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1;
162}
163
164static int end_port(struct ib_device *device) {
165	return (device->node_type == RDMA_NODE_IB_SWITCH) ?
166			0 : device->phys_port_cnt;
167}
168/*
169 *
170 * ib_alloc_device - allocate an IB device struct
171 * @size:size of structure to allocate
172 *
173 * Low-level drivers should use ib_alloc_device() to allocate &struct
174 * ib_device.  @size is the size of the structure to be allocated,
175 * including any private data used by the low-level driver.
176 * ib_dealloc_device() must be used to free structures allocated with
177 * ib_alloc_device().
178 */
179struct ib_device *ib_alloc_device(size_t size) {
180	/*SHOULD BE UNCOMMENTED*/
181	/*assert(size < sizeof(struct ib_device));*/
182
183	/*THE SIZE SHOULD BE size*/
184	return calloc(1, max(size, sizeof(struct ib_device)));
185}
186/*
187 EXPORT_SYMBOL(ib_alloc_device);
188
189 *
190 * ib_dealloc_device - free an IB device struct
191 * @device:structure to free
192 *
193 * Free a structure allocated with ib_alloc_device().
194
195 void ib_dealloc_device(struct ib_device *device)
196 {
197 if (device->reg_state == IB_DEV_UNINITIALIZED) {
198 kfree(device);
199 return;
200 }
201
202 BUG_ON(device->reg_state != IB_DEV_UNREGISTERED);
203
204 kobject_put(&device->dev.kobj);
205 }
206 EXPORT_SYMBOL(ib_dealloc_device);
207
208 static int add_client_context(struct ib_device *device, struct ib_client *client)
209 {
210 struct ib_client_data *context;
211 unsigned long flags;
212
213 context = kmalloc(sizeof *context, GFP_KERNEL);
214 if (!context) {
215 printk(KERN_WARNING "Couldn't allocate client context for %s/%s\n",
216 device->name, client->name);
217 return -ENOMEM;
218 }
219
220 context->client = client;
221 context->data   = NULL;
222
223 spin_lock_irqsave(&device->client_data_lock, flags);
224 list_add(&context->list, &device->client_data_list);
225 spin_unlock_irqrestore(&device->client_data_lock, flags);
226
227 return 0;
228 }
229
230 static int read_port_table_lengths(struct ib_device *device)
231 {
232 struct ib_port_attr *tprops = NULL;
233 int num_ports, ret = -ENOMEM;
234 u8 port_index;
235
236 tprops = kmalloc(sizeof *tprops, GFP_KERNEL);
237 if (!tprops)
238 goto out;
239
240 num_ports = end_port(device) - start_port(device) + 1;
241
242 device->pkey_tbl_len = kmalloc(sizeof *device->pkey_tbl_len * num_ports,
243 GFP_KERNEL);
244 device->gid_tbl_len = kmalloc(sizeof *device->gid_tbl_len * num_ports,
245 GFP_KERNEL);
246 if (!device->pkey_tbl_len || !device->gid_tbl_len)
247 goto err;
248
249 for (port_index = 0; port_index < num_ports; ++port_index) {
250 ret = ib_query_port(device, port_index + start_port(device),
251 tprops);
252 if (ret)
253 goto err;
254 device->pkey_tbl_len[port_index] = tprops->pkey_tbl_len;
255 device->gid_tbl_len[port_index]  = tprops->gid_tbl_len;
256 }
257
258 ret = 0;
259 goto out;
260
261 err:
262 kfree(device->gid_tbl_len);
263 kfree(device->pkey_tbl_len);
264 out:
265 kfree(tprops);
266 return ret;
267 }
268
269 *
270 * ib_register_device - Register an IB device with IB core
271 * @device:Device to register
272 *
273 * Low-level drivers use ib_register_device() to register their
274 * devices with the IB core.  All registered clients will receive a
275 * callback for each device that is added. @device must be allocated
276 * with ib_alloc_device().
277
278 int ib_register_device(struct ib_device *device,
279 int (*port_callback)(struct ib_device *,
280 u8, struct kobject *))
281 {
282 int ret;
283
284 mutex_lock(&device_mutex);
285
286 if (strchr(device->name, '%')) {
287 ret = alloc_name(device->name);
288 if (ret)
289 goto out;
290 }
291
292 if (ib_device_check_mandatory(device)) {
293 ret = -EINVAL;
294 goto out;
295 }
296
297 INIT_LIST_HEAD(&device->event_handler_list);
298 INIT_LIST_HEAD(&device->client_data_list);
299 spin_lock_init(&device->event_handler_lock);
300 spin_lock_init(&device->client_data_lock);
301 device->ib_uverbs_xrcd_table = RB_ROOT;
302 mutex_init(&device->xrcd_table_mutex);
303
304 ret = read_port_table_lengths(device);
305 if (ret) {
306 printk(KERN_WARNING "Couldn't create table lengths cache for device %s\n",
307 device->name);
308 goto out;
309 }
310
311 ret = ib_device_register_sysfs(device, port_callback);
312 if (ret) {
313 printk(KERN_WARNING "Couldn't register device %s with driver model\n",
314 device->name);
315 kfree(device->gid_tbl_len);
316 kfree(device->pkey_tbl_len);
317 goto out;
318 }
319
320 list_add_tail(&device->core_list, &device_list);
321
322 device->reg_state = IB_DEV_REGISTERED;
323
324 {
325 struct ib_client *client;
326
327 list_for_each_entry(client, &client_list, list)
328 if (client->add && !add_client_context(device, client))
329 client->add(device);
330 }
331
332 out:
333 mutex_unlock(&device_mutex);
334 return ret;
335 }
336 EXPORT_SYMBOL(ib_register_device);
337
338 *
339 * ib_unregister_device - Unregister an IB device
340 * @device:Device to unregister
341 *
342 * Unregister an IB device.  All clients will receive a remove callback.
343
344 void ib_unregister_device(struct ib_device *device)
345 {
346 struct ib_client *client;
347 struct ib_client_data *context, *tmp;
348 unsigned long flags;
349
350 mutex_lock(&device_mutex);
351
352 list_for_each_entry_reverse(client, &client_list, list)
353 if (client->remove)
354 client->remove(device);
355
356 list_del(&device->core_list);
357
358 kfree(device->gid_tbl_len);
359 kfree(device->pkey_tbl_len);
360
361 mutex_unlock(&device_mutex);
362
363 ib_device_unregister_sysfs(device);
364
365 spin_lock_irqsave(&device->client_data_lock, flags);
366 list_for_each_entry_safe(context, tmp, &device->client_data_list, list)
367 kfree(context);
368 spin_unlock_irqrestore(&device->client_data_lock, flags);
369
370 device->reg_state = IB_DEV_UNREGISTERED;
371 }
372 EXPORT_SYMBOL(ib_unregister_device);
373
374 *
375 * ib_register_client - Register an IB client
376 * @client:Client to register
377 *
378 * Upper level users of the IB drivers can use ib_register_client() to
379 * register callbacks for IB device addition and removal.  When an IB
380 * device is added, each registered client's add method will be called
381 * (in the order the clients were registered), and when a device is
382 * removed, each client's remove method will be called (in the reverse
383 * order that clients were registered).  In addition, when
384 * ib_register_client() is called, the client will receive an add
385 * callback for all devices already registered.
386
387 int ib_register_client(struct ib_client *client)
388 {
389 struct ib_device *device;
390
391 mutex_lock(&device_mutex);
392
393 list_add_tail(&client->list, &client_list);
394 list_for_each_entry(device, &device_list, core_list)
395 if (client->add && !add_client_context(device, client))
396 client->add(device);
397
398 mutex_unlock(&device_mutex);
399
400 return 0;
401 }
402 EXPORT_SYMBOL(ib_register_client);
403
404 *
405 * ib_unregister_client - Unregister an IB client
406 * @client:Client to unregister
407 *
408 * Upper level users use ib_unregister_client() to remove their client
409 * registration.  When ib_unregister_client() is called, the client
410 * will receive a remove callback for each IB device still registered.
411
412 void ib_unregister_client(struct ib_client *client)
413 {
414 struct ib_client_data *context, *tmp;
415 struct ib_device *device;
416 unsigned long flags;
417
418 mutex_lock(&device_mutex);
419
420 list_for_each_entry(device, &device_list, core_list) {
421 if (client->remove)
422 client->remove(device);
423
424 spin_lock_irqsave(&device->client_data_lock, flags);
425 list_for_each_entry_safe(context, tmp, &device->client_data_list, list)
426 if (context->client == client) {
427 list_del(&context->list);
428 kfree(context);
429 }
430 spin_unlock_irqrestore(&device->client_data_lock, flags);
431 }
432 list_del(&client->list);
433
434 mutex_unlock(&device_mutex);
435 }
436 EXPORT_SYMBOL(ib_unregister_client);
437
438 *
439 * ib_get_client_data - Get IB client context
440 * @device:Device to get context for
441 * @client:Client to get context for
442 *
443 * ib_get_client_data() returns client context set with
444 * ib_set_client_data().
445
446 void *ib_get_client_data(struct ib_device *device, struct ib_client *client)
447 {
448 struct ib_client_data *context;
449 void *ret = NULL;
450 unsigned long flags;
451
452 spin_lock_irqsave(&device->client_data_lock, flags);
453 list_for_each_entry(context, &device->client_data_list, list)
454 if (context->client == client) {
455 ret = context->data;
456 break;
457 }
458 spin_unlock_irqrestore(&device->client_data_lock, flags);
459
460 return ret;
461 }
462 EXPORT_SYMBOL(ib_get_client_data);
463
464 *
465 * ib_set_client_data - Set IB client context
466 * @device:Device to set context for
467 * @client:Client to set context for
468 * @data:Context to set
469 *
470 * ib_set_client_data() sets client context that can be retrieved with
471 * ib_get_client_data().
472
473 void ib_set_client_data(struct ib_device *device, struct ib_client *client,
474 void *data)
475 {
476 struct ib_client_data *context;
477 unsigned long flags;
478
479 spin_lock_irqsave(&device->client_data_lock, flags);
480 list_for_each_entry(context, &device->client_data_list, list)
481 if (context->client == client) {
482 context->data = data;
483 goto out;
484 }
485
486 printk(KERN_WARNING "No client context found for %s/%s\n",
487 device->name, client->name);
488
489 out:
490 spin_unlock_irqrestore(&device->client_data_lock, flags);
491 }
492 EXPORT_SYMBOL(ib_set_client_data);
493
494 *
495 * ib_register_event_handler - Register an IB event handler
496 * @event_handler:Handler to register
497 *
498 * ib_register_event_handler() registers an event handler that will be
499 * called back when asynchronous IB events occur (as defined in
500 * chapter 11 of the InfiniBand Architecture Specification).  This
501 * callback may occur in interrupt context.
502
503 int ib_register_event_handler  (struct ib_event_handler *event_handler)
504 {
505 unsigned long flags;
506
507 spin_lock_irqsave(&event_handler->device->event_handler_lock, flags);
508 list_add_tail(&event_handler->list,
509 &event_handler->device->event_handler_list);
510 spin_unlock_irqrestore(&event_handler->device->event_handler_lock, flags);
511
512 return 0;
513 }
514 EXPORT_SYMBOL(ib_register_event_handler);
515
516 *
517 * ib_unregister_event_handler - Unregister an event handler
518 * @event_handler:Handler to unregister
519 *
520 * Unregister an event handler registered with
521 * ib_register_event_handler().
522
523 int ib_unregister_event_handler(struct ib_event_handler *event_handler)
524 {
525 unsigned long flags;
526
527 spin_lock_irqsave(&event_handler->device->event_handler_lock, flags);
528 list_del(&event_handler->list);
529 spin_unlock_irqrestore(&event_handler->device->event_handler_lock, flags);
530
531 return 0;
532 }
533 EXPORT_SYMBOL(ib_unregister_event_handler);
534
535 *
536 * ib_dispatch_event - Dispatch an asynchronous event
537 * @event:Event to dispatch
538 *
539 * Low-level drivers must call ib_dispatch_event() to dispatch the
540 * event to all registered event handlers when an asynchronous event
541 * occurs.
542
543 void ib_dispatch_event(struct ib_event *event)
544 {
545 unsigned long flags;
546 struct ib_event_handler *handler;
547
548 spin_lock_irqsave(&event->device->event_handler_lock, flags);
549
550 list_for_each_entry(handler, &event->device->event_handler_list, list)
551 handler->handler(handler, event);
552
553 spin_unlock_irqrestore(&event->device->event_handler_lock, flags);
554 }
555 EXPORT_SYMBOL(ib_dispatch_event);
556
557 *
558 * ib_query_device - Query IB device attributes
559 * @device:Device to query
560 * @device_attr:Device attributes
561 *
562 * ib_query_device() returns the attributes of a device through the
563 * @device_attr pointer.
564
565 int ib_query_device(struct ib_device *device,
566 struct ib_device_attr *device_attr)
567 {
568 return device->query_device(device, device_attr);
569 }
570 EXPORT_SYMBOL(ib_query_device);
571
572 *
573 * ib_query_port - Query IB port attributes
574 * @device:Device to query
575 * @port_num:Port number to query
576 * @port_attr:Port attributes
577 *
578 * ib_query_port() returns the attributes of a port through the
579 * @port_attr pointer.
580 */
581int ib_query_port(struct ib_device *device, u8 port_num,
582		struct ib_port_attr *port_attr) {
583	if (port_num < start_port(device) || port_num > end_port(device))
584		return -EINVAL;
585
586	return device->query_port(device, port_num, port_attr);
587}
588/*
589 EXPORT_SYMBOL(ib_query_port);
590
591 *
592 * ib_query_gid - Get GID table entry
593 * @device:Device to query
594 * @port_num:Port number to query
595 * @index:GID table index to query
596 * @gid:Returned GID
597 *
598 * ib_query_gid() fetches the specified GID table entry.
599 */
600int ib_query_gid(struct ib_device *device, u8 port_num, int index,
601		union ib_gid *gid) {
602	return device->query_gid(device, port_num, index, gid);
603}
604/*
605 EXPORT_SYMBOL(ib_query_gid);
606
607 *
608 * ib_query_pkey - Get P_Key table entry
609 * @device:Device to query
610 * @port_num:Port number to query
611 * @index:P_Key table index to query
612 * @pkey:Returned P_Key
613 *
614 * ib_query_pkey() fetches the specified P_Key table entry.
615 */
616int ib_query_pkey(struct ib_device *device, u8 port_num, u16 index, u16 *pkey) {
617	return device->query_pkey(device, port_num, index, pkey);
618}
619/*
620 EXPORT_SYMBOL(ib_query_pkey);
621
622 *
623 * ib_modify_device - Change IB device attributes
624 * @device:Device to modify
625 * @device_modify_mask:Mask of attributes to change
626 * @device_modify:New attribute values
627 *
628 * ib_modify_device() changes a device's attributes as specified by
629 * the @device_modify_mask and @device_modify structure.
630
631 int ib_modify_device(struct ib_device *device,
632 int device_modify_mask,
633 struct ib_device_modify *device_modify)
634 {
635 return device->modify_device(device, device_modify_mask,
636 device_modify);
637 }
638 EXPORT_SYMBOL(ib_modify_device);
639
640 *
641 * ib_modify_port - Modifies the attributes for the specified port.
642 * @device: The device to modify.
643 * @port_num: The number of the port to modify.
644 * @port_modify_mask: Mask used to specify which attributes of the port
645 *   to change.
646 * @port_modify: New attribute values for the port.
647 *
648 * ib_modify_port() changes a port's attributes as specified by the
649 * @port_modify_mask and @port_modify structure.
650
651 int ib_modify_port(struct ib_device *device,
652 u8 port_num, int port_modify_mask,
653 struct ib_port_modify *port_modify)
654 {
655 if (port_num < start_port(device) || port_num > end_port(device))
656 return -EINVAL;
657
658 return device->modify_port(device, port_num, port_modify_mask,
659 port_modify);
660 }
661 EXPORT_SYMBOL(ib_modify_port);
662
663 *
664 * ib_find_gid - Returns the port number and GID table index where
665 *   a specified GID value occurs.
666 * @device: The device to query.
667 * @gid: The GID value to search for.
668 * @port_num: The port number of the device where the GID value was found.
669 * @index: The index into the GID table where the GID was found.  This
670 *   parameter may be NULL.
671
672 int ib_find_gid(struct ib_device *device, union ib_gid *gid,
673 u8 *port_num, u16 *index)
674 {
675 union ib_gid tmp_gid;
676 int ret, port, i;
677
678 for (port = start_port(device); port <= end_port(device); ++port) {
679 for (i = 0; i < device->gid_tbl_len[port - start_port(device)]; ++i) {
680 ret = ib_query_gid(device, port, i, &tmp_gid);
681 if (ret)
682 return ret;
683 if (!memcmp(&tmp_gid, gid, sizeof *gid)) {
684 *port_num = port;
685 if (index)
686 *index = i;
687 return 0;
688 }
689 }
690 }
691
692 return -ENOENT;
693 }
694 EXPORT_SYMBOL(ib_find_gid);
695
696 *
697 * ib_find_pkey - Returns the PKey table index where a specified
698 *   PKey value occurs.
699 * @device: The device to query.
700 * @port_num: The port number of the device to search for the PKey.
701 * @pkey: The PKey value to search for.
702 * @index: The index into the PKey table where the PKey was found.
703
704 int ib_find_pkey(struct ib_device *device,
705 u8 port_num, u16 pkey, u16 *index)
706 {
707 int ret, i;
708 u16 tmp_pkey;
709
710 for (i = 0; i < device->pkey_tbl_len[port_num - start_port(device)]; ++i) {
711 ret = ib_query_pkey(device, port_num, i, &tmp_pkey);
712 if (ret)
713 return ret;
714
715 if ((pkey & 0x7fff) == (tmp_pkey & 0x7fff)) {
716 *index = i;
717 return 0;
718 }
719 }
720
721 return -ENOENT;
722 }
723 EXPORT_SYMBOL(ib_find_pkey);
724
725 static int __init ib_core_init(void)
726 {
727 int ret;
728
729 #ifdef __ia64__
730 if (ia64_platform_is("hpzx1"))
731 dma_map_sg_hp_wa = 1;
732 #endif
733
734 ret = ib_sysfs_setup();
735 if (ret)
736 printk(KERN_WARNING "Couldn't create InfiniBand device class\n");
737
738 ret = ib_cache_setup();
739 if (ret) {
740 printk(KERN_WARNING "Couldn't set up InfiniBand P_Key/GID cache\n");
741 ib_sysfs_cleanup();
742 }
743
744 return ret;
745 }
746
747 static void __exit ib_core_cleanup(void)
748 {
749 ib_cache_cleanup();
750 ib_sysfs_cleanup();
751 Make sure that any pending umem accounting work is done.
752 flush_scheduled_work();
753 }
754
755 module_init(ib_core_init);
756 module_exit(ib_core_cleanup);
757
758 #undef MODULE_VERSION
759 #include <sys/module.h>
760 static int
761 ibcore_evhand(module_t mod, int event, void *arg)
762 {
763 return (0);
764 }
765
766 static moduledata_t ibcore_mod = {
767 .name = "ibcore",
768 .evhand = ibcore_evhand,
769 };
770
771 MODULE_VERSION(ibcore, 1);
772 DECLARE_MODULE(ibcore, ibcore_mod, SI_SUB_SMP, SI_ORDER_ANY);
773 */
774