fcoe.h 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.
*/
/*
* The following notice accompanied the original version of this file:
*
* BSD LICENSE
*
* Copyright(c) 2007 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _FCOE_H_
#define _FCOE_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
extern int fcoe_use_ext_log;
extern struct fcoe_soft_state *fcoe_global_ss;
/*
* 2) Anything which can potentially flood the log should be under
* extended logging, and use FCOE_EXT_LOG.
* 3) Don't use FCOE_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 foce_use_ext_log in the fly to adjust
* tracing
*/
#define FCOE_EXT_LOG(log_ident, ...) \
do { \
if (fcoe_use_ext_log) { \
} \
} while (0)
/*
* There will be only one fcoe instance
*/
typedef struct fcoe_soft_state {
/*
* watchdog stuff
*/
#define SS_FLAG_TERMINATE_WATCHDOG 0x0020
#define SS_FLAG_WATCHDOG_RUNNING 0x0040
#define SS_FLAG_DOG_WAITING 0x0080
/*
* Driver name
*/
#define FCOEI_DRIVER_NAME "fcoei"
#define FCOET_DRIVER_NAME "fcoet"
/*
* One for each ethernet port
*/
typedef struct fcoe_mac
{
char fm_link_name[MAXLINKNAMELEN];
fm_rsvd:18,
fm_state:4,
} fcoe_mac_t;
#define FCOE_MAC_STATE_OFFLINE 0x0
#define FCOE_MAC_STATE_ONLINE 0x1
#define FCOE_MAC_LINK_STATE_DOWN 0x00
#define FCOE_MAC_LINK_STATE_UP 0x01
#define FCOE_MAC_FLAG_ENABLED 0x01
#define FCOE_MAC_FLAG_BOUND 0x02
typedef struct fcoe_frame_header {
typedef struct fcoe_frame_tailer {
/*
* RAW frame structure
* It is used to describe the content of every mblk
*/
typedef struct fcoe_i_frame {
/*
* FRAME structure
*/
typedef struct fcoe_worker {
#define FCOE_WORKER_TERMINATE 0x01
#define FCOE_WORKER_STARTED 0x02
#define FCOE_WORKER_ACTIVE 0x04
/*
* IOCTL supporting stuff
*/
#define FCOE_IOCTL_FLAG_MASK 0xFF
#define FCOE_IOCTL_FLAG_IDLE 0x00
#define FCOE_IOCTL_FLAG_OPEN 0x01
#define FCOE_IOCTL_FLAG_EXCL 0x02
#define FCOE_IOCTL_FLAG_EXCL_BUSY 0x04
/*
* define common-used macros to simplify coding
*/
#define FCOE_FIP_TYPE 0x8914
#define FCOE_802_1Q_TAG 0x8100
#define PADDING_HEADER_SIZE (sizeof (struct ether_header) + \
sizeof (fcoe_frame_header_t))
#define FCOE_VER 0
{ \
}
/*
* fcoe driver common functions
*/
extern void fcoe_destroy_mac(fcoe_mac_t *);
extern void fcoe_post_frame(fcoe_frame_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _FCOE_H_ */