ZFCP_LOG_FLAGS(0, "FSF_FCPLUN_NOT_VALID\n"); 
zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req){	int retval = -EINVAL;	struct zfcp_unit *unit;	struct fsf_qtcb_header *header;	u16 subtable, rule, counter;	header = &fsf_req->qtcb->header;	if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT))		unit = fsf_req->data.send_fcp_command_task_management.unit;	else		unit = fsf_req->data.send_fcp_command_task.unit;	if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) {		/* go directly to calls of special handlers */		goto skip_fsfstatus;	}	/* evaluate FSF status in QTCB */	switch (header->fsf_status) {	case FSF_PORT_HANDLE_NOT_VALID:		ZFCP_LOG_FLAGS(1, "FSF_PORT_HANDLE_NOT_VALID\n");		ZFCP_LOG_INFO("Temporary port identifier 0x%x for port "			      "0x%016Lx on adapter %s invalid\n",			      unit->port->handle,			      unit->port->wwpn, zfcp_get_busid_by_unit(unit));		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,			      (char *) &header->fsf_status_qual,			      sizeof (union fsf_status_qual));		debug_text_event(fsf_req->adapter->erp_dbf, 1,				 "fsf_s_phand_nv");		zfcp_erp_adapter_reopen(unit->port->adapter, 0);		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	case FSF_LUN_HANDLE_NOT_VALID:		ZFCP_LOG_FLAGS(1, "FSF_LUN_HANDLE_NOT_VALID\n");		ZFCP_LOG_INFO("Temporary LUN identifier 0x%x for unit "			      "0x%016Lx on port 0x%016Lx on adapter %s is "			      "invalid. This may happen occasionally.\n",			      unit->handle,			      unit->fcp_lun,			      unit->port->wwpn,			      zfcp_get_busid_by_unit(unit));		ZFCP_LOG_NORMAL("Status qualifier data:\n");		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,			      (char *) &header->fsf_status_qual,			      sizeof (union fsf_status_qual));		debug_text_event(fsf_req->adapter->erp_dbf, 1,				 "fsf_s_uhand_nv");		zfcp_erp_port_reopen(unit->port, 0);		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	case FSF_HANDLE_MISMATCH:		ZFCP_LOG_FLAGS(0, "FSF_HANDLE_MISMATCH\n");		ZFCP_LOG_NORMAL("bug: The port handle 0x%x has changed "				"unexpectedly. (adapter %s, port 0x%016Lx, "				"unit 0x%016Lx)\n",				unit->port->handle,				zfcp_get_busid_by_unit(unit),				unit->port->wwpn,				unit->fcp_lun);		ZFCP_LOG_NORMAL("status qualifier:\n");		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,			      (char *) &header->fsf_status_qual,			      sizeof (union fsf_status_qual));		debug_text_event(fsf_req->adapter->erp_dbf, 1,				 "fsf_s_hand_mis");		zfcp_erp_adapter_reopen(unit->port->adapter, 0);		zfcp_cmd_dbf_event_fsf("handmism",				       fsf_req,				       &header->fsf_status_qual,				       sizeof (union fsf_status_qual));		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	case FSF_SERVICE_CLASS_NOT_SUPPORTED:		ZFCP_LOG_FLAGS(0, "FSF_SERVICE_CLASS_NOT_SUPPORTED\n");		if (fsf_req->adapter->fc_service_class <= 3) {			ZFCP_LOG_NORMAL("error: The adapter %s does "					"not support fibrechannel class %d.\n",					zfcp_get_busid_by_unit(unit),					fsf_req->adapter->fc_service_class);		} else {			ZFCP_LOG_NORMAL("bug: The fibrechannel class at "					"adapter %s is invalid. "					"(debug info %d)\n",					zfcp_get_busid_by_unit(unit),					fsf_req->adapter->fc_service_class);		}		/* stop operation for this adapter */		debug_text_exception(fsf_req->adapter->erp_dbf, 0,				     "fsf_s_class_nsup");		zfcp_erp_adapter_shutdown(unit->port->adapter, 0);		zfcp_cmd_dbf_event_fsf("unsclass",				       fsf_req,				       &header->fsf_status_qual,				       sizeof (union fsf_status_qual));		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	case FSF_FCPLUN_NOT_VALID:		ZFCP_LOG_FLAGS(0, "FSF_FCPLUN_NOT_VALID\n");		ZFCP_LOG_NORMAL("bug: unit 0x%016Lx on port 0x%016Lx on "				"adapter %s does not have correct unit "				"handle 0x%x\n",				unit->fcp_lun,				unit->port->wwpn,				zfcp_get_busid_by_unit(unit),				unit->handle);		ZFCP_LOG_DEBUG("status qualifier:\n");		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,			      (char *) &header->fsf_status_qual,			      sizeof (union fsf_status_qual));		debug_text_event(fsf_req->adapter->erp_dbf, 1,				 "fsf_s_fcp_lun_nv");		zfcp_erp_port_reopen(unit->port, 0);		zfcp_cmd_dbf_event_fsf("fluninv",				       fsf_req,				       &header->fsf_status_qual,				       sizeof (union fsf_status_qual));		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	case FSF_ACCESS_DENIED:		ZFCP_LOG_FLAGS(2, "FSF_ACCESS_DENIED\n");		ZFCP_LOG_NORMAL("Access denied, cannot send FCP command to "				"unit 0x%016Lx on port 0x%016Lx on "				"adapter %s\n",	unit->fcp_lun, unit->port->wwpn,				zfcp_get_busid_by_unit(unit));		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_unit_access_denied(unit);		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	case FSF_DIRECTION_INDICATOR_NOT_VALID:		ZFCP_LOG_FLAGS(0, "FSF_DIRECTION_INDICATOR_NOT_VALID\n");		ZFCP_LOG_INFO("bug: Invalid data direction given for unit "			      "0x%016Lx on port 0x%016Lx on adapter %s "			      "(debug info %d)\n",			      unit->fcp_lun,			      unit->port->wwpn,			      zfcp_get_busid_by_unit(unit),			      fsf_req->qtcb->bottom.io.data_direction);		/* stop operation for this adapter */		debug_text_event(fsf_req->adapter->erp_dbf, 0,				 "fsf_s_dir_ind_nv");		zfcp_erp_adapter_shutdown(unit->port->adapter, 0);		zfcp_cmd_dbf_event_fsf("dirinv",				       fsf_req,				       &header->fsf_status_qual,				       sizeof (union fsf_status_qual));		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	case FSF_CMND_LENGTH_NOT_VALID:		ZFCP_LOG_FLAGS(0, "FSF_CMND_LENGTH_NOT_VALID\n");		ZFCP_LOG_NORMAL		    ("bug: An invalid control-data-block length field "		     "was found in a command for unit 0x%016Lx on port "		     "0x%016Lx on adapter %s " "(debug info %d)\n",		     unit->fcp_lun, unit->port->wwpn,		     zfcp_get_busid_by_unit(unit),		     fsf_req->qtcb->bottom.io.fcp_cmnd_length);		/* stop operation for this adapter */		debug_text_event(fsf_req->adapter->erp_dbf, 0,				 "fsf_s_cmd_len_nv");		zfcp_erp_adapter_shutdown(unit->port->adapter, 0);		zfcp_cmd_dbf_event_fsf("cleninv",				       fsf_req,				       &header->fsf_status_qual,				       sizeof (union fsf_status_qual));		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;		break;	case FSF_PORT_BOXED:		ZFCP_LOG_FLAGS(2, "FSF_PORT_BOXED\n");		ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s "			       "needs to be reopened\n",			       unit->port->wwpn, zfcp_get_busid_by_unit(unit));		debug_text_event(fsf_req->adapter->erp_dbf, 2, "fsf_s_pboxed");		zfcp_erp_port_reopen(unit->port, 0);		zfcp_cmd_dbf_event_fsf("portbox", fsf_req,				       &header->fsf_status_qual,				       sizeof (union fsf_status_qual));		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |			ZFCP_STATUS_FSFREQ_RETRY;		break;	case FSF_LUN_BOXED:		ZFCP_LOG_FLAGS(0, "FSF_LUN_BOXED\n");		ZFCP_LOG_NORMAL("unit needs to be reopened (adapter %s, "				"wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",				zfcp_get_busid_by_unit(unit),				unit->port->wwpn, unit->fcp_lun);		debug_text_event(fsf_req->adapter->erp_dbf, 1, "fsf_s_lboxed");		zfcp_erp_unit_reopen(unit, 0);		zfcp_cmd_dbf_event_fsf("unitbox", fsf_req,				       &header->fsf_status_qual,				       sizeof(union fsf_status_qual));		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR			| ZFCP_STATUS_FSFREQ_RETRY;		break;	case FSF_ADAPTER_STATUS_AVAILABLE:		ZFCP_LOG_FLAGS(2, "FSF_ADAPTER_STATUS_AVAILABLE\n");		switch (header->fsf_status_qual.word[0]) {		case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE:			ZFCP_LOG_FLAGS(2,				       "FSF_SQ_INVOKE_LINK_TEST_PROCEDURE\n");			/* re-establish link to port */			debug_text_event(fsf_req->adapter->erp_dbf, 1,					 "fsf_sq_ltest");			zfcp_erp_port_reopen(unit->port, 0);			zfcp_cmd_dbf_event_fsf(				"sqltest",				fsf_req,				&header->fsf_status_qual,				sizeof (union fsf_status_qual));			fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;			break;		case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED:			ZFCP_LOG_FLAGS(3,				       "FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED\n");			/* FIXME(hw) need proper specs for proper action */			/* let scsi stack deal with retries and escalation */			debug_text_event(fsf_req->adapter->erp_dbf, 1,					 "fsf_sq_ulp");			zfcp_cmd_dbf_event_fsf(				"sqdeperp",				fsf_req,				&header->fsf_status_qual,				sizeof (union fsf_status_qual));			fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;			break;		default:			/* FIXME: shall we consider this a successful transfer? */			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:		ZFCP_LOG_FLAGS(3, "FSF_GOOD\n");		break;	case FSF_FCP_RSP_AVAILABLE:		ZFCP_LOG_FLAGS(2, "FSF_FCP_RSP_AVAILABLE\n");		break;	default:		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:	if (fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) {		retval =		    zfcp_fsf_send_fcp_command_task_management_handler(fsf_req);	} else {		retval = zfcp_fsf_send_fcp_command_task_handler(fsf_req);	}	return retval;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/6bc9dace767f1fffdf975b3398b3c4e37cd5ae18/zfcp_fsf.c/clean/drivers/s390/scsi/zfcp_fsf.c