port = fsf_req->data.open_port.port; 
port = (struct zfcp_port *) fsf_req->data; 
zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req){	int retval = -EINVAL;	struct zfcp_port *port;	struct fsf_plogi *plogi;	struct fsf_qtcb_header *header;	u16 subtable, rule, counter;	port = fsf_req->data.open_port.port;	header = &fsf_req->qtcb->header;	if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) {		/* don't change port status in our bookkeeping */		goto skip_fsfstatus;	}	/* evaluate FSF status in QTCB */	switch (header->fsf_status) {	case FSF_PORT_ALREADY_OPEN:		ZFCP_LOG_NORMAL("bug: remote port 0x%016Lx on adapter %s "				"is already open.\n",				port->wwpn, zfcp_get_busid_by_port(port));		debug_text_exception(fsf_req->adapter->erp_dbf, 0,				     "fsf_s_popen");		/*		 * This is a bug, however operation should continue normally		 * if it is simply ignored		 */		break;	case FSF_ACCESS_DENIED:		ZFCP_LOG_NORMAL("Access denied, cannot open port 0x%016Lx "				"on adapter %s\n",				port->wwpn, zfcp_get_busid_by_port(port));		for (counter = 0; counter < 2; counter++) {			subtable = header->fsf_status_qual.halfword[counter * 2];			rule = header->fsf_status_qual.halfword[counter * 2 + 1];			switch (subtable) {			case FSF_SQ_CFDC_SUBTABLE_OS:			case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:			case FSF_SQ_CFDC_SUBTABLE_PORT_DID:			case FSF_SQ_CFDC_SUBTABLE_LUN:				ZFCP_LOG_INFO("Access denied (%s rule %d)\n",					zfcp_act_subtable_type[subtable], rule);				break;			}		}		debug_text_event(fsf_req->adapter->erp_dbf, 1, "fsf_s_access");		zfcp_erp_port_access_denied(port);		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED:		ZFCP_LOG_INFO("error: The FSF adapter is out of resources. "			      "The remote port 0x%016Lx on adapter %s "			      "could not be opened. Disabling it.\n",			      port->wwpn, zfcp_get_busid_by_port(port));		debug_text_event(fsf_req->adapter->erp_dbf, 1,				 "fsf_s_max_ports");		zfcp_erp_port_failed(port);		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	case FSF_ADAPTER_STATUS_AVAILABLE:		switch (header->fsf_status_qual.word[0]) {		case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE:			debug_text_event(fsf_req->adapter->erp_dbf, 1,					 "fsf_sq_ltest");			/* ERP strategy will escalate */			fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;			break;		case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED:			/* ERP strategy will escalate */			debug_text_event(fsf_req->adapter->erp_dbf, 1,					 "fsf_sq_ulp");			fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;			break;		case FSF_SQ_NO_RETRY_POSSIBLE:			ZFCP_LOG_NORMAL("The remote port 0x%016Lx on "					"adapter %s could not be opened. "					"Disabling it.\n",					port->wwpn,					zfcp_get_busid_by_port(port));			debug_text_exception(fsf_req->adapter->erp_dbf, 0,					     "fsf_sq_no_retry");			zfcp_erp_port_failed(port);			fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;			break;		default:			ZFCP_LOG_NORMAL			    ("bug: Wrong status qualifier 0x%x arrived.\n",			     header->fsf_status_qual.word[0]);			debug_text_event(fsf_req->adapter->erp_dbf, 0,					 "fsf_sq_inval:");			debug_exception(				fsf_req->adapter->erp_dbf, 0,				&header->fsf_status_qual.word[0],				sizeof (u32));			break;		}		break;	case FSF_GOOD:		/* save port handle assigned by FSF */		port->handle = header->port_handle;		ZFCP_LOG_INFO("The remote port 0x%016Lx via adapter %s "			      "was opened, it's port handle is 0x%x\n",			      port->wwpn, zfcp_get_busid_by_port(port),			      port->handle);		/* mark port as open */		atomic_set_mask(ZFCP_STATUS_COMMON_OPEN |				ZFCP_STATUS_PORT_PHYS_OPEN, &port->status);		atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |		                  ZFCP_STATUS_COMMON_ACCESS_BOXED,		                  &port->status);		retval = 0;		/* check whether D_ID has changed during open */		/*		 * FIXME: This check is not airtight, as the FCP channel does		 * not monitor closures of target port connections caused on		 * the remote side. Thus, they might miss out on invalidating		 * locally cached WWPNs (and other N_Port parameters) of gone		 * target ports. So, our heroic attempt to make things safe		 * could be undermined by 'open port' response data tagged with		 * obsolete WWPNs. Another reason to monitor potential		 * connection closures ourself at least (by interpreting		 * incoming ELS' and unsolicited status). It just crosses my		 * mind that one should be able to cross-check by means of		 * another GID_PN straight after a port has been opened.		 * Alternately, an ADISC/PDISC ELS should suffice, as well.		 */		plogi = (struct fsf_plogi *) fsf_req->qtcb->bottom.support.els;		if (!atomic_test_mask(ZFCP_STATUS_PORT_NO_WWPN, &port->status))		{			if (fsf_req->qtcb->bottom.support.els1_length <			    ((((unsigned long) &plogi->serv_param.wwpn) -			      ((unsigned long) plogi)) + sizeof (u64))) {				ZFCP_LOG_INFO(					"warning: insufficient length of "					"PLOGI payload (%i)\n",					fsf_req->qtcb->bottom.support.els1_length);				debug_text_event(fsf_req->adapter->erp_dbf, 0,						 "fsf_s_short_plogi:");				/* skip sanity check and assume wwpn is ok */			} else {				if (plogi->serv_param.wwpn != port->wwpn) {					ZFCP_LOG_INFO("warning: d_id of port "						      "0x%016Lx changed during "						      "open\n", port->wwpn);					debug_text_event(						fsf_req->adapter->erp_dbf, 0,						"fsf_s_did_change:");					atomic_clear_mask(						ZFCP_STATUS_PORT_DID_DID,						&port->status);				} else					port->wwnn = plogi->serv_param.wwnn;			}		}		break;	case FSF_UNKNOWN_OP_SUBTYPE:		/* should never occure, subtype not set in zfcp_fsf_open_port */		ZFCP_LOG_INFO("unknown operation subtype (adapter: %s, "			      "op_subtype=0x%x)\n",			      zfcp_get_busid_by_port(port),			      fsf_req->qtcb->bottom.support.operation_subtype);		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	default:		ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "				"(debug info 0x%x)\n",				header->fsf_status);		debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf_s_inval:");		debug_exception(fsf_req->adapter->erp_dbf, 0,				&header->fsf_status, sizeof (u32));		break;	} skip_fsfstatus:	atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING, &port->status);	return retval;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/059c97d0434834d291eff94669ca2dd3eaac9d28/zfcp_fsf.c/clean/drivers/s390/scsi/zfcp_fsf.c