emlxs_dfc.c revision 8f23e9fa8abcb5857661066b954e63400d589b65
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2004-2012 Emulex. All rights reserved.
* Use is subject to license terms.
*/
#include <emlxs.h>
/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
#ifdef SFCT_SUPPORT
#endif /* SFCT_SUPPORT */
#ifdef DHCHAP_SUPPORT
#endif /* DHCHAP_SUPPORT */
#ifdef SAN_DIAG_SUPPORT
#endif /* SAN_DIAG_SUPPORT */
#ifdef FCIO_SUPPORT
#endif /* FCIO_SUPPORT */
/* SLI-4 ioctls */
typedef struct
{
char string[32];
{EMLXS_GET_PERSIST_LINKDOWN, "GET_PERSIST_LINKDOWN",
{EMLXS_SET_PERSIST_LINKDOWN, "SET_PERSIST_LINKDOWN",
#ifdef MENLO_SUPPORT
#endif /* MENLO_SUPPORT */
#ifdef DHCHAP_SUPPORT
{EMLXS_GET_AUTH_CFG_TABLE, "GET_AUTH_CFG_TABLE",
{EMLXS_GET_AUTH_KEY_TABLE, "GET_AUTH_KEY_TABLE",
#endif /* DHCHAP_SUPPORT */
#ifdef FCIO_SUPPORT
#endif /* FCIO_SUPPORT */
#ifdef SFCT_SUPPORT
#endif /* SFCT_SUPPORT */
#ifdef SAN_DIAG_SUPPORT
{EMLXS_SD_DESTROY_BUCKET, "SD_DESTROY_BUCKET",
{EMLXS_SD_START_DATA_COLLECTION, "SD_START_DATA_COLLECTION",
{EMLXS_SD_STOP_DATA_COLLECTION, "SD_STOP_DATA_COLLECTION",
{EMLXS_SD_RESET_DATA_COLLECTION, "SD_RESET_DATA_COLLECTION",
#endif /* SAN_DIAG_SUPPORT */
}; /* emlxs_dfc_table */
{FC_REG_LINK_EVENT, "LINK_EVENT"},
{FC_REG_RSCN_EVENT, "RSCN_EVENT"},
{FC_REG_CT_EVENT, "CT_EVENT"},
{FC_REG_DUMP_EVENT, "DUMP_EVENT"},
{FC_REG_TEMP_EVENT, "TEMP_EVENT"},
{FC_REG_VPORTRSCN_EVENT, "VPORTRSCN_EVENT"},
{FC_REG_FCOE_EVENT, "FCOE_EVENT"},
}; /* emlxs_dfc_event_table */
#ifdef SAN_DIAG_SUPPORT
#endif /* SAN_DIAG_SUPPORT */
extern char *
{
static char buffer[32];
uint32_t i;
for (i = 0; i < count; i++) {
return (emlxs_dfc_table[i].string);
}
}
return (buffer);
} /* emlxs_dfc_xlate() */
static int
{
uint32_t i;
int rval;
for (i = 0; i < count; i++) {
"%s requested.",
emlxs_dfc_table[i].string);
}
return (rval);
}
}
return (DFC_ARG_INVALID);
} /* emlxs_dfc_func() */
extern char *
{
static char buffer[32];
uint32_t i;
for (i = 0; i < count; i++) {
return (emlxs_dfc_event_table[i].string);
}
}
return (buffer);
} /* emlxs_dfc_event_xlate() */
static int32_t
{
int rval = 0;
#ifdef _MULTI_DATAMODEL
use32 = 1;
}
#endif /* _MULTI_DATAMODEL */
if (use32) {
"ddi_copyin32 failed.");
goto done;
}
} else {
mode)) {
"ddi_copyin failed.");
goto done;
}
}
/* Map dfc1 to dfc2 */
/* Copyin data buffers */
mode)) {
"%s: buf1 ddi_copyin failed. (size=%d)",
goto done;
}
}
mode)) {
"%s: buf2 ddi_copyin failed. (size=%d)",
goto done;
}
}
mode)) {
"%s buf3 ddi_copyin failed. (size=%d)",
goto done;
}
}
mode)) {
"%s: buf4 ddi_copyin failed. (size=%d)",
goto done;
}
}
done:
return (rval);
} /* emlxs_dfc_copyin() */
static int32_t
{
int rval = 0;
#ifdef _MULTI_DATAMODEL
use32 = 1;
}
#endif /* _MULTI_DATAMODEL */
/* Copyout data buffers */
mode)) {
"%s: buf1 ddi_copyout failed. (size=%d)",
}
}
mode)) {
"%s: buf2 ddi_copyout failed. (size=%d)",
}
}
mode)) {
"%s buf3 ddi_copyout failed. (size=%d)",
}
}
mode)) {
"%s: buf4 ddi_copyout failed. (size=%d)",
}
}
if (use32) {
"ddi_copyout32 failed.");
goto done;
}
} else {
mode)) {
"ddi_copyout failed.");
goto done;
}
}
done:
return (rval);
} /* emlxs_dfc_copyout() */
extern int32_t
{
int rval = 0;
/* This copies arg data to dfc1 space, */
/* then creates local dfc2 buffers */
if (rval) {
return (rval);
}
if (rval) {
return (rval);
}
/* This copies dfc2 local buffers back to dfc1 addresses */
return (rval);
} /* emlxs_dfc_manage() */
#ifdef FCIO_SUPPORT
typedef struct
{
char string[32];
/* {FCIO_GET_P2P_INFO, "GET_P2P_INFO", emlxs_fcio_get_p2p_info}, */
{FCIO_GET_ADAPTER_ATTRIBUTES, "GET_ADAPTER_ATTRIBUTES",
{FCIO_GET_OTHER_ADAPTER_PORTS, "GET_OTHER_ADAPTER_PORTS",
{FCIO_GET_ADAPTER_PORT_ATTRIBUTES, "GET_ADAPTER_PORT_ATTRIBUTES",
{FCIO_GET_DISCOVERED_PORT_ATTRIBUTES, "GET_DISCOVERED_PORT_ATTRIBUTES",
{FCIO_GET_PORT_ATTRIBUTES, "GET_PORT_ATTRIBUTES",
{FCIO_GET_ADAPTER_PORT_STATS, "GET_ADAPTER_PORT_STATS",
}; /* emlxs_fcio_table */
extern char *
{
static char buffer[32];
uint32_t i;
for (i = 0; i < count; i++) {
return (emlxs_fcio_table[i].string);
}
}
return (buffer);
} /* emlxs_fcio_xlate() */
static int
{
uint32_t i;
int rval;
for (i = 0; i < count; i++) {
"%s requested.",
emlxs_fcio_table[i].string);
}
return (rval);
}
}
return (EFAULT);
} /* emlxs_fcio_func() */
/* This is used by FCT ports to mimic SFS ports for FCIO support */
/*ARGSUSED*/
extern int32_t
{
/* Map DFC to FCIO */
}
}
}
"%s: %s: buf4 invalid. (buf4=%p size=%d)",
goto done;
}
/* Map FCIO to DFC */
done:
/* Set fcio_errno if needed */
}
return (rval);
} /* emlxs_fcio_manage() */
/*ARGSUSED*/
static int32_t
{
if (rval != FC_SUCCESS) {
if (rval == FC_INVALID_REQUEST) {
} else {
}
}
}
return (rval);
} /* emlxs_fcio_diag() */
#ifndef _MULTI_DATAMODEL
/* ARGSUSED */
#endif
static int32_t
{
#ifdef _MULTI_DATAMODEL
use32 = 1;
}
#endif /* _MULTI_DATAMODEL */
if (use32) {
uint32_t i;
goto done;
}
"fcio_get_host_params: fct_flags=%x ulp_statec=%x",
(uint8_t)(i & 0xff);
goto done;
}
}
}
} else {
}
} else {
uint32_t i;
goto done;
}
"fcio_get_host_params: fct_flags=%x ulp_statec=%x",
(uint8_t)(i & 0xff);
goto done;
}
}
}
} else {
}
}
done:
return (rval);
} /* emlxs_fcio_get_host_params() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
"fcio_reset_link failed. Port is not in target mode.");
goto done;
}
if (rval != FC_SUCCESS) {
}
} else {
}
done:
return (rval);
} /* emlxs_fcio_reset_link() */
/*ARGSUSED*/
static int32_t
{
"fcio_reset_hard failed. Port is not in target mode.");
goto done;
}
if (rval != FC_SUCCESS) {
}
done:
return (rval);
} /* emlxs_fcio_reset_hard() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
}
done:
return (rval);
} /* emlxs_fcio_download_fw() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
if (rval != FC_SUCCESS) {
}
done:
return (rval);
} /* emlxs_fcio_get_fw_rev() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
if (rval != FC_SUCCESS) {
}
done:
return (rval);
} /* emlxs_fcio_get_fcode_rev() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
if (rval != FC_SUCCESS) {
}
done:
return (rval);
} /* emlxs_fcio_download_fcode() */
#ifndef _MULTI_DATAMODEL
/* ARGSUSED */
#endif
static int32_t
{
#ifdef _MULTI_DATAMODEL
use32 = 1;
}
#endif /* _MULTI_DATAMODEL */
if (use32) {
sizeof (fc_hba_adapter_attributes32_t)) {
goto done;
}
} else {
sizeof (fc_hba_adapter_attributes_t)) {
goto done;
}
}
done:
return (rval);
} /* emlxs_fcio_get_adapter_attrs() */
#ifndef _MULTI_DATAMODEL
/* ARGSUSED */
#endif
static int32_t
{
#ifdef _MULTI_DATAMODEL
use32 = 1;
}
#endif /* _MULTI_DATAMODEL */
if (use32) {
sizeof (fc_hba_port_attributes32_t)) {
goto done;
}
port_attrs->lastChange = 0;
port_attrs->fp_minor = 0;
/* port_attrs->PortFcId */
/* port_attrs->PortType */
/* port_attrs->PortSpeed */
/* port_attrs->FabricName */
} else {
} else {
}
} else {
} else {
}
}
sizeof (port_attrs->FabricName));
}
case 0:
break;
case LA_1GHZ_LINK:
break;
case LA_2GHZ_LINK:
break;
case LA_4GHZ_LINK:
break;
case LA_8GHZ_LINK:
break;
case LA_10GHZ_LINK:
break;
case LA_16GHZ_LINK:
break;
default:
}
}
/* Set the hba speed limit */
}
}
}
}
}
}
value1 = 0x00000120;
value2 = 0x00000001;
} else {
sizeof (fc_hba_port_attributes_t)) {
goto done;
}
port_attrs->lastChange = 0;
port_attrs->fp_minor = 0;
/* port_attrs->PortFcId */
/* port_attrs->PortType */
/* port_attrs->PortSpeed */
/* port_attrs->FabricName */
} else {
} else {
}
} else {
} else {
}
}
sizeof (port_attrs->FabricName));
}
case 0:
break;
case LA_1GHZ_LINK:
break;
case LA_2GHZ_LINK:
break;
case LA_4GHZ_LINK:
break;
case LA_8GHZ_LINK:
break;
case LA_10GHZ_LINK:
break;
case LA_16GHZ_LINK:
break;
default:
}
}
/* Set the hba speed limit */
}
}
}
}
}
}
value1 = 0x00000120;
value2 = 0x00000001;
}
done:
return (rval);
} /* emlxs_fcio_get_adapter_port_attrs() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
if (rval != FC_SUCCESS) {
}
done:
return (rval);
} /* emlxs_fcio_get_node_id() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
if (rval != FC_SUCCESS) {
}
done:
return (rval);
} /* emlxs_fcio_set_node_id() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
}
done:
return (rval);
} /* emlxs_fcio_get_num_devs() */
#ifndef _MULTI_DATAMODEL
/* ARGSUSED */
#endif
static int32_t
{
#ifdef _MULTI_DATAMODEL
use32 = 1;
}
#endif /* _MULTI_DATAMODEL */
if (use32) {
uint32_t i;
uint32_t j;
uint32_t nport_count = 0;
goto done;
}
}
if (nport_count == 0) {
goto done;
}
if (nport_count > max_count) {
goto done;
}
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
BE_SWAP32(0x00000100);
goto done;
}
}
}
port_dev++;
}
}
}
} else {
uint32_t i;
uint32_t j;
uint32_t nport_count = 0;
goto done;
}
}
if (nport_count == 0) {
goto done;
}
if (nport_count > max_count) {
goto done;
}
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
BE_SWAP32(0x00000100);
goto done;
}
}
}
port_dev++;
}
}
}
}
done:
return (rval);
} /* emlxs_fcio_get_dev_list() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
} else {
if (ndlp) {
} else {
}
}
done:
return (rval);
} /* emlxs_fcio_get_logi_params() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
} else {
if (ndlp) {
} else {
}
}
done:
return (rval);
} /* emlxs_fcio_get_state() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
*tp = FC_TOP_UNKNOWN;
} else {
if (ndlp) {
*tp = FC_TOP_PUBLIC_LOOP;
} else {
}
} else {
if (ndlp) {
*tp = FC_TOP_FABRIC;
} else {
*tp = FC_TOP_PT_PT;
}
}
}
done:
return (rval);
} /* emlxs_fcio_get_topology() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
goto done;
}
if (rval != FC_SUCCESS) {
}
} else {
}
done:
return (rval);
} /* emlxs_fcio_get_link_status() */
/*ARGSUSED*/
static int32_t
{
char *path;
goto done;
}
goto done;
}
done:
return (rval);
} /* emlxs_fcio_get_other_adapter_ports() */
/*ARGSUSED*/
static int32_t
{
#ifdef _MULTI_DATAMODEL
use32 = 1;
}
#endif /* _MULTI_DATAMODEL */
if (use32) {
goto done;
}
if (!ndlp) {
goto done;
}
/* port_attrs->lastChange */
/* port_attrs->fp_minor */
/* no switch */
} else {
}
/* We share a common speed */
case 0:
break;
case LA_1GHZ_LINK:
break;
case LA_2GHZ_LINK:
break;
case LA_4GHZ_LINK:
break;
case LA_8GHZ_LINK:
break;
case LA_10GHZ_LINK:
break;
case LA_16GHZ_LINK:
break;
}
}
/* public loop */
/* Check for common area and domain */
/* We share a common speed */
case 0:
break;
case LA_1GHZ_LINK:
break;
case LA_2GHZ_LINK:
break;
case LA_4GHZ_LINK:
break;
case LA_8GHZ_LINK:
break;
case LA_10GHZ_LINK:
break;
case LA_16GHZ_LINK:
break;
}
}
}
}
/* port_attrs->PortSymbolicName */
/* port_attrs->PortSupportedSpeed */
/* port_attrs->PortSupportedFc4Types */
/* port_attrs->PortActiveFc4Types */
/* port_attrs->PortMaxFrameSize */
/* port_attrs->NumberofDiscoveredPorts */
} else {
goto done;
}
if (!ndlp) {
goto done;
}
/* port_attrs->lastChange */
/* port_attrs->fp_minor */
/* no switch */
} else {
}
/* We share a common speed */
case 0:
break;
case LA_1GHZ_LINK:
break;
case LA_2GHZ_LINK:
break;
case LA_4GHZ_LINK:
break;
case LA_8GHZ_LINK:
break;
case LA_10GHZ_LINK:
break;
case LA_16GHZ_LINK:
break;
}
}
/* public loop */
/* Check for common area and domain */
/* We share a common speed */
case 0:
break;
case LA_1GHZ_LINK:
break;
case LA_2GHZ_LINK:
break;
case LA_4GHZ_LINK:
break;
case LA_8GHZ_LINK:
break;
case LA_10GHZ_LINK:
break;
case LA_16GHZ_LINK:
break;
}
}
}
}
/* port_attrs->PortSymbolicName */
/* port_attrs->PortSupportedSpeed */
/* port_attrs->PortSupportedFc4Types */
/* port_attrs->PortActiveFc4Types */
/* port_attrs->PortMaxFrameSize */
/* port_attrs->NumberofDiscoveredPorts */
}
done:
return (rval);
} /* emlxs_fcio_get_disc_port_attrs() */
/*ARGSUSED*/
static int32_t
{
#ifdef _MULTI_DATAMODEL
use32 = 1;
}
#endif /* _MULTI_DATAMODEL */
if (use32) {
goto done;
}
if (!ndlp) {
goto done;
}
/* Filter fabric ports */
goto done;
}
/* port_attrs->lastChange */
/* port_attrs->fp_minor */
/* no switch */
} else {
}
/* We share a common speed */
case 0:
break;
case LA_1GHZ_LINK:
break;
case LA_2GHZ_LINK:
break;
case LA_4GHZ_LINK:
break;
case LA_8GHZ_LINK:
break;
case LA_10GHZ_LINK:
break;
case LA_16GHZ_LINK:
break;
}
}
/* public loop */
/* Check for common area and domain */
/* We share a common speed */
case 0:
break;
case LA_1GHZ_LINK:
break;
case LA_2GHZ_LINK:
break;
case LA_4GHZ_LINK:
break;
case LA_8GHZ_LINK:
break;
case LA_10GHZ_LINK:
break;
case LA_16GHZ_LINK:
break;
}
}
}
}
/* port_attrs->PortSymbolicName */
/* port_attrs->PortSupportedSpeed */
/* port_attrs->PortSupportedFc4Types */
/* port_attrs->PortActiveFc4Types */
/* port_attrs->PortMaxFrameSize */
/* port_attrs->NumberofDiscoveredPorts */
} else {
goto done;
}
if (!ndlp) {
goto done;
}
/* Filter fabric ports */
goto done;
}
/* port_attrs->lastChange */
/* port_attrs->fp_minor */
/* no switch */
} else {
}
/* We share a common speed */
case 0:
break;
case LA_1GHZ_LINK:
break;
case LA_2GHZ_LINK:
break;
case LA_4GHZ_LINK:
break;
case LA_8GHZ_LINK:
break;
case LA_10GHZ_LINK:
break;
case LA_16GHZ_LINK:
break;
}
}
/* public loop */
/* Check for common area and domain */
/* We share a common speed */
case 0:
break;
case LA_1GHZ_LINK:
break;
case LA_2GHZ_LINK:
break;
case LA_4GHZ_LINK:
break;
case LA_8GHZ_LINK:
break;
case LA_10GHZ_LINK:
break;
case LA_16GHZ_LINK:
break;
}
}
}
}
/* port_attrs->PortSymbolicName */
/* port_attrs->PortSupportedSpeed */
/* port_attrs->PortSupportedFc4Types */
/* port_attrs->PortActiveFc4Types */
/* port_attrs->PortMaxFrameSize */
/* port_attrs->NumberofDiscoveredPorts */
}
done:
return (rval);
} /* emlxs_fcio_get_port_attrs() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
done:
return (rval);
} /* emlxs_fcio_get_sym_pname() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
done:
return (rval);
} /* emlxs_fcio_get_sym_nname() */
/*ARGSUSED*/
static int32_t
{
"fcio_force_dump failed. Port is not in target mode.");
goto done;
}
if (rval != FC_SUCCESS) {
goto done;
}
done:
return (rval);
} /* emlxs_fcio_force_dump() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
if (rval != FC_SUCCESS) {
if (rval == FC_INVALID_REQUEST) {
} else {
}
}
done:
return (rval);
} /* emlxs_fcio_get_dump_size() */
/*ARGSUSED*/
static int32_t
{
goto done;
}
if (rval != FC_SUCCESS) {
if (rval == FC_INVALID_REQUEST) {
} else {
}
goto done;
}
goto done;
}
if (rval != FC_SUCCESS) {
if (rval == FC_INVALID_REQUEST) {
} else {
}
}
done:
return (rval);
} /* emlxs_fcio_get_dump() */
/*ARGSUSED*/
static int32_t
{
"%s: Command not supported.",
return (ENOTSUP);
} /* emlxs_fcio_unsupported() */
#endif /* FCIO_SUPPORT */
/*ARGSUSED*/
static int32_t
{
char name[256];
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
if (!(options & VPORT_OPT_AUTORETRY)) {
"%s: NPIV currently not enabled.",
return (DFC_NPIV_DISABLED);
}
"%s: NPIV currently not supported.",
return (DFC_NPIV_UNSUPPORTED);
}
}
/*
* Only the same WWNN and WWPN can be re-created
*/
break;
} else {
"%s: VPI already in use.",
return (DFC_ARG_INVALID);
}
}
}
}
/* else auto assign */
/* Acquire a VPI */
/* Auto Assign VPI */
break;
}
}
"%s: Out of resources.",
return (DFC_DRVRES_ERROR);
}
}
/* Establish a WWPN */
/* Generate new WWPN */
} else { /* use one provided */
/* Make sure WWPN is unique */
"%s: WWPN already exists. vpi=%d",
return (DFC_ARG_INVALID);
}
}
}
/* Establish a WWNN */
/* Generate new WWNN */
}
/* else use WWNN provided */
/* Generate the symbolic node name */
(sizeof (name)-1));
} else {
}
/* Generate the symbolic port name */
(sizeof (name)-1));
} else {
}
/* Set the highest configured vpi */
}
/* Configure the port object */
/* Adjust restricted flags */
if (options & VPORT_OPT_RESTRICT) {
} else if (options & VPORT_OPT_UNRESTRICT) {
}
/*
* The same WWNN, WWPN and VPI has been re-created.
* Bring up the vport now!
*/
}
return (0);
} /* emlxs_dfc_create_vport() */
/*ARGSUSED*/
static int32_t
{
char buffer[256];
rval = DFC_ARG_NULL;
goto done;
}
"%s: Buffer1 too small. (size=%d)",
goto done;
}
/* Read the wwn object */
/* Make sure WWPN is unique */
/* Physical does not have EMLXS_PORT_CONFIG set */
goto done;
}
/* Fabric Logout */
sizeof (FCP_RSP), 0, KM_NOSLEEP))) {
"%s: Unable to allocate packet.",
goto done;
}
/* Make this a polled IO */
/* Build the fc header */
/* Build the command */
/*
* Just send LOGO. Don't worry about result.
* This is just a courtesy anyway.
*/
/* Take the port offline */
}
rval = 0;
done:
if (pkt) {
}
return (rval);
} /* emlxs_dfc_destroy_vport() */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
return (DFC_ARG_NULL);
}
if (!(dfc_vport_list =
"%s: Unable to allocate memory.",
return (DFC_SYSRES_ERROR);
}
max_count = 0;
dfc_vport = &dfc_vport_list[i];
continue;
}
}
}
}
}
max_count++;
}
max_count *= sizeof (dfc_vportinfo_t);
"%s: Buffer1 too small. (%d > %d)",
goto done;
}
done:
if (dfc_vport_list) {
}
return (rval);
} /* emlxs_dfc_get_vportinfo() */
static emlxs_port_t *
{
int i, j;
/* Check Local N-port, including physical port */
return (port);
}
/* Check Remote N-port */
for (j = 0; j < EMLXS_NUM_HASH_QUES; j++) {
/* Check Local N-port */
return (port);
}
}
}
}
return (0);
} /* emlxs_vport_find_wwpn() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
int i;
int total_rpi;
total_rpi = 0;
}
return (rval);
}
if (rval == MBX_TIMEOUT) {
"%s: Mailbox timed out. cmd=%x",
rval = DFC_TIMEOUT;
goto done;
}
if (rval) {
rval = DFC_IO_ERROR;
goto done;
}
done:
/* Free allocated mbox memory */
if (mbq) {
}
return (rval);
} /* emlxs_dfc_npiv_resource() */
/*ARGSUSED*/
static int32_t
{
int i;
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
}
}
}
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
mask =
/*
* Check if those four conditions are met
*/
/*
* One or more conditions are not met
*/
goto done;
}
/* Now check if fabric have resources */
goto done;
}
}
(void) emlxs_vpi_port_bind_notify(vport);
/* wait one second for INIT_VPI completion */
drv_usecwait(1000000);
}
0, KM_NOSLEEP))) {
"Unable to allocate packet.");
goto done;
}
/* Build (FDISC) the fc header */
/* Build the command (FDISC) */
/* by the drive (See emlxs_send_els()) */
/* Copy latest service parameters to payload */
wwn[0] = 0x28;
wwn[0] = 0x20;
sizeof (SERV_PARM));
/* Make this a polled IO */
goto done;
}
} else {
0, KM_NOSLEEP))) {
"Unable to allocate LOGO packet.");
goto free_resc;
}
/* Make this a polled IO */
/* Build (LOGO) the fc header */
/* Build the command (LOGO) */
wwn[0] = 0x20;
"%s: Unable to send packet.",
goto free_resc;
}
"%s: Pkt Transport error. "
"Pkt Timeout.",
} else {
"%s: Pkt Transport error. state=%x",
}
goto free_resc;
}
/* Free default RPIs and VPI */
/* Unregister all nodes */
(void) EMLXS_SLI_UNREG_NODE(vport, 0, 0, 0, 0);
(void) emlxs_mb_unreg_vpi(vport);
}
}
}
done:
if (pkt) {
/* Free the pkt */
}
if (pkt1) {
/* Free the pkt */
}
return (rval);
} /* emlxs_dfc_npiv_test() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (0);
} /* emlxs_dfc_get_rev() */
/*ARGSUSED*/
static int32_t
{
char pathname[256];
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
/* Set support flags */
#ifdef DHCHAP_SUPPORT
}
#endif /* DHCHAP_SUPPORT */
#ifdef SAN_DIAG_SUPPORT
#endif /* SAN_DIAG_SUPPORT */
#ifdef SFCT_SUPPORT
}
#endif /* SFCT_SUPPORT */
if (SLI4_FCOE_MODE) {
}
}
"/devices%s", pathname);
}
#ifdef MENLO_SUPPORT
} else
#endif /* MENLO_SUPPORT */
} else {
}
} else {
} else {
}
}
sizeof (hbainfo->fabric_wwnn));
sizeof (hbainfo->fabric_wwpn));
}
} else {
}
}
}
}
}
}
}
}
}
}
}
#ifdef MENLO_SUPPORT
}
#endif /* MENLO_SUPPORT */
else {
}
} else {
} else {
}
}
#ifdef FMA_SUPPORT
/* Access handle validation */
!= DDI_FM_OK) {
return (DFC_DRV_ERROR);
}
#endif /* FMA_SUPPORT */
return (0);
} /* emlxs_dfc_get_hbainfo() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
mbq =
if (rval == MBX_TIMEOUT) {
"%s: Mailbox timed out. cmd=%x",
rval = DFC_TIMEOUT;
goto done;
}
if (rval) {
rval = DFC_IO_ERROR;
goto done;
}
if (rval == MBX_TIMEOUT) {
"%s: Mailbox timed out. cmd=%x",
rval = DFC_TIMEOUT;
goto done;
}
if (rval) {
rval = DFC_IO_ERROR;
goto done;
}
#ifdef MENLO_SUPPORT
} else
#endif /* MENLO_SUPPORT */
} else {
}
} else {
} else {
}
}
} else {
}
}
done:
/* Free allocated mbox memory */
if (mbq) {
}
return (rval);
} /* emlxs_dfc_get_hbastats() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
#if (DFC_REV >= 2)
#endif
return (rval);
} /* emlxs_dfc_get_drvstats() */
extern uint32_t
{
uint32_t i;
/* Wait if adapter is in transition */
i = 0;
if (i++ > 30) {
break;
}
}
switch (mode) {
case DDI_SHOW:
break;
case DDI_ONDI:
(void) emlxs_online(hba);
}
break;
/* Killed + Restart state */
case DDI_OFFDI:
(void) emlxs_offline(hba, 0);
/* Reset with restart */
/* Reset with restart */
}
break;
/* Killed + Reset state */
case DDI_WARMDI:
(void) emlxs_offline(hba, 0);
/* Reset with no restart */
EMLXS_SLI_HBA_RESET(hba, 0, 0, 0);
/* Reset with no restart */
EMLXS_SLI_HBA_RESET(hba, 0, 0, 0);
}
break;
/* Killed */
case DDI_DIAGDI:
(void) emlxs_offline(hba, 0);
}
break;
default:
"set_hba_mode: Invalid mode. mode=%x", mode);
return (0);
}
/* Wait if adapter is in transition */
i = 0;
if (i++ > 30) {
break;
}
}
/* Return current state */
mode = DDI_DIAGDI;
mode = DDI_WARMDI;
} else {
}
return (mode);
} else { /* SLI4 */
switch (mode) {
case DDI_SHOW:
break;
case DDI_ONDI:
(void) emlxs_online(hba);
}
break;
case DDI_OFFDI:
(void) emlxs_offline(hba, 0);
/* Reset with restart */
/* Reset with restart */
}
break;
case DDI_DIAGDI:
"set_hba_mode: Invalid mode. mode=%x",
mode);
return (0);
}
(void) emlxs_reset(port,
return (mode);
case DDI_WARMDI:
default:
"set_hba_mode: Invalid mode. mode=%x", mode);
return (0);
}
/* Wait if adapter is in transition */
i = 0;
if (i++ > 30) {
break;
}
}
/* Return current state */
} else {
}
return (mode);
}
} /* emlxs_set_hba_mode() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (rval);
} /* emlxs_dfc_set_diag() */
/*ARGSUSED*/
static int32_t
{
return (DFC_NOT_SUPPORTED);
}
return (DFC_ARG_NULL);
}
return (DFC_ARG_NULL);
}
"%s: Buffer1 too large. (size=%d)",
return (DFC_ARG_TOOBIG);
}
#ifdef MBOX_EXT_SUPPORT
"%s: Null buffer3 found.",
return (DFC_ARG_NULL);
}
"%s: buffer3 too large. (size=%d)",
return (DFC_ARG_TOOBIG);
}
"%s: Null buffer4 found.",
return (DFC_ARG_NULL);
}
"%s: buffer4 too large. (size=%d)",
return (DFC_ARG_TOOBIG);
}
}
}
#endif /* MBOX_EXT_SUPPORT */
#ifdef _LP64
"%s: Invalid mailbox command. Must use 64bit version. "
/* Must use 64 bit versions of these mbox cmds */
goto done;
}
#endif
lptr = 0;
size = 0;
switch (mb->mbxCommand) {
/* Offline only */
case MBX_CONFIG_LINK: /* 0x07 */
case MBX_PART_SLIM: /* 0x08 */
case MBX_CONFIG_RING: /* 0x09 */
case MBX_DUMP_CONTEXT: /* 0x18 */
case MBX_RUN_DIAGS: /* 0x19 */
case MBX_RESTART: /* 0x1A */
case MBX_SET_MASK: /* 0x20 */
case MBX_FLASH_WR_ULA: /* 0x98 */
"%s: Adapter not offline. cmd=%x",
goto done;
}
break;
/* Online / Offline */
case MBX_UNREG_LOGIN: /* 0x14 */
if (ndlp) {
/* remove it */
/*
* If we just unregistered the host node then
* clear the host DID
*/
}
} else {
"%s: Node not found. cmd=%x rpi=%d",
/* Node does not exist */
goto done;
}
/* Send it */
break;
case MBX_UNREG_D_ID: /* 0x23 */
if (did == 0) {
"%s: Node not found. cmd=%x did=%x",
goto done;
}
if (did == 0xffffffff) {
break;
}
/* Check for base node */
/* just flush base node */
0, 0, 0);
0);
/* Return now */
rval = 0;
goto done;
}
/* Make sure the node does already exist */
if (ndlp) {
/* remove it */
/*
* If we just unregistered the host node then
* clear the host DID
*/
}
} else {
"%s: Node not found. cmd=%x did=%x",
/* Node does not exist */
goto done;
}
/* Send it */
break;
/* Online / Offline - with DMA */
case MBX_READ_EVENT_LOG: /* 0x38 */
lptr =
"%s: Invalid BDE. cmd=%x",
goto done;
}
/* Allocate receive buffer */
"%s: Unable to allocate receive buffer. cmd=%x",
goto done;
}
break;
case MBX_READ_SPARM: /* 0x0D */
case MBX_READ_SPARM64: /* 0x8D */
lptr =
"%s: Invalid BDE. cmd=%x",
goto done;
}
/* Allocate receive buffer */
"%s: Unable to allocate receive buffer. cmd=%x",
goto done;
}
break;
case MBX_READ_RPI: /* 0x0F */
case MBX_READ_RPI64: /* 0x8F */
lptr =
"%s: Invalid BDE. cmd=%x",
goto done;
}
/* Allocate receive buffer */
"%s: Unable to allocate receive buffer. cmd=%x",
goto done;
}
break;
case MBX_RUN_BIU_DIAG: /* 0x04 */
case MBX_RUN_BIU_DIAG64: /* 0x84 */
lptr =
"%s: Invalid xmit BDE. cmd=%x",
goto done;
}
/* Allocate xmit buffer */
"%s: Unable to allocate xmit buffer. cmd=%x",
goto done;
}
/* Initialize the xmit buffer */
mode) != 0) {
"%s: ddi_copyin failed. cmd=%x",
goto done;
}
/* Initialize the receive buffer */
lptr =
"%s: Invalid rcv BDE. cmd=%x",
goto done;
}
/* Allocate receive buffer */
"%s: Unable to allocate receive buffer. cmd=%x",
goto done;
}
break;
case MBX_REG_LOGIN: /* 0x13 */
case MBX_REG_LOGIN64: /* 0x93 */
/* Check for invalid node ids to register */
"%s: Invalid node id. cmd=%x did=%x",
goto done;
}
/* Check if the node limit has been reached */
"%s: Too many nodes. cmd=%x",
goto done;
}
lptr =
"%s: Invalid BDE. cmd=%x",
goto done;
}
/* Allocate xmit buffer */
"%s: Unable to allocate xmit buffer. cmd=%x",
goto done;
}
/* Initialize the xmit buffer */
mode) != 0) {
"%s: Unable to allocate xmit buffer. cmd=%x",
goto done;
}
break;
case MBX_READ_LA: /* 0x15 */
case MBX_READ_LA64: /* 0x95 */
lptr =
"%s: Invalid BDE. cmd=%x",
goto done;
}
/* Allocate receive buffer */
"%s: Unable to allocate receive buffer. cmd=%x",
goto done;
}
break;
/* Do not allow these commands */
case MBX_CONFIG_PORT: /* 0x88 */
"%s: Command not allowed. cmd=%x",
goto done;
/* Online / Offline */
default:
break;
} /* switch() */
/* Set or don't set the PASSTHRU bit. */
/* Setting will prevent the driver from processing it as its own */
switch (mb->mbxCommand) {
case MBX_REG_LOGIN: /* 0x13 */
case MBX_REG_LOGIN64: /* 0x93 */
break;
default:
}
#ifdef MBOX_EXT_SUPPORT
if (extbuf) {
}
#endif /* MBOX_EXT_SUPPORT */
/* issue the mbox cmd to the sli */
if (mbxstatus) {
"%s: %s failed. mbxstatus=0x%x",
}
if (rx_mp) {
mode) != 0) {
"%s: ddi_copyout failed for receive buffer. cmd=%x",
goto done;
}
}
#ifdef MBOX_EXT_SUPPORT
/* Any data needs to copy to mbox extension area */
}
#endif /* MBOX_EXT_SUPPORT */
rval = 0;
done:
/* Free allocated mbox memory */
if (extbuf) {
}
/* Free allocated mbox memory */
if (mbq) {
}
/* Free allocated mbuf memory */
if (rx_mp) {
#ifdef FMA_SUPPORT
if (!rval) {
!= DDI_FM_OK) {
"dfc_send_mbox: hdl=%p",
rx_mp->dma_handle);
rval = DFC_IO_ERROR;
}
}
#endif /* FMA_SUPPORT */
}
if (tx_mp) {
#ifdef FMA_SUPPORT
if (!rval) {
!= DDI_FM_OK) {
"dfc_send_mbox: hdl=%p",
tx_mp->dma_handle);
rval = DFC_IO_ERROR;
}
}
#endif /* FMA_SUPPORT */
}
return (rval);
} /* emlxs_dfc_send_mbox() */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
return (DFC_ARG_NULL);
}
if (offset & 0x3) {
"%s: Offset misaligned. (offset=%d)",
return (DFC_ARG_MISALIGNED);
}
if (cnt & 0x3) {
"%s: Count misaligned. (count=%d)",
return (DFC_ARG_MISALIGNED);
}
if (outsz & 0x3) {
"%s: Output size misaligned. (size=%d)",
return (DFC_ARG_MISALIGNED);
}
/* Get max PCI config range */
max = 256;
} else {
max = 4096;
}
"%s: Offset+Count too large. (offset=%d count=%d max=%d)",
return (DFC_ARG_TOOBIG);
}
}
}
value =
}
#ifdef FMA_SUPPORT
/* Access handle validation */
!= DDI_FM_OK) {
return (DFC_DRV_ERROR);
}
#endif /* FMA_SUPPORT */
return (0);
} /* emlxs_dfc_read_pci() */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
return (DFC_ARG_NULL);
}
if (offset & 0x3) {
"%s: Offset misaligned. (offset=%d)",
return (DFC_ARG_MISALIGNED);
}
"%s: Count too large. (count=%d)",
return (DFC_ARG_TOOBIG);
}
if (cnt & 0x3) {
"%s: Count misaligned. (count=%d)",
return (DFC_ARG_MISALIGNED);
}
/* Get max PCI config range */
max = 256;
} else {
max = 4096;
}
"%s: Count+Offset too large. (offset=%d count=%d max=%d)",
return (DFC_ARG_TOOBIG);
}
/*
* EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_dfc_debug_msg,
* "%s: Writing. offset=%x cnt=%d value=%08x %04x %04x",
* emlxs_dfc_xlate(dfc->cmd), i, value, word0, word1);
*/
/* word0 = PCIMEM_SHORT(word0); */
/* word1 = PCIMEM_SHORT(word1); */
}
#ifdef FMA_SUPPORT
/* Access handle validation */
!= DDI_FM_OK) {
return (DFC_DRV_ERROR);
}
#endif /* FMA_SUPPORT */
return (0);
} /* emlxs_dfc_write_pci() */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
return (DFC_ARG_NULL);
}
if (count > MAX_CFG_PARAM) {
}
for (i = 0; i < count; i++) {
}
/* Adjust a_flag based on the hba model */
switch (i) {
case CFG_NETWORK_ON:
case CFG_TOPOLOGY:
case CFG_LINK_SPEED:
case CFG_CR_DELAY:
case CFG_CR_COUNT:
SLI4_FCOE_MODE)) {
}
break;
case CFG_NUM_WQ:
}
break;
case CFG_PERSIST_LINKDOWN:
break;
default:
break;
}
} else {
}
} else {
}
}
return (0);
} /* emlxs_dfc_get_cfg() */
/* ARGSUSED */
static int32_t
{
if (rc) {
"%s: Unable to set parameter. code=%d",
switch (rc) {
case 2:
return (DFC_NPIV_ACTIVE);
default:
return (DFC_ARG_INVALID);
}
}
return (0);
} /* emlxs_dfc_set_cfg() */
/*ARGSUSED*/
static int32_t
{
char buffer[128];
}
rsp_size);
rval = DFC_ARG_NULL;
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
if (rsp_size > MAX_CT_PAYLOAD) {
"%s: Buffer2 too large. size=%d",
goto done;
}
if (cmd_size > MAX_CT_PAYLOAD) {
"%s: Buffer1 too large. size=%d",
goto done;
}
"%s: Buffer3 too small. (size=%d)",
goto done;
}
"%s: Buffer4 too small. (size=%d)",
goto done;
}
== NULL) {
"%s: WWPN does not exists. %s",
goto done;
}
} else {
"%s: DID does not exist. did=%x",
goto done;
}
}
if (did == 0) {
}
"%s: Unable to allocate packet.",
goto done;
}
/* Make this a polled IO */
/* Build the fc header */
/* Copy in the command buffer */
rval = DFC_IO_ERROR;
goto done;
}
"Pkt Transport error. Pkt Timeout.");
rval = DFC_TIMEOUT;
} else {
rval = DFC_IO_ERROR;
}
goto done;
}
rval = 0;
done:
if (pkt) {
}
return (rval);
} /* emlxs_dfc_send_ct() */
/*ARGSUSED*/
static int32_t
{
rval = DFC_ARG_NULL;
goto done;
}
"%s: Unable to allocate packet.",
goto done;
}
/* Make this a polled IO */
/* Build the fc header */
/* Copy in the command buffer */
rval = DFC_IO_ERROR;
goto done;
}
"Pkt Transport error. Pkt Timeout.");
rval = DFC_TIMEOUT;
} else {
rval = DFC_IO_ERROR;
}
goto done;
}
rval = 0;
done:
if (pkt) {
}
return (rval);
} /* emlxs_dfc_send_ct_rsp() */
#ifdef MENLO_SUPPORT
/*ARGSUSED*/
static int32_t
{
"%s: Menlo device not present. device=%x,%x",
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
"%s: Buffer3 too small. %d < %d",
sizeof (uint32_t));
goto done;
}
/* Send the command */
if (rval == 0) {
/* Return the response & size */
}
done:
return (rval);
} /* emlxs_dfc_send_menlo() */
extern int32_t
{
/* Look for Zephyr specific commands */
if (cmd_code & 0x80000000) {
/* Validate response buffer */
"send_menlo_cmd: Response overrun.");
goto done;
}
/* All of these responses will be 4 bytes only */
rsp_code = 0;
/* Validate command buffer */
switch (cmd_code) {
case MENLO_CMD_RESET:
if (cmd_size < sizeof (menlo_reset_cmd_t)) {
"send_menlo_cmd: "
"Invalid command size. %d < %d",
sizeof (menlo_reset_cmd_t));
goto done;
}
cmd_size = sizeof (menlo_reset_cmd_t);
/* Read the command buffer */
/* MENLO_FW_GOLDEN */
value = 1;
"send_menlo_cmd: Reset with Golden "
"firmware requested.");
} else {
/* MENLO_FW_OPERATIONAL */
value = 0;
"send_menlo_cmd: Reset with "
"Operational firmware requested.");
}
addr = 0x103007;
break;
case MENLO_CMD_SET_MODE:
if (cmd_size < sizeof (menlo_set_cmd_t)) {
"send_menlo_cmd: "
"Invalid command size. %d < %d",
sizeof (menlo_set_cmd_t));
goto done;
}
cmd_size = sizeof (menlo_set_cmd_t);
/* Read the command buffer */
"send_menlo_cmd: "
"Maintenance mode enable requested.");
/* Make sure the mode flag is cleared */
}
mm_mode = 1;
} else {
"send_menlo_cmd: "
"Maintenance mode disable requested.");
}
addr = 0x103107;
break;
default:
"send_menlo_cmd: "
"Invalid command. cmd=%x", cmd_code);
goto done;
}
KM_SLEEP);
/* Create the set_variable mailbox request */
/* issue the mbox cmd to the sli */
if (mbxstatus) {
"send_menlo_cmd: %s failed. mbxstatus=0x%x",
if (mbxstatus == MBX_TIMEOUT) {
rval = DFC_TIMEOUT;
} else {
rval = DFC_IO_ERROR;
}
goto done;
}
/* Check if we need to wait for maintenance mode */
/* Wait for link to come up in maintenance mode */
rval = 0;
rval =
}
if (rval == -1) {
"send_menlo_cmd: "
"Menlo maintenance mode error. Timeout.");
rval = DFC_TIMEOUT;
goto done;
}
}
} else { /* Standard commands */
"send_menlo_cmd: Adapter link down.");
goto done;
}
if (cmd_code == MENLO_CMD_FW_DOWNLOAD) {
/* Check cmd size */
/* Must be at least 12 bytes of command */
/* plus 4 bytes of data */
"send_menlo_cmd: "
"Invalid command size. %d < %d",
(12 + 4));
goto done;
}
/* Extract data buffer from command buffer */
cmd_size = 12;
}
KM_NOSLEEP))) {
"send_menlo_cmd: Unable to allocate packet.");
goto done;
}
/* Make this a polled IO */
/* Build the fc header */
/* Copy in the command buffer */
"send_menlo_cmd: Unable to send packet.");
rval = DFC_IO_ERROR;
goto done;
}
"send_menlo_cmd: "
"Pkt Transport error. Pkt Timeout.");
rval = DFC_TIMEOUT;
"send_menlo_cmd: "
"Pkt Transport error. Response overrun.");
} else {
"send_menlo_cmd: "
"Pkt Transport error. state=%x",
rval = DFC_IO_ERROR;
}
goto done;
}
if (cmd_code == MENLO_CMD_FW_DOWNLOAD) {
/* Check response code */
if (rsp_code == MENLO_RSP_SUCCESS) {
/* Now transmit the data phase */
/* Save last rx_id */
/* Free old pkt */
/* Allocate data pkt */
*rsp_size, 0, KM_NOSLEEP))) {
"send_menlo_cmd: "
"Unable to allocate data "
"packet.");
goto done;
}
/* Make this a polled IO */
/* Build the fc header */
/* Copy in the data buffer */
"send_menlo_cmd: "
"Unable to send data packet.");
rval = DFC_IO_ERROR;
goto done;
}
"send_menlo_cmd: "
"Data Pkt Transport "
"error. Pkt Timeout.");
rval = DFC_TIMEOUT;
FC_PKT_LOCAL_RJT) &&
(pkt->pkt_reason ==
"send_menlo_cmd: "
"Data Pkt Transport "
"error. Response overrun.");
} else {
"send_menlo_cmd: "
"Data Pkt Transport "
"error. state=%x",
rval = DFC_IO_ERROR;
}
goto done;
}
}
}
}
rval = 0;
done:
if (pkt) {
}
if (mbq) {
}
return (rval);
} /* emlxs_send_menlo_cmd() */
/* ARGSUSED */
extern void
{
sizeof (menlo_init_rsp_t), 0, KM_NOSLEEP))) {
"FCoE attention: Unable to allocate packet.");
return;
}
/* Make this a polled IO */
/* Build the fc header */
/* Little Endian Swap */
"FCoE attention: Unable to send packet.");
goto done;
}
"FCoE attention: Pkt Transport error. state=%x",
goto done;
}
/* Check response code */
goto done;
}
/* Little Endian Swap */
/* Log the event */
/* Perform attention checks */
if (rsp->fru_data_valid == 0) {
"Invalid FRU data found on adapter. "
"Return adapter to Emulex for repair.");
}
case MENLO_FW_TYPE_GOLDEN:
"FCoE chip is running Golden firmware. "
"Update FCoE firmware immediately.");
break;
case MENLO_FW_TYPE_DIAG:
"FCoE chip is running Diagnostic firmware. "
"Operational use of the adapter is suspended.");
break;
}
done:
if (pkt) {
}
return;
} /* emlxs_fcoe_attention_thread() */
#endif /* MENLO_SUPPORT */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
"%s: Invalid bus_type. (bus_type=%x)",
return (DFC_ARG_INVALID);
}
return (DFC_ONLINE_ERROR);
}
return (DFC_ARG_NULL);
}
"%s: Offset too large. (offset=%d)",
return (DFC_ARG_TOOBIG);
}
"%s: Count too large. (count=%d)",
return (DFC_ARG_TOOBIG);
}
"%s: Count+Offset too large. (count=%d offset=%d)",
return (DFC_ARG_TOOBIG);
}
if (cnt == 0) {
return (0);
}
for (i = 0; i < cnt; i++) {
offset++;
bptr++;
}
#ifdef FMA_SUPPORT
/* Access handle validation */
!= DDI_FM_OK) {
return (DFC_DRV_ERROR);
}
#endif /* FMA_SUPPORT */
return (0);
} /* emlxs_dfc_write_flash() */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
"%s: Invalid bus_type. (bus_type=%x)",
return (DFC_ARG_INVALID);
}
return (DFC_ONLINE_ERROR);
}
return (DFC_ARG_NULL);
}
"%s: Offset too large. (offset=%d)",
return (DFC_ARG_TOOBIG);
}
"%s: Count+Offset too large. (count=%d offset=%d)",
return (DFC_ARG_TOOBIG);
}
}
for (i = 0; i < outsz; i++) {
}
#ifdef FMA_SUPPORT
/* Access handle validation */
!= DDI_FM_OK) {
return (DFC_DRV_ERROR);
}
#endif /* FMA_SUPPORT */
return (0);
} /* emlxs_dfc_read_flash() */
/*ARGSUSED*/
static int32_t
{
char buffer[128];
rval = DFC_ARG_NULL;
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
"%s: Buffer3 too small. (size=%d)",
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
"%s: Buffer4 too small. (size=%d)",
goto done;
}
== NULL) {
"%s: WWPN does not exists. %s",
goto done;
}
} else {
"%s: DID does not exist. did=%x",
goto done;
}
}
if (did == 0) {
}
"%s: Unable to allocate packet.",
goto done;
}
/* Make this a polled IO */
/* Build the fc header */
/* Copy in the command buffer */
rval = DFC_IO_ERROR;
goto done;
}
word[0] = ELS_CMD_LS_RJT;
word[1] = 0;
rsp_size = 8;
sizeof (uint32_t));
goto done;
"Pkt Transport error. Pkt Timeout.");
rval = DFC_TIMEOUT;
} else {
rval = DFC_IO_ERROR;
}
goto done;
}
rval = 0;
done:
if (pkt) {
}
return (rval);
} /* emlxs_dfc_send_els() */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
for (i = 0; i < hba->chan_count; i++) {
}
return (0);
} /* emlxs_dfc_get_ioinfo() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
linkinfo->a_topology = 0;
}
#ifdef MENLO_SUPPORT
}
#endif /* MENLO_SUPPORT */
} else {
}
} else {
}
}
} else {
} else {
}
}
}
return (0);
} /* emlxs_dfc_get_linkinfo() */
#ifdef SFCT_SUPPORT
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
(sizeof (uint64_t) * MAX_TGTPORT_IOCNT));
(sizeof (uint64_t) * MAX_TGTPORT_IOCNT));
(sizeof (uint64_t) * MAX_TGTPORT_IOCNT));
(sizeof (uint64_t) * MAX_TGTPORT_IOCNT));
statp->FctIOCmdCnt = 0;
statp->FctReadBytes = 0;
statp->FctWriteBytes = 0;
statp->FctCmdReceived = 0;
}
}
#ifdef MENLO_SUPPORT
}
#endif /* MENLO_SUPPORT */
} else {
}
return (0);
} /* emlxs_dfc_get_fctstat() */
#endif /* SFCT_SUPPORT */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (DFC_ARG_NULL);
}
"%s: Buffer2 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
if (node_count == 0) {
return (0);
}
node_count = 0;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
}
}
}
}
}
/* Copy our dfc_state */
dnp++;
node_count++;
}
}
return (0);
} /* emlxs_dfc_get_nodeinfo() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
}
if (offset % 4) {
"%s: Offset misaligned. (offset=%d)",
return (DFC_ARG_MISALIGNED);
}
if (size % 4) {
"%s: Size misaligned. (size=%d)",
return (DFC_ARG_MISALIGNED);
}
} else {
max_size = 4096;
}
"%s: Offset too large. (offset=%d)",
return (DFC_ARG_TOOBIG);
}
}
} else {
(size / 4));
}
#ifdef FMA_SUPPORT
/* Access handle validation */
!= DDI_FM_OK) {
return (DFC_DRV_ERROR);
}
#endif /* FMA_SUPPORT */
return (0);
} /* emlxs_dfc_read_mem() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
}
if (offset % 4) {
"%s: Offset misaligned. (offset=%d)",
return (DFC_ARG_MISALIGNED);
}
if (size % 4) {
"%s: Size misaligned. (szie=%d)",
return (DFC_ARG_MISALIGNED);
}
} else {
max_size = 4096;
}
"%s: Offset too large. (offset=%d)",
return (DFC_ARG_TOOBIG);
}
}
} else {
(size / 4));
}
#ifdef FMA_SUPPORT
/* Access handle validation */
!= DDI_FM_OK) {
return (DFC_DRV_ERROR);
}
#endif /* FMA_SUPPORT */
return (0);
} /* emlxs_dfc_write_mem() */
/* ARGSUSED */
static int32_t
{
return (DFC_NOT_SUPPORTED);
}
return (DFC_ONLINE_ERROR);
}
if (offset % 4) {
"%s: Offset misaligned. (offset=%d)",
return (DFC_ARG_MISALIGNED);
}
if (offset > 255) {
"%s: Offset too large. (offset=%d)",
return (DFC_ARG_TOOBIG);
}
#ifdef FMA_SUPPORT
/* Access handle validation */
!= DDI_FM_OK) {
return (DFC_DRV_ERROR);
}
#endif /* FMA_SUPPORT */
return (0);
} /* emlxs_dfc_write_ctlreg() */
/*ARGSUSED*/
static int32_t
{
return (DFC_NOT_SUPPORTED);
}
if (offset % 4) {
"%s: Offset misaligned. (offset=%d)",
return (DFC_ARG_MISALIGNED);
}
if (offset > 255) {
"%s: Offset too large. (offset=%d)",
return (DFC_ARG_TOOBIG);
}
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
#ifdef FMA_SUPPORT
/* Access handle validation */
!= DDI_FM_OK) {
return (DFC_DRV_ERROR);
}
#endif /* FMA_SUPPORT */
return (0);
} /* emlxs_dfc_read_ctlreg() */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
switch (event) {
case FC_REG_LINK_EVENT:
case FC_REG_RSCN_EVENT:
case FC_REG_CT_EVENT:
case FC_REG_DUMP_EVENT:
case FC_REG_TEMP_EVENT:
case FC_REG_VPORTRSCN_EVENT:
case FC_REG_FCOE_EVENT:
break;
case FC_REG_MULTIPULSE_EVENT:
default:
"%s: %s. Invalid event. pid=%d enable=%d",
return (DFC_ARG_INVALID);
}
if (enable) {
}
for (i = 0; i < MAX_DFC_EVENTS; i++) {
break;
}
}
if (i == MAX_DFC_EVENTS) {
/* Find next available event object */
for (i = 0; i < MAX_DFC_EVENTS; i++) {
break;
}
}
/* Return if all event objects are busy */
if (i == MAX_DFC_EVENTS) {
"%s: %s. Too many events registered. "
"pid=%d enable=%d",
enable);
return (DFC_DRVRES_ERROR);
}
}
/* Initialize */
sizeof (uint32_t));
}
/*
* EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_dfc_debug_msg,
* "%s: %s. Enabled. pid=%d id=%d", emlxs_dfc_xlate(dfc->cmd),
* emlxs_dfc_event_xlate(event), pid, dfc_event->last_id);
*/
} else { /* Disable */
/* Find the event entry */
for (i = 0; i < MAX_DFC_EVENTS; i++) {
break;
}
}
if (i == MAX_DFC_EVENTS) {
"%s: %s. Event not registered. pid=%d enable=%d",
return (DFC_ARG_INVALID);
}
/* Kill the event thread if it is sleeping */
/* Count the number of pids still registered for this event */
count = 0;
for (i = 0; i < MAX_DFC_EVENTS; i++) {
count++;
}
}
/* If no more pids need this event, */
/* then disable logging for this event */
if (count == 0) {
}
}
return (0);
} /* emlxs_dfc_set_event() */
/*ARGSUSED*/
static int32_t
{
uint32_t event_count = 0;
return (DFC_ARG_NULL);
}
if (!event_count) {
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (DFC_ARG_NULL);
}
"%s: Buffer2 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (DFC_ARG_NULL);
}
"%s: Buffer3 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
&missed) != 0) {
"%s: get_dfc_eventinfo failed.",
goto done;
}
if (event_count) {
(event_count * sizeof (HBA_EVENTINFO)));
}
"%s: events=%d missed=%d new=%d last_id=%d",
done:
if (event_buffer) {
}
return (rval);
} /* emlxs_dfc_get_eventinfo() */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
}
}
}
"%s: %s. pid=%d size=%d,%p rcv_size=%d,%p id=%d",
/* Find the event entry */
for (i = 0; i < MAX_DFC_EVENTS; i++) {
break;
}
}
if (i == MAX_DFC_EVENTS) {
"%s: %s. Event not registered. pid=%d",
pid);
return (DFC_ARG_INVALID);
}
"%s: %s. Event not registered. pid=%d",
pid);
return (DFC_ARG_INVALID);
}
/* Initialize event buffer pointers */
}
sizeof (uint32_t));
}
"%s: %s. Completed. pid=%d rsize=%d id=%d",
return (rval);
} /* emlxs_dfc_get_event() */
extern uint32_t
{
size_only = 1;
size = 0xffffffff;
} else {
size_only = 0;
}
if (region != 7) {
"get_dump_region: Invalid sli4 region. "
"(id=%d)", region);
goto done;
}
}
switch (region) {
case 0: /* SLI Registers */
"get_dump_region: Buffer too small. "
"(SLI Registers: size=%d)", size);
goto done;
}
if (size_only) {
break;
}
#ifdef FMA_SUPPORT
/* Access handle validation */
!= DDI_FM_OK) {
}
#endif /* FMA_SUPPORT */
break;
case 1: /* SLIM */
} else {
}
if (size_only) {
break;
}
size);
} else {
#ifdef FMA_SUPPORT
/* Access handle validation */
}
#endif /* FMA_SUPPORT */
}
break;
case 2: /* Port Control Block */
"get_dump_region: Buffer too small. "
"(PCB: size=%d)", size);
goto done;
}
if (size_only) {
break;
}
break;
case 3: /* MailBox */
if (size < MAILBOX_CMD_BSIZE) {
"get_dump_region: Buffer too small. "
"(Mailbox: size=%d)", size);
goto done;
}
if (size_only) {
break;
}
size);
} else {
#ifdef FMA_SUPPORT
/* Access handle validation */
}
#endif /* FMA_SUPPORT */
}
break;
"get_dump_region: Buffer too small. "
"(HGP: size=%d)", size);
goto done;
}
if (size_only) {
break;
}
{
#ifdef FMA_SUPPORT
/* Access handle validation */
}
#endif /* FMA_SUPPORT */
}
break;
"get_dump_region: Buffer too small. "
"(PGP: size=%d)", size);
goto done;
}
if (size_only) {
break;
}
break;
if (size < SLI_IOCB_MAX_SIZE) {
"get_dump_region: Buffer too small. "
"(Rings: size=%d)", size);
goto done;
}
if (size_only) {
break;
}
break;
case 7: /* All driver specific structures */
if (size < sizeof (emlxs_hba_t)) {
"get_dump_region: Buffer too small. "
"(Driver: size=%d)", size);
goto done;
}
size = sizeof (emlxs_hba_t);
if (size_only) {
break;
}
break;
default:
"get_dump_region: Invalid region. (id=%d)", region);
}
done:
return (rval);
} /* emlxs_get_dump_region() */
/*ARGSUSED*/
static int32_t
{
"%s: region=%d size=%d",
size_only = 1;
}
return (DFC_ARG_NULL);
}
"%s: Buffer2 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
/* First get region size only */
size = 0;
if (rval != 0) {
goto done;
}
if (!size_only) {
"%s: Buffer1 too small. (size: %d < %d)",
goto done;
}
/* Get the region data */
if (rval != 0) {
goto done;
}
}
/* Return the region size */
done:
return (rval);
} /* emlxs_dfc_get_dump_region() */
#ifdef MENLO_SUPPORT
/*ARGSUSED*/
static int32_t
{
char pathname[256];
return (0);
return (1);
}
/*ARGSUSED*/
static int32_t
{
uint32_t i;
KM_SLEEP);
/* SET MENLO maint mode */
/* Create the set_variable mailbox request */
/* issue the mbox cmd to the sli */
if (mbxstatus) {
"%s: %s failed. mbxstatus=0x%x",
rval = DFC_IO_ERROR;
if (mbxstatus == MBX_TIMEOUT)
rval = DFC_TIMEOUT;
goto done;
}
/* Wait 30 sec for maint mode */
i = 0;
do {
if (i++ > 300) {
break;
}
"%s: Unable to enter maint mode.",
goto done;
}
"%s: Entered maint mode. Port offset: %d",
/* Issue Menlo loopback command */
sizeof (uint32_t), 0, KM_NOSLEEP))) {
"%s: Unable to allocate packet.",
goto done;
}
/* Make this a polled IO */
/* Build the fc header */
"%s: Unable to send packet.",
rval = DFC_IO_ERROR;
goto done;
}
"%s: Pkt Transport error. Pkt Timeout.",
rval = DFC_TIMEOUT;
"%s: Pkt Transport error. Rsp overrun.",
} else {
"%s: Pkt Transport error. state=%x",
rval = DFC_IO_ERROR;
}
goto done;
}
/* CLEAR MENLO maint mode */
/* Create the set_variable mailbox request */
/* issue the mbox cmd to the sli */
if (mbxstatus) {
"%s: %s failed. mbxstatus=0x%x",
rval = DFC_IO_ERROR;
if (mbxstatus == MBX_TIMEOUT)
rval = DFC_TIMEOUT;
}
i = 0;
i++;
if (i == 300) {
rval = DFC_TIMEOUT;
"%s: Linkup timeout.",
goto done;
}
}
done:
/* Free allocated mbox memory */
if (mbq) {
}
if (pkt) {
}
return (rval);
}
/*ARGSUSED*/
static int32_t
{
/* Issue Menlo loopback command */
sizeof (uint32_t), 0, KM_NOSLEEP))) {
"%s: Unable to allocate packet.",
goto done;
}
/* Make this a polled IO */
/* Build the fc header */
"%s: Unable to send packet.",
rval = DFC_IO_ERROR;
goto done;
}
"%s: Pkt Transport error. Pkt Timeout.",
rval = DFC_TIMEOUT;
"%s: Pkt Transport error. Rsp overrun.",
} else {
"%s: Pkt Transport error. state=%x",
rval = DFC_IO_ERROR;
}
goto done;
}
done:
if (pkt) {
}
return (rval);
}
/*ARGSUSED*/
static int32_t
{
KM_SLEEP);
/* RESET MENLO */
/* Create the set_variable mailbox request */
/* issue the mbox cmd to the sli */
if (mbxstatus) {
"%s: %s failed. mbxstatus=0x%x",
rval = DFC_IO_ERROR;
if (mbxstatus == MBX_TIMEOUT)
rval = DFC_TIMEOUT;
goto done;
}
done:
/* Free allocated mbox memory */
if (mbq) {
}
return (rval);
}
#endif /* MENLO_SUPPORT */
/* ARGSUSED */
static int32_t
{
uint32_t i;
return (DFC_NOT_SUPPORTED);
}
/* Reinitialize the link */
case 0: /* Disable */
"%s: Loopback already disabled.",
return (rval);
}
goto resetdone;
case 1: /* Internal loopback */
speed = 0;
/* Check if mode already set */
"%s: ILB mode already enabled.",
return (rval);
}
break;
case 2: /* External loopback */
} else {
}
/* Check if mode already set */
"%s: ELB mode already enabled.",
return (rval);
}
break;
default:
"%s: Invalid loopback mode. (mode=%x)",
return (DFC_ARG_INVALID);
}
/* Make sure adapter is online */
if (emlxs_online(hba)) {
"%s: Unable to bring adapter online.",
return (DFC_OFFLINE_ERROR);
}
#ifdef MENLO_SUPPORT
"%s: Menlo support detected: mode:x%x",
if (new_mode == FC_ILB_MODE) {
if (rval)
goto done;
}
}
#endif /* MENLO_SUPPORT */
KM_SLEEP);
/* Take the link down */
if (rval == MBX_TIMEOUT) {
"%s: Mailbox timed out. cmd=%x",
rval = DFC_TIMEOUT;
goto done;
}
if (rval) {
rval = DFC_IO_ERROR;
goto done;
}
/*
* Need *2 since we wait 1/2 sec in while loop.
*/
if (!timeout) {
} else {
}
i = 0;
i++;
if (i == timeout) {
rval = DFC_TIMEOUT;
goto done;
}
}
/* Reinitialize the link */
/* Set the loopback mode and timer */
if (rval == MBX_TIMEOUT) {
"%s: Mailbox timed out. cmd=%x",
rval = DFC_TIMEOUT;
goto done;
}
if (rval) {
rval = DFC_IO_ERROR;
goto done;
}
i = 0;
i++;
if (i == timeout) {
rval = DFC_TIMEOUT;
goto done;
}
}
/* Create host node */
"%s: Unable to register host node.",
goto done;
}
i = 0;
do {
if (i++ > 300) {
break;
}
if (!ndlp) {
"%s: Unable to create host node.",
goto done;
}
#ifdef MENLO_SUPPORT
"%s: Menlo support detected: mode:x%x",
if (rval)
goto done;
}
#endif /* MENLO_SUPPORT */
/* Create host XRI */
ndlp);
i = 0;
do {
if (i++ > 300) {
break;
}
"%s: Unable to create XRI.",
goto done;
}
} else {
EMLXS_XRI_SOL_CT_TYPE, 0xffff);
"%s: Unable to reserve XRI.",
goto done;
}
}
done:
/* Free allocated mbox memory */
if (mbq) {
}
if (rval) {
/* Reset the adapter */
#ifdef MENLO_SUPPORT
"%s: Menlo reset: rval:x%x",
}
#endif /* MENLO_SUPPORT */
/* Reset link whether we are bound to ULP or not */
}
return (rval);
} /* emlxs_dfc_loopback_mode() */
/*ARGSUSED*/
static int32_t
{
return (DFC_NOT_SUPPORTED);
}
"%s: Adapter not in loopback mode.",
goto done;
}
goto done;
}
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
rval = DFC_ARG_NULL;
goto done;
}
"%s: Buffer1 too large. (size=%d)",
goto done;
}
/* Check if we have a node for ourselves */
if (!ndlp) {
goto done;
}
goto done;
}
goto done;
}
if (hba->loopback_pkt) {
rval = 0;
rval =
timeout);
}
if (rval == -1) {
"Loopback busy timeout.");
rval = DFC_TIMEOUT;
goto done;
}
}
/* Send polled command */
"Pkt Transport error. ret=%x state=%x", rval,
rval = DFC_IO_ERROR;
goto done;
}
"Pkt Transport error. Pkt Timeout.");
rval = DFC_TIMEOUT;
} else {
rval = DFC_IO_ERROR;
}
goto done;
}
/* Wait for sequence completion */
rval = 0;
}
if (rval == -1) {
"Loopback sequence timeout.");
rval = DFC_TIMEOUT;
goto done;
}
rval = 0;
done:
if (rval) {
}
/* Reset the adapter */
}
if (pkt) {
}
return (rval);
} /* emlxs_dfc_loopback_test() */
/*ARGSUSED*/
static int32_t
{
case 1:
case 2:
break;
case 3:
} else {
/* Perform All Firmware Reset */
}
break;
default:
"%s: Invalid reset type. (mode=%x)",
return (DFC_ARG_INVALID);
}
if (rval) {
}
return (rval);
} /* emlxs_dfc_reset_port() */
extern int32_t
{
if (!sbp) {
"Stray interrupt. cmd=0x%x iotag=0x%x status=0x%x "
return (DFC_ARG_INVALID);
}
iocbq);
return (DFC_ARG_INVALID);
}
switch (cmd->ULPCOMMAND) {
case CMD_XMIT_SEQUENCE_CR:
case CMD_XMIT_SEQUENCE64_CR:
case CMD_XMIT_SEQUENCE_CX:
case CMD_XMIT_SEQUENCE64_CX:
"XMIT_SEQUENCE comp: status=0x%x",
} else {
"XMIT_SEQUENCE comp: status=0x%x [%08x,%08x]",
}
break;
default:
break;
} /* switch(cmd->ULPCOMMAND) */
return (0);
} /* emlxs_dfc_handle_event() */
/* ARGSUSED */
extern int
{
"CT Receive: cmd=%x status=0x%x ",
/*
* No response sent on loopback; free the exchange now
*/
}
/*
* EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_dfc_debug_msg,
* "CT Receive: payload=%p size=%d [%02x,%02x, %02x, %02x]", bp,
* size, bp[0], bp[1], bp[2],bp[3]);
*/
/* Return payload */
if (hba->loopback_pkt) {
}
return (0);
} /* emlxs_dfc_handle_unsol_req() */
#ifdef DHCHAP_SUPPORT
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (DFC_ARG_NULL);
}
"%s: Buffer2 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
/* Initiate authentication here */
return (rval);
} /* emlxs_dfc_init_auth() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (rval);
}
return (0);
} /* emlxs_dfc_get_auth_cfg() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (DFC_ARG_NULL);
}
"%s: Buffer2 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
case EMLXS_AUTH_CFG_ADD:
break;
case EMLXS_AUTH_CFG_DELETE:
break;
}
if (rval) {
return (rval);
}
return (0);
} /* emlxs_dfc_set_auth_cfg() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
/* Read the auth password */
return (rval);
}
return (0);
} /* emlxs_dfc_get_auth_pwd() */
/*ARGSUSED*/
static int32_t
{
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (rval);
}
return (0);
} /* emlxs_dfc_set_auth_pwd() */
/*ARGSUSED*/
static int32_t
{
&emlxs_dfc_error_msg, "%s: Null buffer1 found.",
return (DFC_ARG_NULL);
}
&emlxs_dfc_error_msg, "%s: Buffer too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (rval);
}
return (0);
} /* emlxs_dfc_get_auth_status() */
/*ARGSUSED*/
static int32_t
{
/* Lock cfg table while we do this */
/* This prevents the table from changing while we get a copy */
&emlxs_dfc_error_msg, "%s: Null buffer2 found.",
return (DFC_ARG_NULL);
}
&emlxs_dfc_error_msg, "%s: Buffer2 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
sizeof (uint32_t));
return (DFC_SUCCESS);
}
/* Check table size */
&emlxs_dfc_error_msg, "%s: Buffer1 too small. (%d < %d)",
return (DFC_ARG_TOOSMALL);
}
return (rval);
} /* emlxs_dfc_get_auth_cfg_table() */
/*ARGSUSED*/
static int32_t
{
/* Lock cfg table while we do this */
/* This prevents the table from changing while we get a copy */
&emlxs_dfc_error_msg, "%s: Null buffer2 found.",
return (DFC_ARG_NULL);
}
&emlxs_dfc_error_msg, "%s: Buffer2 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
sizeof (uint32_t));
return (DFC_SUCCESS);
}
/* Check table size */
&emlxs_dfc_error_msg, "%s: Buffer1 too small. (%d < %d)",
return (DFC_ARG_TOOSMALL);
}
return (rval);
} /* emlxs_dfc_get_auth_key_table() */
#endif /* DHCHAP_SUPPORT */
#ifdef SAN_DIAG_SUPPORT
/*ARGSUSED*/
static int32_t
{
if (state == SD_COLLECTING)
else if ((search_type < SD_SEARCH_LINEAR) ||
else if (type != SD_SCSI_IO_LATENCY_TYPE)
else {
sizeof (sd_bucket_info_t));
}
return (rval);
}
/*ARGSUSED*/
static int32_t
{
if (emlxs_sd_bucket.search_type == 0) {
} else if (type != SD_SCSI_IO_LATENCY_TYPE) {
} else {
}
return (rval);
} /* emlxs_dfc_sd_destroy_bucket() */
/*ARGSUSED*/
static int32_t
{
if (emlxs_sd_bucket.search_type == 0) {
} else if (type != SD_SCSI_IO_LATENCY_TYPE) {
} else {
sizeof (sd_bucket_info_t));
}
return (rval);
} /* emlxs_dfc_sd_get_bucket() */
/*ARGSUSED*/
static int32_t
{
int i;
goto start_collect_exit;
}
if (emlxs_sd_bucket.search_type == 0) {
goto start_collect_exit;
}
/* Read the wwn object */
/* Make sure WWPN is unique */
if (!vport) {
goto start_collect_exit;
}
/* traverse list of nodes for this vport and reset counter */
goto start_collect_exit;
}
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
sizeof (struct SD_time_stats_v0) *
}
}
return (rval);
}
/*ARGSUSED*/
static int32_t
{
int i, j;
goto stop_collect_exit;
}
if (emlxs_sd_bucket.search_type == 0) {
goto stop_collect_exit;
}
/* Read the wwn object */
/* Make sure WWPN is unique */
if (!vport) {
goto stop_collect_exit;
}
goto stop_collect_exit;
}
/* see if any other port is collecting io latency */
for (i = 0; i < emlxs_device.hba_count; i++) {
for (j = 0; j < temp_hba->num_of_ports; j++) {
goto stop_collect_exit;
}
}
/*
* if we get here, that means no one else is collecting
* io latency data.
*/
return (rval);
}
/*ARGSUSED*/
static int32_t
{
int i;
goto reset_collect_exit;
}
if (emlxs_sd_bucket.search_type == 0) {
goto reset_collect_exit;
}
/* Read the wwn object */
/* Make sure WWPN is unique */
if (!vport) {
goto reset_collect_exit;
}
/* traverse list of nodes for this vport and reset counter */
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
sizeof (struct SD_time_stats_v0) *
}
}
return (rval);
}
/*ARGSUSED*/
static int32_t
{
int i, skip_bytes;
goto get_data_exit;
}
if (emlxs_sd_bucket.search_type == 0) {
goto get_data_exit;
}
/* Read the wwn object */
/* Make sure WWPN is unique */
if (!vport) {
goto get_data_exit;
}
/*
* count # of targets to see if buffer is big enough
*/
count = 0;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
count++;
}
}
sizeof (struct SD_time_stats_v0) * SD_IO_LATENCY_MAX_BUCKETS);
if (bufsize < size_needed) {
goto update_count; /* not enough space, return */
}
/*
* return data collected, reset counter.
*/
count = 0;
skip_bytes = 0;
for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) {
/* copy port name */
sizeof (HBA_WWN));
skip_bytes += sizeof (HBA_WWN);
/* copy bucket data */
sizeof (struct SD_time_stats_v0) *
skip_bytes += sizeof (struct SD_time_stats_v0) *
sizeof (struct SD_time_stats_v0) *
count++;
bufsize -= sizeof (struct SD_IO_Latency_Response);
}
}
return (rval);
} /* emlxs_dfc_sd_get_data() */
/*ARGSUSED*/
static int32_t
{
int i, count;
/*
* The value of "event" has been shifted left based on
* the category that the application gave to libdfc.
*
* This is so the old Event handling code won't mistakenly
* grab an SD Event.
*/
/* Read the wwn object */
/* Make sure WWPN is unique */
if (!vport) {
goto set_sd_event_exit;
}
if (enable) {
/* Find next available event object */
for (i = 0; i < MAX_DFC_EVENTS; i++) {
break;
}
/* Return if all event objects are busy */
if (i == MAX_DFC_EVENTS) {
goto set_sd_event_exit;
}
/* Initialize */
/* TODO: Should we add SUBCAT in dfc_event ??? */
sizeof (uint32_t));
}
} else { /* Disable */
/* find event entry */
for (i = 0; i < MAX_DFC_EVENTS; i++) {
break;
}
/* Return if not found */
if (i == MAX_DFC_EVENTS) {
goto set_sd_event_exit;
}
/* Kill the event thread if it is sleeping */
/* Count the number of pids still registered for this event */
count = 0;
for (i = 0; i < MAX_DFC_EVENTS; i++) {
count++;
}
/*
* If no more pids need this event,
* then disable logging for this event
*/
if (count == 0)
}
return (rval);
} /* emlxs_dfc_sd_set_event */
/*ARGSUSED*/
static int32_t
{
/* Read the wwn object */
/* Make sure WWPN is unique */
if (!vport) {
goto get_sd_event_exit;
}
/* Find the event entry */
for (i = 0; i < MAX_DFC_EVENTS; i++) {
break;
}
if (i == MAX_DFC_EVENTS) {
goto get_sd_event_exit;
}
goto get_sd_event_exit;
}
/* Initialize event buffer pointers */
/*
* update rcv_size.
*/
sizeof (uint32_t));
}
/*
* update index
*/
sizeof (uint32_t));
}
return (rval);
} /* emlxs_dfc_sd_get_event */
#endif
/*ARGSUSED*/
static int32_t
{
void *ptr;
char buffer[64];
/* cmd info */
rval = DFC_ARG_NULL;
goto done;
}
/* reqBuffer info */
rval = DFC_ARG_NULL;
goto done;
}
/* rspBuffer info, could be 0 for SCSI commands like TUR */
rval = DFC_ARG_NULL;
goto done;
}
/* senseBuffer info */
rval = DFC_ARG_NULL;
goto done;
}
port =
"%s: WWPN does not exists. %s",
goto done;
}
}
goto done;
}
"%s: Unable to allocate packet.",
goto done;
}
/* Copy in the command buffer */
/* Make this a polled IO */
/* Build the fc header */
} else {
}
rval = DFC_IO_ERROR;
goto done;
}
"Pkt Transport error. Pkt Timeout.");
rval = DFC_TIMEOUT;
} else {
rval = DFC_IO_ERROR;
}
goto done;
}
if (pkt->pkt_data_resid) {
else
}
/*
* This is sense count for flag = 0.
* It is fcp response size for flag = 1.
*/
} else {
}
if (SCSI_SNS_CNT(cmdinfo)) {
}
if (SCSI_RSP_CNT(cmdinfo)) {
}
rval = 0;
done:
if (pkt) {
}
return (rval);
} /* emlxs_dfc_send_scsi_fcp() */
/*ARGSUSED*/
static int32_t
{
return (DFC_NOT_SUPPORTED);
}
return (DFC_ARG_NULL);
}
return (rval);
} /* emlxs_dfc_get_persist_linkdown() */
/*ARGSUSED*/
static int32_t
{
return (DFC_NOT_SUPPORTED);
}
} else {
}
return (rval);
} /* emlxs_dfc_set_persist_linkdown() */
/*ARGSUSED*/
static int32_t
{
uint32_t i;
return (DFC_ARG_NULL);
}
"%s: Buffer1 too small. (size=%d)",
return (DFC_ARG_TOOSMALL);
}
return (DFC_NOT_SUPPORTED);
}
return (DFC_DRV_ERROR);
}
size = sizeof (DFC_FCoEFCFList_t) +
}
count++;
fcflistentry++;
}
}
}
i = sizeof (DFC_FCoEFCFList_t) +
done:
return (rval);
} /* emlxs_dfc_get_fcflist() */
/*ARGSUSED*/
static int32_t
{
return (DFC_NOT_SUPPORTED);
}
return (DFC_ARG_NULL);
}
return (DFC_ARG_NULL);
}
"%s: Invalid buffer size. (size=%d)",
return (DFC_ARG_INVALID);
}
/*
* Now snoop the mailbox command
*/
switch (mb4->mbxCommand) {
case MBX_SLI_CONFIG:
/*
* Allow only one buffer descriptor
* for non-embedded commands
*/
"%s: Only one buffer descriptor allowed.",
break;
}
"%s: Invalid buffer size. (size=%d)",
break;
}
"%s: Unable to allocate buffer.",
break;
}
break;
}
hdr_req = (mbox_req_hdr_t *)
/*
* WRITE_OBJECT, READ_OBJECT and READ_OBJECT_LIST are
* special because they use buffer descriptors
*/
> 1) {
/*
* Allow only one buffer descriptor
* for embedded commands
*/
"%s: Only one buffer descriptor allowed.",
break;
}
"%s: Invalid buffer size. (size=%d)",
break;
}
"%s: Unable to allocate buffer.",
break;
}
}
break;
}
break;
case MBX_DUMP_MEMORY:
break;
"%s: Invalid buffer size. (size=%d)",
break;
}
"%s: Unable to allocate buffer.",
break;
}
break;
case MBX_UPDATE_CFG:
break;
"%s: Invalid buffer size. (size=%d)",
break;
}
"%s: Unable to allocate buffer.",
break;
}
break;
case MBX_RUN_BIU_DIAG64:
"%s: Invalid xmit BDE. cmd=%x",
break;
}
/* Allocate xmit buffer */
"%s: Unable to allocate xmit buffer. cmd=%x",
break;
}
/* Initialize the xmit buffer */
mode) != 0) {
"%s: ddi_copyin failed. cmd=%x",
break;
}
"%s: Invalid xmit BDE. cmd=%x",
break;
}
/* Allocate receive buffer */
"%s: Unable to allocate receive buffer. cmd=%x",
break;
}
break;
default:
break;
}
if (rval)
goto done;
/* issue the mbox cmd to the sli */
if (mbxstatus) {
"%s: %s failed. mbxstatus=0x%x",
}
if (mp) {
}
if (rx_mp) {
mode) != 0) {
"%s: ddi_copyout failed for receive buffer. cmd=%x",
goto done;
}
}
done:
/* Free allocated memory */
if (mp) {
}
if (tx_mp) {
}
if (rx_mp) {
}
if (mbq) {
}
return (rval);
} /* emlxs_dfc_send_mbox4() */
/* ARGSUSED */
static int
{
return (DFC_ARG_NULL);
}
mbq =
goto done;
}
/*
* Signifies a non-embedded command
*/
if (rc == MBX_SUCCESS) {
} else {
if ((rc == MBX_NONEMBED_ERROR) &&
rval = DFC_NO_DATA;
} else {
rval = DFC_IO_ERROR;
}
}
done:
if (mp) {
}
if (mbq) {
}
return (rval);
} /* emlxs_dfc_rd_be_fcf() */
/*ARGSUSED*/
static int
{
/*
* Signifies an embedded command
*/
sizeof (IOCTL_DCBX_SET_DCBX_MODE);
if (rval != MBX_SUCCESS) {
}
done:
if (mbq) {
}
return (rval);
} /* emlxs_dfc_set_be_dcbx() */
/* ARGSUSED */
static int
{
/*
* Signifies an embedded command
*/
sizeof (IOCTL_DCBX_SET_DCBX_MODE);
if (rval != MBX_SUCCESS) {
goto done;
}
done:
if (mbq) {
}
return (rval);
} /* emlxs_dfc_get_be_dcbx() */
/* ARGSUSED */
static int
{
return (DFC_NOT_SUPPORTED);
}
}
return (rval);
} /* emlxs_dfc_get_qos() */