public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org
Cc: Robert Love <robert.w.love@intel.com>
Subject: [PATCH 05/54] libfc: Add libfc/fc_libfc.[ch] for libfc internal routines
Date: Tue, 03 Nov 2009 11:45:58 -0800	[thread overview]
Message-ID: <20091103194558.4085.28642.stgit@localhost.localdomain> (raw)
In-Reply-To: <20091103194530.4085.37963.stgit@localhost.localdomain>

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>
---

 drivers/scsi/libfc/Makefile   |    1 
 drivers/scsi/libfc/fc_disc.c  |    2 +
 drivers/scsi/libfc/fc_exch.c  |    2 +
 drivers/scsi/libfc/fc_fcp.c   |    8 ---
 drivers/scsi/libfc/fc_libfc.c |   35 ++++++++++++++
 drivers/scsi/libfc/fc_libfc.h |  102 +++++++++++++++++++++++++++++++++++++++++
 drivers/scsi/libfc/fc_lport.c |    2 +
 drivers/scsi/libfc/fc_rport.c |    2 +
 include/scsi/libfc.h          |   79 --------------------------------
 9 files changed, 147 insertions(+), 86 deletions(-)
 create mode 100644 drivers/scsi/libfc/fc_libfc.c
 create mode 100644 drivers/scsi/libfc/fc_libfc.h

diff --git a/drivers/scsi/libfc/Makefile b/drivers/scsi/libfc/Makefile
index 55f982d..2be549c 100644
--- a/drivers/scsi/libfc/Makefile
+++ b/drivers/scsi/libfc/Makefile
@@ -3,6 +3,7 @@
 obj-$(CONFIG_LIBFC) += libfc.o
 
 libfc-objs := \
+	fc_libfc.o \
 	fc_disc.o \
 	fc_exch.o \
 	fc_elsct.o \
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index d4cb3f9..a4bdec2 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -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 */
 
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 659bb05..ee6031e 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -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 */
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 3ab08f8..8a31ced 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -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;
 
diff --git a/drivers/scsi/libfc/fc_libfc.c b/drivers/scsi/libfc/fc_libfc.c
new file mode 100644
index 0000000..e64ea87
--- /dev/null
+++ b/drivers/scsi/libfc/fc_libfc.c
@@ -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");
diff --git a/drivers/scsi/libfc/fc_libfc.h b/drivers/scsi/libfc/fc_libfc.h
new file mode 100644
index 0000000..388fae4
--- /dev/null
+++ b/drivers/scsi/libfc/fc_libfc.h
@@ -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_ */
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 536492a..f7f20a4 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -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
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 324e156..622285c 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -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 *);
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index db2175d..690f829 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -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
  */
