fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "FCHBANPIVPort.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <Exceptions.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <Trace.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sun_fc.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <iostream>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <iomanip>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/mkdev.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/stat.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <fcntl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <unistd.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stropts.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <dirent.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/fc.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/fcio.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/ulp/fcp_util.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/ulp/fcsm.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/impl/fc_error.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/fc_appif.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/generic/commands.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/impl/commands.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/impl/sense.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/generic/inquiry.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/generic/status.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <errno.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteusing namespace std;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int FCHBANPIVPort::MAX_FCIO_MSG_LEN = 256;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteFCHBANPIVPort::FCHBANPIVPort(string thePath) : HBANPIVPort() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Trace log("FCHBANPIVPort::FCHBANPIVPort");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log.debug("Initializing HBA NPIV port %s", thePath.c_str());
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte try {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path = lookupControllerPath(thePath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } catch (...) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log.debug("Unable to lookup controller path and number for %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte thePath.c_str());
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path = "/devices";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path += thePath;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path += ":fc";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t tmp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBA_NPIVATTRIBUTES attrs = getPortAttributes(tmp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy(&tmp, &attrs.PortWWN, 8);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portWWN = ntohll(tmp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy(&tmp, &attrs.NodeWWN, 8);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodeWWN = ntohll(tmp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteHBA_NPIVATTRIBUTES FCHBANPIVPort::getPortAttributes(uint64_t &stateChange) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Trace log("FCHBANPIVPort::getPortAttributes");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBA_NPIVATTRIBUTES attributes;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcio_t fcio;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_hba_npiv_attributes_t attrs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(&fcio, 0, sizeof (fcio));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(&attributes, 0, sizeof (attributes));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcio.fcio_cmd = FCIO_GET_NPIV_ATTRIBUTES;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcio.fcio_olen = sizeof (attrs);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcio.fcio_xfer = FCIO_XFER_READ;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcio.fcio_obuf = (caddr_t)&attrs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fp_ioctl(getPath(), FCIO_CMD, &fcio);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte stateChange = attrs.lastChange;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy(&attributes.NodeWWN, &attrs.NodeWWN, 8);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memcpy(&attributes.PortWWN, &attrs.PortWWN, 8);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (attributes);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid FCHBANPIVPort::fp_ioctl(string path, int cmd, fcio_t *fcio) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Trace log("FCHBANPIVPort::fp_ioctl");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fcioErrorString[MAX_FCIO_MSG_LEN] = "";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fd = HBA::_open(path, O_NDELAY | O_RDONLY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte try {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int times = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBA::_ioctl(fd, cmd, (uchar_t *)fcio);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (fcio->fcio_errno == FC_STATEC_BUSY) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sleep(2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte HBA::_ioctl(fd, cmd, (uchar_t *)fcio);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (times++ > 20) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fcio->fcio_errno) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte throw IOError("IOCTL transport failure");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } catch (...) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte transportError(fcio->fcio_errno, fcioErrorString);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log.genericIOError("NPIV Port ioctl (0x%x) failed. Transport: \"%s\"", cmd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (fcio->fcio_errno) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADWWN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte throw IllegalWWNException();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADPORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte throw IllegalWWNException();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_OUTOFBOUNDS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte throw IllegalIndexException();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_PBUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_FBUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TRAN_BUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_STATEC_BUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_DEVICE_BUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte throw BusyException();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_SUCCESS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte throw;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interpret the error code in the fcio_t structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * message must be at least MAX_FCIO_MSG_LEN in length.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteFCHBANPIVPort::transportError(uint32_t fcio_errno, char *message) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Trace log("transportError");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte string fcioErrorString;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (message == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log.internalError("NULL routine argument");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (fcio_errno) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (uint32_t)FC_FAILURE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "general failure";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (uint32_t)FC_FAILURE_SILENT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "general failure but fail silently";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_SUCCESS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "successful completion";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_CAP_ERROR:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "FCA capability error";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_CAP_FOUND:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "FCA capability unsettable";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_CAP_SETTABLE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "FCA capability settable";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_UNBOUND:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "unbound stuff";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_NOMEM:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "allocation error";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADPACKET:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "invalid packet specified/supplied";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_OFFLINE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "I/O resource unavailable";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_OLDPORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "operation on non-loop port";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_NO_MAP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "requested map unavailable";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TRANSPORT_ERROR:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "unable to transport I/O";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_ELS_FREJECT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "ELS rejected by a Fabric";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_ELS_PREJECT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "ELS rejected by an N_port";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_ELS_BAD:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "ELS rejected by FCA/fctl";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_ELS_MALFORMED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "poorly formed ELS request";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOOMANY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "resource request too large";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_UB_BADTOKEN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "invalid unsolicited buffer token";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_UB_ERROR:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "invalid unsol buf request";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_UB_BUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "buffer already in use";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADULP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "Unknown ulp";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADTYPE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "ULP not registered to handle this FC4 type";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_UNCLAIMED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "request or data not claimed";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_ULP_SAMEMODULE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "module already in use";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_ULP_SAMETYPE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "FC4 module already in use";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_ABORTED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "request aborted";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_ABORT_FAILED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "abort request failed";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADEXCHANGE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "exchange doesn\325t exist";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADWWN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "WWN not recognized";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADDEV:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "device unrecognized";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADCMD:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "invalid command issued";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADOBJECT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "invalid object requested";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_BADPORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "invalid port specified";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_NOTTHISPORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "resource not at this port";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_PREJECT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "reject at remote N_Port";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_FREJECT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "reject at remote Fabric";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_PBUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "remote N_Port busy";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_FBUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "remote Fabric busy";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_ALREADY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "already logged in";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_LOGINREQ:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "login required";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_RESETFAIL:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "reset failed";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_INVALID_REQUEST:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "request is invalid";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_OUTOFBOUNDS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "port number is out of bounds";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TRAN_BUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "command transport busy";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_STATEC_BUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "port driver currently busy";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_DEVICE_BUSY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "transport working on this device";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_DEVICE_NOT_TGT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcioErrorString = "device is not a SCSI target";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte snprintf(message, MAX_FCIO_MSG_LEN, "Unknown error code 0x%x",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcio_errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte snprintf(message, MAX_FCIO_MSG_LEN, "%s", fcioErrorString.c_str());
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte