1 /* cxgb3i_init.c: Chelsio S3xx iSCSI driver.
3 * Copyright (c) 2008 Chelsio Communications, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
9 * Written by: Karen Xie (kxie@chelsio.com)
14 #define DRV_MODULE_NAME "cxgb3i"
15 #define DRV_MODULE_VERSION "1.0.0"
16 #define DRV_MODULE_RELDATE "Jun. 1, 2008"
18 static char version[] =
19 "Chelsio S3xx iSCSI Driver " DRV_MODULE_NAME
20 " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
22 MODULE_AUTHOR("Karen Xie <kxie@chelsio.com>");
23 MODULE_DESCRIPTION("Chelsio S3xx iSCSI Driver");
24 MODULE_LICENSE("GPL");
25 MODULE_VERSION(DRV_MODULE_VERSION);
27 static void open_s3_dev(struct t3cdev *);
28 static void close_s3_dev(struct t3cdev *);
30 static cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS];
31 static struct cxgb3_client t3c_client = {
32 .name = "iscsi_cxgb3",
33 .handlers = cxgb3i_cpl_handlers,
35 .remove = close_s3_dev,
39 * open_s3_dev - register with cxgb3 LLD
40 * @t3dev: cxgb3 adapter instance
42 static void open_s3_dev(struct t3cdev *t3dev)
44 static int vers_printed;
47 printk(KERN_INFO "%s", version);
51 cxgb3i_sdev_add(t3dev, &t3c_client);
52 cxgb3i_adapter_add(t3dev);
56 * close_s3_dev - de-register with cxgb3 LLD
57 * @t3dev: cxgb3 adapter instance
59 static void close_s3_dev(struct t3cdev *t3dev)
61 cxgb3i_adapter_remove(t3dev);
62 cxgb3i_sdev_remove(t3dev);
66 * cxgb3i_init_module - module init entry point
68 * initialize any driver wide global data structures and register itself
69 * with the cxgb3 module
71 static int __init cxgb3i_init_module(void)
75 err = cxgb3i_sdev_init(cxgb3i_cpl_handlers);
79 err = cxgb3i_iscsi_init();
83 err = cxgb3i_pdu_init();
87 cxgb3_register_client(&t3c_client);
93 * cxgb3i_exit_module - module cleanup/exit entry point
95 * go through the driver hba list and for each hba, release any resource held.
96 * and unregisters iscsi transport and the cxgb3 module
98 static void __exit cxgb3i_exit_module(void)
100 cxgb3_unregister_client(&t3c_client);
101 cxgb3i_pdu_cleanup();
102 cxgb3i_iscsi_cleanup();
103 cxgb3i_sdev_cleanup();
106 module_init(cxgb3i_init_module);
107 module_exit(cxgb3i_exit_module);