diff options
author | Robert Love <robert.w.love@intel.com> | 2009-11-03 14:45:58 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:00:55 -0500 |
commit | 8866a5d9075b7129194576f5f810e85a693c40ba (patch) | |
tree | 8976fd0009ab5870457ca0ecd7a246852744f00c /drivers/scsi | |
parent | 255f6386b816b2bc0c251af0ee4985ad5a8461b7 (diff) |
[SCSI] libfc: Add libfc/fc_libfc.[ch] for libfc internal routines
include/scsi/libfc.h is currently loaded with common code
shared between libfc's sub-modules as well as shared between
libfc and fcoe. Previous patches attempted to move out
non-common code. This patch creates two files for common
libfc routines that will not be shared with fcoe, fnic or
any other LLDs.
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/libfc/Makefile | 1 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_disc.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_exch.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_fcp.c | 8 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_libfc.c | 35 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_libfc.h | 102 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_rport.c | 2 |
8 files changed, 147 insertions, 7 deletions
diff --git a/drivers/scsi/libfc/Makefile b/drivers/scsi/libfc/Makefile index 55f982de3a9a..2be549c1db77 100644 --- a/drivers/scsi/libfc/Makefile +++ b/drivers/scsi/libfc/Makefile | |||
@@ -3,6 +3,7 @@ | |||
3 | obj-$(CONFIG_LIBFC) += libfc.o | 3 | obj-$(CONFIG_LIBFC) += libfc.o |
4 | 4 | ||
5 | libfc-objs := \ | 5 | libfc-objs := \ |
6 | fc_libfc.o \ | ||
6 | fc_disc.o \ | 7 | fc_disc.o \ |
7 | fc_exch.o \ | 8 | fc_exch.o \ |
8 | fc_elsct.o \ | 9 | fc_elsct.o \ |
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index d4cb3f9b1a0d..a4bdec28fef5 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c | |||
@@ -40,6 +40,8 @@ | |||
40 | 40 | ||
41 | #include <scsi/libfc.h> | 41 | #include <scsi/libfc.h> |
42 | 42 | ||
43 | #include "fc_libfc.h" | ||
44 | |||
43 | #define FC_DISC_RETRY_LIMIT 3 /* max retries */ | 45 | #define FC_DISC_RETRY_LIMIT 3 /* max retries */ |
44 | #define FC_DISC_RETRY_DELAY 500UL /* (msecs) delay */ | 46 | #define FC_DISC_RETRY_DELAY 500UL /* (msecs) delay */ |
45 | 47 | ||
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 659bb05287f3..ee6031e24c14 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <scsi/libfc.h> | 32 | #include <scsi/libfc.h> |
33 | #include <scsi/fc_encode.h> | 33 | #include <scsi/fc_encode.h> |
34 | 34 | ||
35 | #include "fc_libfc.h" | ||
36 | |||
35 | u16 fc_cpu_mask; /* cpu mask for possible cpus */ | 37 | u16 fc_cpu_mask; /* cpu mask for possible cpus */ |
36 | EXPORT_SYMBOL(fc_cpu_mask); | 38 | EXPORT_SYMBOL(fc_cpu_mask); |
37 | static u16 fc_cpu_order; /* 2's power to represent total possible cpus */ | 39 | static u16 fc_cpu_order; /* 2's power to represent total possible cpus */ |
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index 3ab08f8dfb25..8a31ced98bd0 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
@@ -39,13 +39,7 @@ | |||
39 | #include <scsi/libfc.h> | 39 | #include <scsi/libfc.h> |
40 | #include <scsi/fc_encode.h> | 40 | #include <scsi/fc_encode.h> |
41 | 41 | ||
42 | MODULE_AUTHOR("Open-FCoE.org"); | 42 | #include "fc_libfc.h" |
43 | MODULE_DESCRIPTION("libfc"); | ||
44 | MODULE_LICENSE("GPL v2"); | ||
45 | |||
46 | unsigned int fc_debug_logging; | ||
47 | module_param_named(debug_logging, fc_debug_logging, int, S_IRUGO|S_IWUSR); | ||
48 | MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); | ||
49 | 43 | ||
50 | static struct kmem_cache *scsi_pkt_cachep; | 44 | static struct kmem_cache *scsi_pkt_cachep; |
51 | 45 | ||
diff --git a/drivers/scsi/libfc/fc_libfc.c b/drivers/scsi/libfc/fc_libfc.c new file mode 100644 index 000000000000..e64ea870a4c8 --- /dev/null +++ b/drivers/scsi/libfc/fc_libfc.c | |||
@@ -0,0 +1,35 @@ | |||
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"); | ||
diff --git a/drivers/scsi/libfc/fc_libfc.h b/drivers/scsi/libfc/fc_libfc.h new file mode 100644 index 000000000000..388fae4364af --- /dev/null +++ b/drivers/scsi/libfc/fc_libfc.h | |||
@@ -0,0 +1,102 @@ | |||
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 | #ifndef _FC_LIBFC_H_ | ||
21 | #define _FC_LIBFC_H_ | ||
22 | |||
23 | #define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */ | ||
24 | #define FC_LPORT_LOGGING 0x02 /* lport layer logging */ | ||
25 | #define FC_DISC_LOGGING 0x04 /* discovery layer logging */ | ||
26 | #define FC_RPORT_LOGGING 0x08 /* rport layer logging */ | ||
27 | #define FC_FCP_LOGGING 0x10 /* I/O path logging */ | ||
28 | #define FC_EM_LOGGING 0x20 /* Exchange Manager logging */ | ||
29 | #define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */ | ||
30 | #define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */ | ||
31 | |||
32 | extern unsigned int fc_debug_logging; | ||
33 | |||
34 | #define FC_CHECK_LOGGING(LEVEL, CMD) \ | ||
35 | do { \ | ||
36 | if (unlikely(fc_debug_logging & LEVEL)) \ | ||
37 | do { \ | ||
38 | CMD; \ | ||
39 | } while (0); \ | ||
40 | } while (0) | ||
41 | |||
42 | #define FC_LIBFC_DBG(fmt, args...) \ | ||
43 | FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \ | ||
44 | printk(KERN_INFO "libfc: " fmt, ##args)) | ||
45 | |||
46 | #define FC_LPORT_DBG(lport, fmt, args...) \ | ||
47 | FC_CHECK_LOGGING(FC_LPORT_LOGGING, \ | ||
48 | printk(KERN_INFO "host%u: lport %6x: " fmt, \ | ||
49 | (lport)->host->host_no, \ | ||
50 | fc_host_port_id((lport)->host), ##args)) | ||
51 | |||
52 | #define FC_DISC_DBG(disc, fmt, args...) \ | ||
53 | FC_CHECK_LOGGING(FC_DISC_LOGGING, \ | ||
54 | printk(KERN_INFO "host%u: disc: " fmt, \ | ||
55 | (disc)->lport->host->host_no, \ | ||
56 | ##args)) | ||
57 | |||
58 | #define FC_RPORT_ID_DBG(lport, port_id, fmt, args...) \ | ||
59 | FC_CHECK_LOGGING(FC_RPORT_LOGGING, \ | ||
60 | printk(KERN_INFO "host%u: rport %6x: " fmt, \ | ||
61 | (lport)->host->host_no, \ | ||
62 | (port_id), ##args)) | ||
63 | |||
64 | #define FC_RPORT_DBG(rdata, fmt, args...) \ | ||
65 | FC_RPORT_ID_DBG((rdata)->local_port, (rdata)->ids.port_id, fmt, ##args) | ||
66 | |||
67 | #define FC_FCP_DBG(pkt, fmt, args...) \ | ||
68 | FC_CHECK_LOGGING(FC_FCP_LOGGING, \ | ||
69 | printk(KERN_INFO "host%u: fcp: %6x: " fmt, \ | ||
70 | (pkt)->lp->host->host_no, \ | ||
71 | pkt->rport->port_id, ##args)) | ||
72 | |||
73 | #define FC_EXCH_DBG(exch, fmt, args...) \ | ||
74 | FC_CHECK_LOGGING(FC_EXCH_LOGGING, \ | ||
75 | printk(KERN_INFO "host%u: xid %4x: " fmt, \ | ||
76 | (exch)->lp->host->host_no, \ | ||
77 | exch->xid, ##args)) | ||
78 | |||
79 | #define FC_SCSI_DBG(lport, fmt, args...) \ | ||
80 | FC_CHECK_LOGGING(FC_SCSI_LOGGING, \ | ||
81 | printk(KERN_INFO "host%u: scsi: " fmt, \ | ||
82 | (lport)->host->host_no, ##args)) | ||
83 | |||
84 | /* | ||
85 | * Set up direct-data placement for this I/O request | ||
86 | */ | ||
87 | void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid); | ||
88 | |||
89 | /* | ||
90 | * Module setup functions | ||
91 | */ | ||
92 | int fc_setup_exch_mgr(void); | ||
93 | void fc_destroy_exch_mgr(void); | ||
94 | int fc_setup_rport(void); | ||
95 | void fc_destroy_rport(void); | ||
96 | |||
97 | /* | ||
98 | * Internal libfc functions | ||
99 | */ | ||
100 | const char *fc_els_resp_type(struct fc_frame *); | ||
101 | |||
102 | #endif /* _FC_LIBFC_H_ */ | ||
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 536492ae6a88..f7f20a46e494 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -95,6 +95,8 @@ | |||
95 | #include <scsi/libfc.h> | 95 | #include <scsi/libfc.h> |
96 | #include <scsi/fc_encode.h> | 96 | #include <scsi/fc_encode.h> |
97 | 97 | ||
98 | #include "fc_libfc.h" | ||
99 | |||
98 | /* Fabric IDs to use for point-to-point mode, chosen on whims. */ | 100 | /* Fabric IDs to use for point-to-point mode, chosen on whims. */ |
99 | #define FC_LOCAL_PTP_FID_LO 0x010101 | 101 | #define FC_LOCAL_PTP_FID_LO 0x010101 |
100 | #define FC_LOCAL_PTP_FID_HI 0x010102 | 102 | #define FC_LOCAL_PTP_FID_HI 0x010102 |
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 324e156b5d07..622285c81fef 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c | |||
@@ -55,6 +55,8 @@ | |||
55 | #include <scsi/libfc.h> | 55 | #include <scsi/libfc.h> |
56 | #include <scsi/fc_encode.h> | 56 | #include <scsi/fc_encode.h> |
57 | 57 | ||
58 | #include "fc_libfc.h" | ||
59 | |||
58 | struct workqueue_struct *rport_event_queue; | 60 | struct workqueue_struct *rport_event_queue; |
59 | 61 | ||
60 | static void fc_rport_enter_plogi(struct fc_rport_priv *); | 62 | static void fc_rport_enter_plogi(struct fc_rport_priv *); |