libfcoe.c revision 2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41
/*
* 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 <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <strings.h>
#include <fcntl.h>
#include <unistd.h>
#include <libintl.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include <syslog.h>
#include <libfcoe.h>
#include <fcoeio.h>
#define FCOE_DEV_PATH "/devices/fcoe:admin"
#define OPEN_FCOE 0
#define OPEN_EXCL_FCOE O_EXCL
/*
* Open for fcoe module
*
* flag - open flag (OPEN_FCOE, OPEN_EXCL_FCOE)
* fd - pointer to integer. On success, contains the fcoe file descriptor
*/
static int
{
int ret = FCOE_STATUS_ERROR;
} else {
} else {
}
}
return (ret);
}
static int
{
int i;
int size = sizeof (FCOE_PORT_WWN);
for (i = 0; i < size; i++) {
return (0);
}
}
return (1);
}
const FCOE_UINT8 *macLinkName,
{
int fcoe_fd;
if (macLinkName == NULL) {
return (FCOE_STATUS_ERROR_INVAL_ARG);
}
if (portType != FCOE_PORTTYPE_INITIATOR &&
portType != FCOE_PORTTYPE_TARGET) {
return (FCOE_STATUS_ERROR_INVAL_ARG);
}
}
}
return (FCOE_STATUS_ERROR_WWN_SAME);
}
return (FCOE_STATUS_ERROR_MAC_LEN);
}
return (status);
}
switch (fcoeio.fcoeio_status) {
case FCOEIOE_INVAL_ARG:
break;
case FCOEIOE_BUSY:
break;
case FCOEIOE_ALREADY:
break;
case FCOEIOE_PWWN_CONFLICTED:
break;
case FCOEIOE_NWWN_CONFLICTED:
break;
case FCOEIOE_CREATE_MAC:
break;
case FCOEIOE_OPEN_MAC:
break;
case FCOEIOE_CREATE_PORT:
break;
case FCOEIOE_NEED_JUMBO_FRAME:
break;
case FCOEIOE_VNIC_UNSUPPORT:
break;
default:
}
} else {
}
return (status);
}
{
int fcoe_fd;
if (macLinkName == NULL) {
return (FCOE_STATUS_ERROR_INVAL_ARG);
}
return (FCOE_STATUS_ERROR_MAC_LEN);
}
return (status);
}
switch (fcoeio.fcoeio_status) {
case FCOEIOE_INVAL_ARG:
break;
case FCOEIOE_BUSY:
break;
case FCOEIOE_ALREADY:
break;
case FCOEIOE_MAC_NOT_FOUND:
break;
case FCOEIOE_OFFLINE_FAILURE:
break;
default:
}
} else {
}
return (status);
}
{
int fcoe_fd;
int i;
int retry = 0;
int bufsize;
return (FCOE_STATUS_ERROR_INVAL_ARG);
}
*port_num = 0;
return (status);
}
/* Get fcoe port list */
retry = 0;
do {
sizeof (fcoe_port_list_t);
}
switch (fcoeio.fcoeio_status) {
case FCOEIOE_INVAL_ARG:
return (status);
case FCOEIOE_BUSY:
retry++;
break;
case FCOEIOE_MORE_DATA:
retry++;
default:
}
} else {
break;
}
if (status == FCOE_STATUS_OK) {
for (i = 0; i < inportlist->numPorts; i++) {
}
*portlist = outportlist;
} else {
*port_num = 0;
}
return (status);
}