0001
0002
0003
0004
0005
0006
0007
0008 #ifndef _FC_LIBFC_H_
0009 #define _FC_LIBFC_H_
0010
0011 #define FC_LIBFC_LOGGING 0x01
0012 #define FC_LPORT_LOGGING 0x02
0013 #define FC_DISC_LOGGING 0x04
0014 #define FC_RPORT_LOGGING 0x08
0015 #define FC_FCP_LOGGING 0x10
0016 #define FC_EM_LOGGING 0x20
0017 #define FC_EXCH_LOGGING 0x40
0018 #define FC_SCSI_LOGGING 0x80
0019
0020 extern unsigned int fc_debug_logging;
0021
0022 #define FC_CHECK_LOGGING(LEVEL, CMD) \
0023 do { \
0024 if (unlikely(fc_debug_logging & LEVEL)) \
0025 do { \
0026 CMD; \
0027 } while (0); \
0028 } while (0)
0029
0030 #define FC_LIBFC_DBG(fmt, args...) \
0031 FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \
0032 pr_info("libfc: " fmt, ##args))
0033
0034 #define FC_LPORT_DBG(lport, fmt, args...) \
0035 FC_CHECK_LOGGING(FC_LPORT_LOGGING, \
0036 pr_info("host%u: lport %6.6x: " fmt, \
0037 (lport)->host->host_no, \
0038 (lport)->port_id, ##args))
0039
0040 #define FC_DISC_DBG(disc, fmt, args...) \
0041 FC_CHECK_LOGGING(FC_DISC_LOGGING, \
0042 pr_info("host%u: disc: " fmt, \
0043 fc_disc_lport(disc)->host->host_no, \
0044 ##args))
0045
0046 #define FC_RPORT_ID_DBG(lport, port_id, fmt, args...) \
0047 FC_CHECK_LOGGING(FC_RPORT_LOGGING, \
0048 pr_info("host%u: rport %6.6x: " fmt, \
0049 (lport)->host->host_no, \
0050 (port_id), ##args))
0051
0052 #define FC_RPORT_DBG(rdata, fmt, args...) \
0053 FC_RPORT_ID_DBG((rdata)->local_port, (rdata)->ids.port_id, fmt, ##args)
0054
0055 #define FC_FCP_DBG(pkt, fmt, args...) \
0056 FC_CHECK_LOGGING(FC_FCP_LOGGING, \
0057 { \
0058 if ((pkt)->seq_ptr) { \
0059 struct fc_exch *_ep = NULL; \
0060 _ep = fc_seq_exch((pkt)->seq_ptr); \
0061 pr_info("host%u: fcp: %6.6x: " \
0062 "xid %04x-%04x: " fmt, \
0063 (pkt)->lp->host->host_no, \
0064 (pkt)->rport->port_id, \
0065 (_ep)->oxid, (_ep)->rxid, ##args); \
0066 } else { \
0067 pr_info("host%u: fcp: %6.6x: " fmt, \
0068 (pkt)->lp->host->host_no, \
0069 (pkt)->rport->port_id, ##args); \
0070 } \
0071 })
0072
0073 #define FC_EXCH_DBG(exch, fmt, args...) \
0074 FC_CHECK_LOGGING(FC_EXCH_LOGGING, \
0075 pr_info("host%u: xid %4x: " fmt, \
0076 (exch)->lp->host->host_no, \
0077 exch->xid, ##args))
0078
0079 #define FC_SCSI_DBG(lport, fmt, args...) \
0080 FC_CHECK_LOGGING(FC_SCSI_LOGGING, \
0081 pr_info("host%u: scsi: " fmt, \
0082 (lport)->host->host_no, ##args))
0083
0084
0085
0086
0087 extern struct fc4_prov *fc_active_prov[];
0088 extern struct fc4_prov *fc_passive_prov[];
0089 extern struct mutex fc_prov_mutex;
0090
0091 extern struct fc4_prov fc_rport_t0_prov;
0092 extern struct fc4_prov fc_lport_els_prov;
0093 extern struct fc4_prov fc_rport_fcp_init;
0094
0095
0096
0097
0098 void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid);
0099 void fc_fcp_ddp_done(struct fc_fcp_pkt *fsp);
0100
0101
0102
0103
0104 int fc_setup_exch_mgr(void);
0105 void fc_destroy_exch_mgr(void);
0106 int fc_setup_rport(void);
0107 void fc_destroy_rport(void);
0108 int fc_setup_fcp(void);
0109 void fc_destroy_fcp(void);
0110
0111
0112
0113
0114 const char *fc_els_resp_type(struct fc_frame *);
0115 extern void fc_fc4_add_lport(struct fc_lport *);
0116 extern void fc_fc4_del_lport(struct fc_lport *);
0117 extern void fc_fc4_conf_lport_params(struct fc_lport *, enum fc_fh_type);
0118
0119
0120
0121
0122 u32 fc_copy_buffer_to_sglist(void *buf, size_t len,
0123 struct scatterlist *sg,
0124 u32 *nents, size_t *offset,
0125 u32 *crc);
0126
0127 #endif