2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _LIBFCOE_H
2N/A#define _LIBFCOE_H
2N/A
2N/A#include <time.h>
2N/A#include <wchar.h>
2N/A#include <sys/param.h>
2N/A#include <sys/ethernet.h>
2N/A#include <libnvpair.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * FCoE Port Type
2N/A */
2N/A#define FCOE_PORTTYPE_INITIATOR 0
2N/A#define FCOE_PORTTYPE_TARGET 1
2N/A
2N/A#define FCOE_MAX_MAC_NAME_LEN 32
2N/A
2N/A#define FCOE_SCF_ADD 0
2N/A#define FCOE_SCF_REMOVE 1
2N/A
2N/A#define FCOE_SUCCESS 0
2N/A#define FCOE_ERROR 1
2N/A#define FCOE_ERROR_EXISTS 2
2N/A#define FCOE_ERROR_SERVICE_NOT_FOUND 3
2N/A#define FCOE_ERROR_NOMEM 4
2N/A#define FCOE_ERROR_MEMBER_NOT_FOUND 5
2N/A#define FCOE_ERROR_BUSY 6
2N/A
2N/A#define FCOE_TARGET_SERVICE "system/fcoe_target"
2N/A#define FCOE_INITIATOR_SERVICE "system/fcoe_initiator"
2N/A#define FCOE_PG_NAME "fcoe-port-list-pg"
2N/A#define FCOE_PORT_LIST "port_list_p"
2N/A
2N/A#define FCOE_PORT_LIST_LENGTH 255
2N/A
2N/Atypedef unsigned char FCOE_UINT8;
2N/Atypedef char FCOE_INT8;
2N/Atypedef unsigned short FCOE_UINT16;
2N/Atypedef short FCOE_INT16;
2N/Atypedef unsigned int FCOE_UINT32;
2N/Atypedef int FCOE_INT32;
2N/A
2N/Atypedef unsigned int FCOE_STATUS;
2N/A
2N/A#define FCOE_STATUS_OK 0
2N/A#define FCOE_STATUS_ERROR 1
2N/A#define FCOE_STATUS_ERROR_INVAL_ARG 2
2N/A#define FCOE_STATUS_ERROR_BUSY 3
2N/A#define FCOE_STATUS_ERROR_ALREADY 4
2N/A#define FCOE_STATUS_ERROR_PERM 5
2N/A#define FCOE_STATUS_ERROR_OPEN_DEV 6
2N/A#define FCOE_STATUS_ERROR_WWN_SAME 7
2N/A#define FCOE_STATUS_ERROR_MAC_LEN 8
2N/A#define FCOE_STATUS_ERROR_PWWN_CONFLICTED 9
2N/A#define FCOE_STATUS_ERROR_NWWN_CONFLICTED 10
2N/A#define FCOE_STATUS_ERROR_NEED_JUMBO_FRAME 11
2N/A#define FCOE_STATUS_ERROR_CREATE_MAC 12
2N/A#define FCOE_STATUS_ERROR_OPEN_MAC 13
2N/A#define FCOE_STATUS_ERROR_CREATE_PORT 14
2N/A#define FCOE_STATUS_ERROR_MAC_NOT_FOUND 15
2N/A#define FCOE_STATUS_ERROR_OFFLINE_DEV 16
2N/A#define FCOE_STATUS_ERROR_MORE_DATA 17
2N/A#define FCOE_STATUS_ERROR_CLASS_UNSUPPORT 18
2N/A#define FCOE_STATUS_ERROR_GET_LINKINFO 19
2N/A
2N/Atypedef struct fcoe_port_wwn {
2N/A uchar_t wwn[8];
2N/A} FCOE_PORT_WWN, *PFCOE_PORT_WWN;
2N/A
2N/Atypedef struct fcoe_port_attr {
2N/A FCOE_PORT_WWN port_wwn;
2N/A FCOE_UINT8 mac_link_name[MAXLINKNAMELEN];
2N/A FCOE_UINT8 mac_factory_addr[ETHERADDRL];
2N/A FCOE_UINT8 mac_current_addr[ETHERADDRL];
2N/A FCOE_UINT8 port_type;
2N/A FCOE_UINT32 mtu_size;
2N/A FCOE_UINT8 mac_promisc;
2N/A} FCOE_PORT_ATTRIBUTE, *PFCOE_PORT_ATTRIBUTE;
2N/A
2N/A/*
2N/A * FCoE port instance in smf repository
2N/A */
2N/Atypedef struct fcoe_smf_port_instance {
2N/A FCOE_UINT8 mac_link_name[MAXLINKNAMELEN];
2N/A FCOE_UINT8 port_type;
2N/A FCOE_PORT_WWN port_pwwn;
2N/A FCOE_PORT_WWN port_nwwn;
2N/A FCOE_UINT8 mac_promisc;
2N/A} FCOE_SMF_PORT_INSTANCE, *PFCOE_SMF_PORT_INSTANCE;
2N/A
2N/A/*
2N/A * FCoE port instance list
2N/A */
2N/Atypedef struct fcoe_smf_port_list {
2N/A FCOE_UINT32 port_num;
2N/A FCOE_SMF_PORT_INSTANCE ports[1];
2N/A} FCOE_SMF_PORT_LIST, *PFCOE_SMF_PORT_LIST;
2N/A
2N/A/*
2N/A * FCoE port property set
2N/A */
2N/Atypedef struct fcoe_port_prop {
2N/A FCOE_UINT32 port_pmask;
2N/A FCOE_UINT8 port_priority;
2N/A} FCOE_PORT_PROP;
2N/A
2N/A/*
2N/A * macLinkName: mac name with maximum lenth 32
2N/A * portType: 0 (Initiator)/ 1(Target)
2N/A * pwwn: Port WWN
2N/A * nwwn: Nodw WWN
2N/A * promiscous: to enable promisc mode for mac interface
2N/A */
2N/AFCOE_STATUS FCOE_CreatePort(
2N/A const FCOE_UINT8 *macLinkName, /* maximum len: 32 */
2N/A FCOE_UINT8 portType,
2N/A FCOE_PORT_WWN pwwn,
2N/A FCOE_PORT_WWN nwwn,
2N/A FCOE_UINT8 promiscusous
2N/A);
2N/A
2N/AFCOE_STATUS FCOE_DeletePort(
2N/A const FCOE_UINT8 *macLinkName
2N/A);
2N/A
2N/A/*
2N/A * Make sure to free the memory pointed by portlist
2N/A */
2N/AFCOE_STATUS FCOE_GetPortList(
2N/A FCOE_UINT32 *port_num,
2N/A FCOE_PORT_ATTRIBUTE **portlist
2N/A);
2N/A
2N/A/*
2N/A * Make sure to free the memory pointed by portlist
2N/A */
2N/AFCOE_STATUS FCOE_LoadConfig(
2N/A FCOE_UINT8 portType,
2N/A FCOE_SMF_PORT_LIST **portlist
2N/A);
2N/A
2N/A/* Sets the priority property in the structure FCOE_PORT_PROP */
2N/AFCOE_STATUS FCOE_Set_Priority(
2N/A FCOE_PORT_PROP *fpp,
2N/A FCOE_UINT8 priority
2N/A);
2N/A
2N/A/* used to set multiple FCOE port properites */
2N/AFCOE_STATUS FCOE_SetpropPort(
2N/A const FCOE_UINT8 *macLinkName,
2N/A const FCOE_PORT_PROP *
2N/A);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LIBFCOE_H */