fcoet.h revision 7ff836697c120cb94bd30d5c2204eb9b74718e4c
/*
* 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 _FCOET_H
#define _FCOET_H
#include <sys/stmf_defines.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#define FCOET_VERSION "v20090729-1.01"
#define FCOET_NAME "COMSTAR FCoET "
/*
* FCOET logging
*/
extern int fcoet_use_ext_log;
/*
* 2) Anything which can potentially flood the log should be under
* extended logging, and use FCOET_EXT_LOG.
* 3) Don't use FCOET_EXT_LOG in performance-critical code path, such
* as normal SCSI I/O code path. It could hurt system performance.
* 4) Use kmdb to change focet_use_ext_log in the fly to adjust
* tracing
*/
#define FCOET_EXT_LOG(log_ident, ...) \
{ \
if (fcoet_use_ext_log) { \
} \
}
/*
* define common-used constants
*/
#define FCOET_MAX_LOGINS 2048
#define FCOET_MAX_XCHGES 2048
#define FCOET_SOL_HASH_SIZE 128
#define FCOET_UNSOL_HASH_SIZE 2048
typedef enum fcoet_sol_flogi_state {
SFS_WAIT_LINKUP = 0,
/*
* define data structures
*/
struct fcoet_exchange;
typedef struct fcoet_soft_state {
/*
* basic information
*/
int ss_instance;
char ss_alias[32];
/*
* support degregister remote port
*/
/*
*/
/*
* watch thread related stuff
*/
/*
* topology discovery
*/
struct fcoet_exchange *ss_sol_flogi;
/*
* ioctl related stuff
*/
/*
* special stuff
*/
#define SS_FLAG_UNSOL_FLOGI_DONE 0x0001
#define SS_FLAG_REPORT_TO_FCT 0x0002
#define SS_FLAG_PORT_DISABLED 0x0004
#define SS_FLAG_STOP_WATCH 0x0008
#define SS_FLAG_TERMINATE_WATCHDOG 0x0010
#define SS_FLAG_WATCHDOG_RUNNING 0x0020
#define SS_FLAG_DOG_WAITING 0x0040
#define SS_FLAG_DELAY_PLOGI 0x0080
/*
* Sequence and frame are transient objects, so their definition is simple.
*/
/*
* Sequence.
* we will not use sequence in current implementation
*/
typedef struct fcoet_sequence {
struct fcoet_exchange *seq_exchange;
/*
* Frame
*/
typedef struct fcoet_frame {
struct fcoet_exchange *tfm_xch;
struct fcoet_sequence *tfm_seq;
/*
* FCOET_MAX_DBUF_LEN should better be consistent with sbd_scsi.c. Since
* sbd_scsi.c use 128k as the max dbuf size, we'd better define this between
* 32k - 128k.
*/
/*
* exchange - cmd alias
*/
typedef struct fcoet_exchange {
/*
* it is only used for ss_abort_xchg_list
*/
/*
*/
int xch_left_data_size;
/*
* Add the reference to avoid such situation:
* 1, Frame received, then abort happen (maybe because local port offline, or
* remote port abort the cmd), cmd is aborted and then freed right after we
* get the exchange from hash table in fcoet_rx_frame.
* 2, Frame sent out, then queued in fcoe for release. then abort happen, cmd
* is aborted and then freed before fcoe_watchdog() call up to release the
* frame.
* These two situation should seldom happen. But just invoke this seems won't
* downgrade the performance too much, so we keep it.
*/
#define XCH_FLAG_NONFCP_REQ_SENT 0x0001
#define XCH_FLAG_NONFCP_RESP_SENT 0x0002
#define XCH_FLAG_FCP_CMD_RCVD 0x0004
#define XCH_FLAG_INI_ASKED_ABORT 0x0008
#define XCH_FLAG_FCT_CALLED_ABORT 0x0010
#define XCH_FLAG_IN_HASH_TABLE 0x0020
/*
* IOCTL supporting stuff
*/
#define FCOET_IOCTL_FLAG_MASK 0xFF
#define FCOET_IOCTL_FLAG_IDLE 0x00
#define FCOET_IOCTL_FLAG_OPEN 0x01
#define FCOET_IOCTL_FLAG_EXCL 0x02
/*
* define common-used conversion and calculation macros
*/
/*
* DBUF stuff
*/
#define FCOET_DB_NETB(x_db) \
{ \
}
{ \
}
{ \
}
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _FCOET_H */