fcoeadm.c revision e6eb57e72471348376359efe9105d50bf487a312
/*
* 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 usr/src/OPENSOLARIS.LICENSE
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "fcinfo.h"
#include <libintl.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#include <ctype.h>
#include <stddef.h>
#include <strings.h>
#include <libfcoe.h>
#include <syslog.h>
static const char *FCOE_DRIVER_PATH = "/devices/fcoe:admin";
static int
isValidWWN(char *wwn)
{
int index;
return (0);
}
return (0);
}
continue;
}
return (0);
}
return (1);
}
{
}
/*
* prints out all the HBA port information
*/
void
{
int i;
return;
}
for (i = 0; i < 6; i++) {
}
for (i = 0; i < 6; i++) {
}
}
int
{
FCOE_UINT8 promiscuous = 0;
/* check the mac name operand */
case 'i':
createini = 1;
break;
case 't':
createtgt = 1;
break;
case 'p':
gettext("Error: Invalid Port WWN\n"));
return (1);
}
break;
case 'n':
gettext("Error: Invalid Node WWN\n"));
return (1);
}
break;
case 'f':
promiscuous = 1;
break;
default:
return (1);
}
}
"not be both specified\n");
return (1);
}
if (status != FCOE_STATUS_OK) {
switch (status) {
case FCOE_STATUS_ERROR_BUSY:
gettext("Error: fcoe driver is busy\n"));
break;
gettext("Error: Existing FCoE port "
"found on the specified MAC link\n"));
break;
case FCOE_STATUS_ERROR_PERM:
gettext("Error: Not enough permission to "
"open fcoe device\n"));
break;
gettext("Error: Failed to open fcoe device\n"));
break;
gettext("Error: Port WWN is same as Node "
"WWN\n"));
break;
gettext("Error: MAC name exceeds maximum "
"length\n"));
break;
gettext("Error: The specified Port WWN "
"is already in use\n"));
break;
gettext("Error: The specified Node WWN "
"is already in use\n"));
break;
gettext("Error: MTU size of the specified "
"MAC link needs to be increased to 2500 "
"or above\n"));
break;
gettext("Error: Out of memory\n"));
break;
gettext("Error: Failed to open the "
"specified MAC link\n"));
break;
gettext("Error: Failed to create FCoE "
"port on the specified MAC link\n"));
break;
gettext("Error: Link class other than physical "
"link is not supported\n"));
break;
gettext("Error: Failed to get link information "
"for %s\n"), macLinkName);
break;
case FCOE_STATUS_ERROR:
default:
}
return (1);
} else {
return (0);
}
}
int
{
/* check the mac name operand */
if (status != FCOE_STATUS_OK) {
switch (status) {
case FCOE_STATUS_ERROR_BUSY:
gettext("Error: fcoe driver is busy\n"));
break;
gettext("Error: FCoE port not found on the "
"specified MAC link\n"));
break;
case FCOE_STATUS_ERROR_PERM:
gettext("Error: Not enough permission to "
"open fcoe device\n"));
break;
gettext("Failed: MAC name exceeds maximum "
"length 32\n"));
break;
gettext("Error: Failed to open fcoe device\n"));
break;
gettext("Error: FCoE port not found on the "
"specified MAC link\n"));
break;
gettext("Error: Please use stmfadm to offline "
"the FCoE target first\n"));
break;
gettext("Error: Failed to get link information "
"for %s\n"), macLinkName);
break;
case FCOE_STATUS_ERROR:
default:
}
return (1);
} else {
return (0);
}
}
int
{
int i;
int ret;
case 'i':
showini = 1;
break;
case 't':
showtgt = 1;
break;
default:
return (1);
}
}
showini = 1;
showtgt = 1;
}
if (status != FCOE_STATUS_OK) {
switch (status) {
case FCOE_STATUS_ERROR_BUSY:
gettext("Error: fcoe driver is busy\n"));
break;
case FCOE_STATUS_ERROR_PERM:
gettext("Error: Not enough permission to "
"open fcoe device\n"));
break;
gettext("Error: Failed to open fcoe device\n"));
break;
gettext("Error: Invalid argument\n"));
break;
gettext("Error: More data\n"));
break;
case FCOE_STATUS_ERROR:
default:
}
ret = 1;
} else {
if (port_num == 0) {
} else {
for (i = 0; i < port_num; i++) {
printFCOEPortInfo(&portlist[i]);
}
}
}
ret = 0;
}
}
return (ret);
}