/*
* Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
* All rights reserved
* www.brocade.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef __FC_H__
#define __FC_H__
#include <protocol/types.h>
#pragma pack(1)
/*
* Fibre Channel Header Structure (FCHS) definition
*/
struct fchs_s {
#ifdef __BIGENDIAN
u32 routing:4; /* routing bits */
u32 cat_info:4; /* category info */
#else
u32 cat_info:4; /* category info */
u32 routing:4; /* routing bits */
#endif
u32 d_id:24; /* destination identifier */
u32 cs_ctl:8; /* class specific control */
u32 s_id:24; /* source identifier */
u32 type:8; /* data structure type */
u32 f_ctl:24; /* initial frame control */
u8 seq_id; /* sequence identifier */
u8 df_ctl; /* data field control */
u16 seq_cnt; /* sequence count */
u16 ox_id; /* originator exchange ID */
u16 rx_id; /* responder exchange ID */
u32 ro; /* relative offset */
};
/*
* Fibre Channel BB_E Header Structure
*/
struct fcbbehs_s {
u16 ver_rsvd;
u32 rsvd[2];
u32 rsvd__sof;
};
#define FC_SEQ_ID_MAX 256
/*
* routing bit definitions
*/
enum {
FC_RTG_FC4_DEV_DATA = 0x0, /* FC-4 Device Data */
FC_RTG_EXT_LINK = 0x2, /* Extended Link Data */
FC_RTG_FC4_LINK_DATA = 0x3, /* FC-4 Link Data */
FC_RTG_VIDEO_DATA = 0x4, /* Video Data */
FC_RTG_EXT_HDR = 0x5, /* VFT, IFR or Encapsuled */
FC_RTG_BASIC_LINK = 0x8, /* Basic Link data */
FC_RTG_LINK_CTRL = 0xC, /* Link Control */
};
/*
* information category for extended link data and FC-4 Link Data
*/
enum {
FC_CAT_LD_REQUEST = 0x2, /* Request */
FC_CAT_LD_REPLY = 0x3, /* Reply */
FC_CAT_LD_DIAG = 0xF, /* for DIAG use only */
};
/*
* information category for extended headers (VFT, IFR or encapsulation)
*/
enum {
FC_CAT_VFT_HDR = 0x0, /* Virtual fabric tagging header */
FC_CAT_IFR_HDR = 0x1, /* Inter-Fabric routing header */
FC_CAT_ENC_HDR = 0x2, /* Encapsulation header */
};
/*
* information category for FC-4 device data
*/
enum {
FC_CAT_UNCATEG_INFO = 0x0, /* Uncategorized information */
FC_CAT_SOLICIT_DATA = 0x1, /* Solicited Data */
FC_CAT_UNSOLICIT_CTRL = 0x2, /* Unsolicited Control */
FC_CAT_SOLICIT_CTRL = 0x3, /* Solicited Control */
FC_CAT_UNSOLICIT_DATA = 0x4, /* Unsolicited Data */
FC_CAT_DATA_DESC = 0x5, /* Data Descriptor */
FC_CAT_UNSOLICIT_CMD = 0x6, /* Unsolicited Command */
FC_CAT_CMD_STATUS = 0x7, /* Command Status */
};
/*
* information category for Link Control
*/
enum {
FC_CAT_ACK_1 = 0x00,
FC_CAT_ACK_0_N = 0x01,
FC_CAT_P_RJT = 0x02,
FC_CAT_F_RJT = 0x03,
FC_CAT_P_BSY = 0x04,
FC_CAT_F_BSY_DATA = 0x05,
FC_CAT_F_BSY_LINK_CTL = 0x06,
FC_CAT_F_LCR = 0x07,
FC_CAT_NTY = 0x08,
FC_CAT_END = 0x09,
};
/*
* Type Field Definitions. FC-PH Section 18.5 pg. 165
*/
enum {
FC_TYPE_BLS = 0x0, /* Basic Link Service */
FC_TYPE_ELS = 0x1, /* Extended Link Service */
FC_TYPE_IP = 0x5, /* IP */
FC_TYPE_FCP = 0x8, /* SCSI-FCP */
FC_TYPE_GPP = 0x9, /* SCSI_GPP */
FC_TYPE_SERVICES = 0x20, /* Fibre Channel Services */
FC_TYPE_FC_FSS = 0x22, /* Fabric Switch Services */
FC_TYPE_FC_AL = 0x23, /* FC-AL */
FC_TYPE_FC_SNMP = 0x24, /* FC-SNMP */
FC_TYPE_MAX = 256, /* 256 FC-4 types */
};
struct fc_fc4types_s{
u8 bits[FC_TYPE_MAX / 8];
};
/*
* Frame Control Definitions. FC-PH Table-45. pg. 168
*/
enum {
FCTL_EC_ORIG = 0x000000, /* exchange originator */
FCTL_EC_RESP = 0x800000, /* exchange responder */
FCTL_SEQ_INI = 0x000000, /* sequence initiator */
FCTL_SEQ_REC = 0x400000, /* sequence recipient */