fcoe_common.h revision d3d50737e566cade9a08d73d2af95105ac7cd960
/*
* 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.
*/
#ifndef _FCOE_COMMON_H_
#define _FCOE_COMMON_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
/*
* Interface return value
*/
#define FCOE_SUCCESS 0
#define FCOE_FAILURE -1
#define FCOE_BUSY -2
#define FCOE_NOT_SUPPORTED -3
#define FCOE_BAD_FRAME -4
/*
* FCOE port speed
*/
#define FCOE_PORT_SPEED_1G 1000000000
#define FCOE_PORT_SPEED_10G 10000000000
/*
* FC Frame header size: 24 bytes
*/
#define FCFH_SIZE (sizeof (fcoe_fc_frame_header_t))
/*
* FLOGI
*/
#define FLOGI_REQ_PAYLOAD_SIZE 116
#define FLOGI_ACC_PAYLOAD_SIZE 116
#define FCOE_MIN_MTU_SIZE 2500
#define FCOE_MAX_FC_FRAME_SIZE 2136
/*
* 24 byte FC frame header
* For all data structures that have endian problems, we will use only
* one type: uint8_t. We need associate the data structure pointer with
* one buffer directly.
*/
typedef struct fcoe_fc_frame_header {
/*
*/
struct fcoe_port;
typedef struct fcoe_frame {
void *frm_netb;
/*
* frm_hdr will be cleared by fcoe explicitly
*/
/*
* fcoe client need clear FC payload explicitly,
*/
void *frm_fcoe_private;
void *frm_client_private;
} fcoe_frame_t;
/*
* FCOE HBA
*/
typedef struct fcoe_port {
void *eport_fcoe_private;
void *eport_client_private;
void (*eport_free_netb)(void *netb);
} fcoe_port_t;
/*
* FCOE only supports two kinds of topology: direct P2P, fabric P2P.
*/
#define EPORT_FLAG_IS_DIRECT_P2P 0x01
#define EPORT_FLAG_TGT_MODE 0x02
#define EPORT_FLAG_INI_MODE 0x04
#define EPORT_FLAG_MAC_IN_USE 0x08
#define FCOE_NOTIFY_EPORT_LINK_UP 0x01
#define FCOE_NOTIFY_EPORT_LINK_DOWN 0x02
#define FCOE_NOTIFY_EPORT_ADDR_CHG 0x03
#define FCOE_PORT_CTL_CMDS 0x3000
/*
* FCoE version control
*/
typedef enum fcoe_ver
{
FCOE_VER_1 = 0xAA01,
} fcoe_ver_e;
#define FCOE_VER_NOW FCOE_VER_1
extern const fcoe_ver_e fcoe_ver_now;
typedef struct fcoe_client {
void *ect_client_port_struct;
/*
* Define common-used conversion or calculation macros
*/
{ \
}
{ \
}
{ \
}
{ \
}
{ \
}
#define FCOE_B2V_1(x_b) \
#define FCOE_B2V_2(x_b) \
#define FCOE_B2V_3(x_b) \
#define FCOE_B2V_4(x_b) \
#define FCOE_B2V_8(x_b) \
/*
* Get FC frame header's element
*/
/*
* Set FC frame header's element
*/
/*
* frame header checking
*/
/*
* should be called through vectors in struct fcoe_port.
* FCOE client call this to register one port to FCOE, FCOE need initialize
* and return the corresponding fcoe_port.
*/
#define EPORT_CLT_TYPE(eport) \
#define FCOE_SET_DEFAULT_OUI(x_oui) \
#define FCOE_SET_DEFAULT_FPORT_ADDR(x_addr) \
/*
* FC payload size
*/
#define FCOE_DEFAULT_FCP_DATA_PAYLOAD_SIZE 2048
#define FCOE_MIN_FCP_DATA_PAYLOAD_SIZE 1024
typedef struct fcoe_fcp_cmnd {
/*
* least 3 bits
*/
/*
* Magnagement flags
*/
/*
*/
typedef struct fcoe_fcp_rsp {
/*
* see SAM-4
*/
/*
* Followed by sense data when available
*/
typedef struct fcoe_fcp_xfer_rdy {
/*
* FCOE project global functions
*/
#if !defined(__FUNCTION__)
#endif
#define FCOE_STR_LEN 32
/*
*/
#define CURRENT_CLOCK (ddi_get_lbolt())
/*
*/
typedef void (*TQ_FUNC_P)(void *);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _FCOE_COMMON_H_ */