changeset 9715:8ac355234b9c

6823510 sometimes, the port WWN of fcoe port created by "fcadm create-fcoe-port" is invalid
author Kelly Hu <kelly.hu@Sun.COM>
date Sun, 24 May 2009 21:32:31 +0800
parents c2e4024f4670
children b242b9fcb135
files usr/src/uts/common/io/comstar/port/fcoet/fcoet_eth.c usr/src/uts/common/io/comstar/port/fcoet/fcoet_fc.c
diffstat 2 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/comstar/port/fcoet/fcoet_eth.c	Sat May 23 19:32:05 2009 -0700
+++ b/usr/src/uts/common/io/comstar/port/fcoet/fcoet_eth.c	Sun May 24 21:32:31 2009 +0800
@@ -1129,6 +1129,7 @@
 	int ret = FCOE_SUCCESS;
 	fcoet_exchange_t	*xch = FRM2TFM(frm)->tfm_xch;
 	fct_els_t		*els = CMD2ELS(xch->xch_cmd);
+	fcoet_soft_state_t	*ss = FRM2SS(frm);
 
 	if (els->els_resp_payload[0] == ELS_OP_ACC) {
 		/*
@@ -1137,7 +1138,20 @@
 		 * initial intel implementation will always assign address for
 		 * you even you are in back-to-back mode (direct P2P).
 		 */
-		mutex_enter(&xch->xch_ss->ss_watch_mutex);
+		mutex_enter(&ss->ss_watch_mutex);
+		if (ss->ss_flags & SS_FLAG_PORT_DISABLED ||
+		    (ss->ss_sol_flogi_state != SFS_FLOGI_INIT &&
+		    ss->ss_sol_flogi_state != SFS_FLOGI_CHECK_TIMEOUT &&
+		    ss->ss_sol_flogi_state != SFS_ABTS_INIT)) {
+			/*
+			 * The status is not correct, this response may be
+			 * obsolete.
+			 */
+			mutex_exit(&ss->ss_watch_mutex);
+			FCOET_LOG("fcoet_process_sol_flogi_rsp",
+			    "FLOGI response is obsolete");
+			return (FCOE_FAILURE);
+		}
 		if (xch->xch_flags & XCH_FLAG_NONFCP_REQ_SENT) {
 			xch->xch_cmd->cmd_lportid = FRM_D_ID(frm);
 			xch->xch_ss->ss_link_info.portid =
@@ -1178,7 +1192,7 @@
 			    "FLOGI xch_flags/%x", xch->xch_flags);
 			ret = FCOE_FAILURE;
 		}
-		mutex_exit(&xch->xch_ss->ss_watch_mutex);
+		mutex_exit(&ss->ss_watch_mutex);
 	} else {
 		FCOET_LOG("fcoet_process_sol_flogi_rsp", "FLOGI is rejected");
 		ret = FCOE_FAILURE;
--- a/usr/src/uts/common/io/comstar/port/fcoet/fcoet_fc.c	Sat May 23 19:32:05 2009 -0700
+++ b/usr/src/uts/common/io/comstar/port/fcoet/fcoet_fc.c	Sun May 24 21:32:31 2009 +0800
@@ -575,6 +575,12 @@
 				this_ss->ss_state = FCT_STATE_OFFLINE;
 			}
 		}
+		/*
+		 * Notify the watchdog to do clear work
+		 */
+		mutex_enter(&this_ss->ss_watch_mutex);
+		cv_signal(&this_ss->ss_watch_cv);
+		mutex_exit(&this_ss->ss_watch_mutex);
 		fct_ctl(port->port_lport, FCT_CMD_PORT_OFFLINE_COMPLETE, &st);
 		break;