@@ -924,11 +863,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_ */


  parent reply	other threads:[~2009-11-03 19:45 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03 19:45 [PATCH 00/54] libfc, libfcoe, fcoe and fnic updates for 2.6.33 Robert Love
2009-11-03 19:45 ` [PATCH 01/54] fnic: Allocate OS interrupt resources just before enabling interrupts Robert Love
2009-11-03 19:45 ` [PATCH 02/54] fcoe: Increase FCOE_MAX_LUN to 0xFFFF (65535) Robert Love
2009-11-03 19:45 ` [PATCH 03/54] libfc: Move non-common routines and prototypes out of libfc.h Robert Love
2009-11-03 19:45 ` [PATCH 04/54] libfc: Remove fc_fcp_complete Robert Love
2009-11-03 19:45 ` Robert Love [this message]
2009-11-03 19:46 ` [PATCH 06/54] libfc: Move libfc_init and libfc_exit to fc_libfc.c Robert Love
2009-11-03 19:46 ` [PATCH 07/54] libfc: changes to libfc_host_alloc to consolidate initialization with allocation Robert Love
2009-11-03 19:46 ` [PATCH 08/54] libfc: add some generic NPIV support routines to libfc Robert Love
2009-11-03 19:46 ` [PATCH 09/54] libfc: vport link handling and fc_vport state managment Robert Love
2009-11-03 19:46 ` [PATCH 10/54] libfc, libfcoe: FDISC ELS for NPIV Robert Love
2009-11-03 19:46 ` [PATCH 11/54] libfcoe, fcoe: libfcoe NPIV support Robert Love
2009-11-03 19:46 ` [PATCH 12/54] fcoe: add a separate scsi transport template for NPIV vports Robert Love
2009-11-03 19:46 ` [PATCH 13/54] fcoe: NPIV vport create/destroy Robert Love
2009-11-03 19:46 ` [PATCH 14/54] libfc: RPN_ID is obsolete and unnecessary Robert Love
2009-11-03 19:46 ` [PATCH 15/54] libfc: RNN_ID may be required before RSNN_NN with some switches Robert Love
2009-11-03 19:46 ` [PATCH 16/54] libfc: Register Symbolic Node Name (RSNN_NN) Robert Love
2009-11-03 19:47 ` [PATCH 17/54] libfc: Register Symbolic Port Name (RSPN_ID) Robert Love
2009-11-03 19:47 ` [PATCH 18/54] libfc: combine name server registration response handlers Robert Love
2009-11-03 19:47 ` [PATCH 19/54] libfc: combine name server registration request functions Robert Love
2009-11-03 19:47 ` [PATCH 20/54] fcoe: vport symbolic name support Robert Love
2009-11-03 19:47 ` [PATCH 21/54] libfc: Export FC headers Robert Love
2009-11-03 19:47 ` [PATCH 22/54] libfc: Add routine to copy data from a buffer to a SG list Robert Love
2009-11-03 19:47 ` [PATCH 23/54] libfc, fcoe: Add FC passthrough support Robert Love
2009-11-03 19:47 ` [PATCH 24/54] libfc: Formatting cleanups across libfc Robert Love
2009-11-03 19:47 ` [PATCH 25/54] libfcoe: formatting and comment cleanups Robert Love
2009-11-03 19:47 ` [PATCH 26/54] fcoe: Formatting cleanups and commenting Robert Love
2009-11-03 19:47 ` [PATCH 27/54] fcoe, libfc: use single frame allocation API Robert Love
2009-11-03 19:48 ` [PATCH 28/54] libfc: reduce can_queue for all FCP frame allocation failures Robert Love
2009-11-03 19:48 ` [PATCH 29/54] libfc: adds can_queue ramp up Robert Love
2009-11-03 19:48 ` [PATCH 30/54] libfcoe: Allow FIP to be disabled by the driver Robert Love
2009-11-03 19:48 ` [PATCH 31/54] libfcoe: fip: use SCSI host number to identify debug messages Robert Love
2009-11-03 19:48 ` [PATCH 32/54] libfcoe: fip: allow FIP receive to be called from IRQ Robert Love
2009-11-03 19:48 ` [PATCH 33/54] libfcoe: FIP should report link to libfc whether selected or not Robert Love
2009-11-03 19:48 ` [PATCH 34/54] libfcoe: don't send ELS in FIP mode if no FCF selected Robert Love
2009-11-03 19:48 ` [PATCH 35/54] fcoe: remove extra function decalrations Robert Love
2009-11-03 19:48 ` [PATCH 36/54] fcoe: add check to fail gracefully in bonding mode Robert Love
2009-11-03 19:48 ` [PATCH 37/54] libfc: fix RNN_ID smashing skb payload Robert Love
2009-11-03 19:48 ` [PATCH 38/54] libfc: fix symbolic name registrations smashing skb data Robert Love
2009-11-03 19:49 ` [PATCH 39/54] libfc: fix fc_els_resp_type to correct display of CT responses Robert Love
2009-11-03 19:49 ` [PATCH 40/54] libfc: add set_fid function to libfc template Robert Love
2009-11-03 19:49 ` [PATCH 41/54] libfc: add host number to lport link up/down messages Robert Love
2009-11-03 19:49 ` [PATCH 42/54] libfcoe: fcoe: simplify receive FLOGI response Robert Love
2009-11-03 19:49 ` [PATCH 43/54] fnic: Add FIP support to the fnic driver Robert Love
2009-11-03 19:49 ` [PATCH 44/54] libfc: register FC4 features with the FC switch Robert Love
2009-11-03 19:49 ` [PATCH 45/54] fnic: enable bsg pass-thru for fcping Robert Love
2009-11-03 19:49 ` [PATCH 46/54] fcoe: Fix checking san mac address Robert Love
2009-11-03 19:49 ` [PATCH 47/54] fcoe: Fix getting san mac for VLAN interface Robert Love
2009-11-03 19:49 ` [PATCH 48/54] fcoe: Fix setting lport's WWNN/WWPN to use san mac address Robert Love
2009-11-03 19:49 ` [PATCH 49/54] libfc: do not use DID_NO_CONNECT for pkt alloc failures Robert Love
2009-11-03 19:49 ` [PATCH 50/54] fcoe: Fix using VLAN ID in creating lport's WWWN/WWPN Robert Love
2009-11-03 19:50 ` [PATCH 51/54] libfc, fcoe: fixes for highmem skb linearize panics Robert Love
2009-11-03 19:50 ` [PATCH 52/54] libfc: fix an issue of pending exch/es after i/f destroyed or rmmod fcoe Robert Love
2009-11-03 19:50 ` [PATCH 53/54] libfcoe: Do not pad FIP keep-alive to full frame size Robert Love
2009-11-03 19:50 ` [PATCH 54/54] libfc fcoe: increase ELS and CT timeouts Robert Love

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091103194558.4085.28642.stgit@localhost.localdomain \
    --to=robert.w.love@intel.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox