[Open-FCoE] [PATCH 5/7] Removed mfs use in fc_port

Vasu Dev vasu.dev at intel.com
Tue Apr 1 15:26:03 UTC 2008


Moved mfs related code to fcs_state.

Signed-off-by: Vasu Dev <vasu.dev at intel.com>

Signed-off-by: Vasu Dev <vasu.dev at intel.com>
---

 drivers/scsi/ofc/include/fcs_state.h     |    7 ++++++-
 drivers/scsi/ofc/openfc/fc_local_port.c  |    4 ++--
 drivers/scsi/ofc/openfc/fcs_state.c      |   17 +++++++++++++----
 drivers/scsi/ofc/openfc/fcs_state_impl.h |    1 +
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/ofc/include/fcs_state.h b/drivers/scsi/ofc/include/fcs_state.h
index 512d6d6..c58fa4e 100644
--- a/drivers/scsi/ofc/include/fcs_state.h
+++ b/drivers/scsi/ofc/include/fcs_state.h
@@ -89,7 +89,12 @@ void fcs_reset(struct fcs_state *);
  * Change maximum frame size.
  * Returns zero on success.
  */
-int fcs_set_mfs(struct fcs_state *, u_int);
+int fcs_set_mfs(struct fcs_state *, u32);
+
+/*
+ * Returns current maximum frame size.
+ */
+u32 fcs_get_mfs(struct fcs_state *);
 
 /*
  * Get a session for access to a remote port.
diff --git a/drivers/scsi/ofc/openfc/fc_local_port.c b/drivers/scsi/ofc/openfc/fc_local_port.c
index 3f85c20..537d611 100644
--- a/drivers/scsi/ofc/openfc/fc_local_port.c
+++ b/drivers/scsi/ofc/openfc/fc_local_port.c
@@ -1065,7 +1065,7 @@ void fc_local_port_logoff(struct fc_local_port *lp)
 static void fc_local_port_enter_init(struct fc_local_port *lp)
 {
 	struct fc_sess *sess;
-	u_int mfs;
+	u32 mfs;
 
 	if (fc_local_port_debug)
 		OFC_DBG("new state init");
@@ -1077,7 +1077,7 @@ static void fc_local_port_enter_init(struct fc_local_port *lp)
 	}
 	fc_local_port_ptp_clear(lp);
 
-	mfs = fc_port_get_max_frame_size(lp->fl_port);
+	mfs = fcs_get_mfs(lp->sp);
 	if (mfs < FC_SP_MIN_MAX_PAYLOAD) {
 		OFC_DBG("warning: port max frame size %d too small", mfs);
 		mfs = FC_SP_MIN_MAX_PAYLOAD + sizeof(struct fc_frame_header);
diff --git a/drivers/scsi/ofc/openfc/fcs_state.c b/drivers/scsi/ofc/openfc/fcs_state.c
index 769ca85..9aa4740 100644
--- a/drivers/scsi/ofc/openfc/fcs_state.c
+++ b/drivers/scsi/ofc/openfc/fcs_state.c
@@ -68,27 +68,36 @@ static void fcs_nop(void)
 {
 }
 
-static int fcs_set_mfs_int(struct fcs_state *sp, u_int mfs)
+static int fcs_set_mfs_int(struct fcs_state *sp, u32 mfs)
 {
 	if (mfs >= FC_MIN_MAX_FRAME) {
-		fc_port_set_max_frame_size(sp->fs_inner_port, mfs);
+		mfs &= ~3;
+		WARN_ON((size_t) mfs < FC_MIN_MAX_FRAME);
+		if (mfs > FC_MAX_FRAME)
+			mfs = FC_MAX_FRAME;
+		sp->mfs = mfs;
 		return 0;
 	}
 	return -1;
 }
 
-int fcs_set_mfs(struct fcs_state *sp, u_int mfs)
+int fcs_set_mfs(struct fcs_state *sp, u32 mfs)
 {
 	u_int old_mfs;
 	int error;
 
-	old_mfs = fc_port_get_max_frame_size(sp->fs_inner_port);
+	old_mfs = sp->mfs;
 	error = fcs_set_mfs_int(sp, mfs);
 	if (error == 0 && mfs < old_mfs)
 		fcs_reset(sp);
 	return error;
 }
 
+u32 fcs_get_mfs(struct fcs_state *sp)
+{
+	return sp->mfs;
+}
+
 /*
  * Allocate the FCS state.
  * Called once per instance of the OpenFC driver.
diff --git a/drivers/scsi/ofc/openfc/fcs_state_impl.h b/drivers/scsi/ofc/openfc/fcs_state_impl.h
index d33b49c..19b9cc0 100644
--- a/drivers/scsi/ofc/openfc/fcs_state_impl.h
+++ b/drivers/scsi/ofc/openfc/fcs_state_impl.h
@@ -30,6 +30,7 @@ struct fcs_state {
 	struct fcs_create_args	fs_args;
 	struct fc_virt_fab *fs_vf;		/* virtual fabric (domain) */
 	struct fc_local_port *fs_local_port;	/* local port */
+	u32	mfs;				/* max send frame size */
 	struct fc_port	*fs_inner_port;		/* port used by local port */
 	uint8_t		fs_disc_done;		/* discovery complete */
 	struct sa_event_list *events;		/* fcs events */




More information about the devel mailing list