[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>
This commit is contained in:
parent
255f6386b8
commit
8866a5d907
@ -3,6 +3,7 @@
|
||||
obj-$(CONFIG_LIBFC) += libfc.o
|
||||
|
||||
libfc-objs := \
|
||||
fc_libfc.o \
|
||||
fc_disc.o \
|
||||
fc_exch.o \
|
||||
fc_elsct.o \
|
||||
|
@ -40,6 +40,8 @@
|
||||
|
||||
#include <scsi/libfc.h>
|
||||
|
||||
#include "fc_libfc.h"
|
||||
|
||||
#define FC_DISC_RETRY_LIMIT 3 /* max retries */
|
||||
#define FC_DISC_RETRY_DELAY 500UL /* (msecs) delay */
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include <scsi/libfc.h>
|
||||
#include <scsi/fc_encode.h>
|
||||
|
||||
#include "fc_libfc.h"
|
||||
|
||||
u16 fc_cpu_mask; /* cpu mask for possible cpus */
|
||||
EXPORT_SYMBOL(fc_cpu_mask);
|
||||
static u16 fc_cpu_order; /* 2's power to represent total possible cpus */
|
||||
|
@ -39,13 +39,7 @@
|
||||
#include <scsi/libfc.h>
|
||||
#include <scsi/fc_encode.h>
|
||||
|
||||
MODULE_AUTHOR("Open-FCoE.org");
|
||||
MODULE_DESCRIPTION("libfc");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
||||
unsigned int fc_debug_logging;
|
||||
module_param_named(debug_logging, fc_debug_logging, int, S_IRUGO|S_IWUSR);
|
||||
MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");
|
||||
#include "fc_libfc.h"
|
||||
|
||||
static struct kmem_cache *scsi_pkt_cachep;
|
||||
|
||||
|
35
drivers/scsi/libfc/fc_libfc.c
Normal file
35
drivers/scsi/libfc/fc_libfc.c
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright(c) 2009 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Maintained at www.Open-FCoE.org
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/crc32.h>
|
||||
|
||||
#include <scsi/libfc.h>
|
||||
|
||||
#include "fc_libfc.h"
|
||||
|
||||
MODULE_AUTHOR("Open-FCoE.org");
|
||||
MODULE_DESCRIPTION("libfc");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
||||
unsigned int fc_debug_logging;
|
||||
module_param_named(debug_logging, fc_debug_logging, int, S_IRUGO|S_IWUSR);
|
||||
MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");
|
102
drivers/scsi/libfc/fc_libfc.h
Normal file
102
drivers/scsi/libfc/fc_libfc.h
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright(c) 2009 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Maintained at www.Open-FCoE.org
|
||||
*/
|
||||
|
||||
#ifndef _FC_LIBFC_H_
|
||||
#define _FC_LIBFC_H_
|
||||
|
||||
#define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */
|
||||
#define FC_LPORT_LOGGING 0x02 /* lport layer logging */
|
||||
#define FC_DISC_LOGGING 0x04 /* discovery layer logging */
|
||||
#define FC_RPORT_LOGGING 0x08 /* rport layer logging */
|
||||
#define FC_FCP_LOGGING 0x10 /* I/O path logging */
|
||||
#define FC_EM_LOGGING 0x20 /* Exchange Manager logging */
|
||||
#define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */
|
||||
#define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */
|
||||
|
||||
extern unsigned int fc_debug_logging;
|
||||
|
||||
#define FC_CHECK_LOGGING(LEVEL, CMD) \
|
||||
do { \
|
||||
if (unlikely(fc_debug_logging & LEVEL)) \
|
||||
do { \
|
||||
CMD; \
|
||||
} while (0); \
|
||||
} while (0)
|
||||
|
||||
#define FC_LIBFC_DBG(fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \
|
||||
printk(KERN_INFO "libfc: " fmt, ##args))
|
||||
|
||||
#define FC_LPORT_DBG(lport, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_LPORT_LOGGING, \
|
||||
printk(KERN_INFO "host%u: lport %6x: " fmt, \
|
||||
(lport)->host->host_no, \
|
||||
fc_host_port_id((lport)->host), ##args))
|
||||
|
||||
#define FC_DISC_DBG(disc, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_DISC_LOGGING, \
|
||||
printk(KERN_INFO "host%u: disc: " fmt, \
|
||||
(disc)->lport->host->host_no, \
|
||||
##args))
|
||||
|
||||
#define FC_RPORT_ID_DBG(lport, port_id, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_RPORT_LOGGING, \
|
||||
printk(KERN_INFO "host%u: rport %6x: " fmt, \
|
||||
(lport)->host->host_no, \
|
||||
(port_id), ##args))
|
||||
|
||||
#define FC_RPORT_DBG(rdata, fmt, args...) \
|
||||
FC_RPORT_ID_DBG((rdata)->local_port, (rdata)->ids.port_id, fmt, ##args)
|
||||
|
||||
#define FC_FCP_DBG(pkt, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_FCP_LOGGING, \
|
||||
printk(KERN_INFO "host%u: fcp: %6x: " fmt, \
|
||||
(pkt)->lp->host->host_no, \
|
||||
pkt->rport->port_id, ##args))
|
||||
|
||||
#define FC_EXCH_DBG(exch, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_EXCH_LOGGING, \
|
||||
printk(KERN_INFO "host%u: xid %4x: " fmt, \
|
||||
(exch)->lp->host->host_no, \
|
||||
exch->xid, ##args))
|
||||
|
||||
#define FC_SCSI_DBG(lport, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_SCSI_LOGGING, \
|
||||
printk(KERN_INFO "host%u: scsi: " fmt, \
|
||||
(lport)->host->host_no, ##args))
|
||||
|
||||
/*
|
||||
* Set up direct-data placement for this I/O request
|
||||
*/
|
||||
void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid);
|
||||
|
||||
/*
|
||||
* Module setup functions
|
||||
*/
|
||||
int fc_setup_exch_mgr(void);
|
||||
void fc_destroy_exch_mgr(void);
|
||||
int fc_setup_rport(void);
|
||||
void fc_destroy_rport(void);
|
||||
|
||||
/*
|
||||
* Internal libfc functions
|
||||
*/
|
||||
const char *fc_els_resp_type(struct fc_frame *);
|
||||
|
||||
#endif /* _FC_LIBFC_H_ */
|
@ -95,6 +95,8 @@
|
||||
#include <scsi/libfc.h>
|
||||
#include <scsi/fc_encode.h>
|
||||
|
||||
#include "fc_libfc.h"
|
||||
|
||||
/* Fabric IDs to use for point-to-point mode, chosen on whims. */
|
||||
#define FC_LOCAL_PTP_FID_LO 0x010101
|
||||
#define FC_LOCAL_PTP_FID_HI 0x010102
|
||||
|
@ -55,6 +55,8 @@
|
||||
#include <scsi/libfc.h>
|
||||
#include <scsi/fc_encode.h>
|
||||
|
||||
#include "fc_libfc.h"
|
||||
|
||||
struct workqueue_struct *rport_event_queue;
|
||||
|
||||
static void fc_rport_enter_plogi(struct fc_rport_priv *);
|
||||
|
@ -34,67 +34,6 @@
|
||||
|
||||
#include <scsi/fc_frame.h>
|
||||
|
||||
#define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */
|
||||
#define FC_LPORT_LOGGING 0x02 /* lport layer logging */
|
||||
#define FC_DISC_LOGGING 0x04 /* discovery layer logging */
|
||||
#define FC_RPORT_LOGGING 0x08 /* rport layer logging */
|
||||
#define FC_FCP_LOGGING 0x10 /* I/O path logging */
|
||||
#define FC_EM_LOGGING 0x20 /* Exchange Manager logging */
|
||||
#define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */
|
||||
#define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */
|
||||
|
||||
extern unsigned int fc_debug_logging;
|
||||
|
||||
#define FC_CHECK_LOGGING(LEVEL, CMD) \
|
||||
do { \
|
||||
if (unlikely(fc_debug_logging & LEVEL)) \
|
||||
do { \
|
||||
CMD; \
|
||||
} while (0); \
|
||||
} while (0)
|
||||
|
||||
#define FC_LIBFC_DBG(fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \
|
||||
printk(KERN_INFO "libfc: " fmt, ##args))
|
||||
|
||||
#define FC_LPORT_DBG(lport, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_LPORT_LOGGING, \
|
||||
printk(KERN_INFO "host%u: lport %6x: " fmt, \
|
||||
(lport)->host->host_no, \
|
||||
fc_host_port_id((lport)->host), ##args))
|
||||
|
||||
#define FC_DISC_DBG(disc, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_DISC_LOGGING, \
|
||||
printk(KERN_INFO "host%u: disc: " fmt, \
|
||||
(disc)->lport->host->host_no, \
|
||||
##args))
|
||||
|
||||
#define FC_RPORT_ID_DBG(lport, port_id, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_RPORT_LOGGING, \
|
||||
printk(KERN_INFO "host%u: rport %6x: " fmt, \
|
||||
(lport)->host->host_no, \
|
||||
(port_id), ##args))
|
||||
|
||||
#define FC_RPORT_DBG(rdata, fmt, args...) \
|
||||
FC_RPORT_ID_DBG((rdata)->local_port, (rdata)->ids.port_id, fmt, ##args)
|
||||
|
||||
#define FC_FCP_DBG(pkt, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_FCP_LOGGING, \
|
||||
printk(KERN_INFO "host%u: fcp: %6x: " fmt, \
|
||||
(pkt)->lp->host->host_no, \
|
||||
pkt->rport->port_id, ##args))
|
||||
|
||||
#define FC_EXCH_DBG(exch, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_EXCH_LOGGING, \
|
||||
printk(KERN_INFO "host%u: xid %4x: " fmt, \
|
||||
(exch)->lp->host->host_no, \
|
||||
exch->xid, ##args))
|
||||
|
||||
#define FC_SCSI_DBG(lport, fmt, args...) \
|
||||
FC_CHECK_LOGGING(FC_SCSI_LOGGING, \
|
||||
printk(KERN_INFO "host%u: scsi: " fmt, \
|
||||
(lport)->host->host_no, ##args))
|
||||
|
||||
/*
|
||||
* libfc error codes
|
||||
*/
|
||||
@ -923,11 +862,6 @@ int fc_change_queue_type(struct scsi_device *sdev, int tag_type);
|
||||
*/
|
||||
void fc_fcp_destroy(struct fc_lport *);
|
||||
|
||||
/*
|
||||
* Set up direct-data placement for this I/O request
|
||||
*/
|
||||
void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid);
|
||||
|
||||
/*
|
||||
* ELS/CT interface
|
||||
*****************************/
|
||||
@ -1020,17 +954,4 @@ void fc_get_host_port_state(struct Scsi_Host *shost);
|
||||
void fc_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout);
|
||||
struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *);
|
||||
|
||||
/*
|
||||
* module setup functions.
|
||||
*/
|
||||
int fc_setup_exch_mgr(void);
|
||||
void fc_destroy_exch_mgr(void);
|
||||
int fc_setup_rport(void);
|
||||
void fc_destroy_rport(void);
|
||||
|
||||
/*
|
||||
* Internal libfc functions.
|
||||
*/
|
||||
const char *fc_els_resp_type(struct fc_frame *);
|
||||
|
||||
#endif /* _LIBFC_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user