Robert Love | 8866a5d | 2009-11-03 11:45:58 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright(c) 2009 Intel Corporation. All rights reserved. |
| 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., |
| 15 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
| 16 | * |
| 17 | * Maintained at www.Open-FCoE.org |
| 18 | */ |
| 19 | |
| 20 | #include <linux/kernel.h> |
| 21 | #include <linux/types.h> |
| 22 | #include <linux/scatterlist.h> |
| 23 | #include <linux/crc32.h> |
| 24 | |
| 25 | #include <scsi/libfc.h> |
| 26 | |
| 27 | #include "fc_libfc.h" |
| 28 | |
| 29 | MODULE_AUTHOR("Open-FCoE.org"); |
| 30 | MODULE_DESCRIPTION("libfc"); |
| 31 | MODULE_LICENSE("GPL v2"); |
| 32 | |
| 33 | unsigned int fc_debug_logging; |
| 34 | module_param_named(debug_logging, fc_debug_logging, int, S_IRUGO|S_IWUSR); |
| 35 | MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); |
Robert Love | 93e6d5a | 2009-11-03 11:46:03 -0800 | [diff] [blame^] | 36 | |
| 37 | /** |
| 38 | * libfc_init() - Initialize libfc.ko |
| 39 | */ |
| 40 | static int __init libfc_init(void) |
| 41 | { |
| 42 | int rc = 0; |
| 43 | |
| 44 | rc = fc_setup_fcp(); |
| 45 | if (rc) |
| 46 | return rc; |
| 47 | |
| 48 | rc = fc_setup_exch_mgr(); |
| 49 | if (rc) |
| 50 | goto destroy_pkt_cache; |
| 51 | |
| 52 | rc = fc_setup_rport(); |
| 53 | if (rc) |
| 54 | goto destroy_em; |
| 55 | |
| 56 | return rc; |
| 57 | destroy_em: |
| 58 | fc_destroy_exch_mgr(); |
| 59 | destroy_pkt_cache: |
| 60 | fc_destroy_fcp(); |
| 61 | return rc; |
| 62 | } |
| 63 | module_init(libfc_init); |
| 64 | |
| 65 | /** |
| 66 | * libfc_exit() - Tear down libfc.ko |
| 67 | */ |
| 68 | static void __exit libfc_exit(void) |
| 69 | { |
| 70 | fc_destroy_fcp(); |
| 71 | fc_destroy_exch_mgr(); |
| 72 | fc_destroy_rport(); |
| 73 | } |
| 74 | module_exit(libfc_exit); |