-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SCSI] FC protocol definition header files
Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
- Loading branch information
Robert Love
authored and
James Bottomley
committed
Dec 29, 2008
1 parent
21465ed
commit f032c2f
Showing
8 changed files
with
1,983 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/* | ||
* Copyright(c) 2007 Intel Corporation. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope 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. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Maintained at www.Open-FCoE.org | ||
*/ | ||
#ifndef _FC_ENCAPS_H_ | ||
#define _FC_ENCAPS_H_ | ||
|
||
/* | ||
* Protocol definitions from RFC 3643 - Fibre Channel Frame Encapsulation. | ||
* | ||
* Note: The frame length field is the number of 32-bit words in | ||
* the encapsulation including the fcip_encaps_header, CRC and EOF words. | ||
* The minimum frame length value in bytes is (32 + 24 + 4 + 4) * 4 = 64. | ||
* The maximum frame length value in bytes is (32 + 24 + 2112 + 4 + 4) = 2172. | ||
*/ | ||
#define FC_ENCAPS_MIN_FRAME_LEN 64 /* min frame len (bytes) (see above) */ | ||
#define FC_ENCAPS_MAX_FRAME_LEN (FC_ENCAPS_MIN_FRAME_LEN + FC_MAX_PAYLOAD) | ||
|
||
#define FC_ENCAPS_VER 1 /* current version number */ | ||
|
||
struct fc_encaps_hdr { | ||
__u8 fc_proto; /* protocol number */ | ||
__u8 fc_ver; /* version of encapsulation */ | ||
__u8 fc_proto_n; /* ones complement of protocol */ | ||
__u8 fc_ver_n; /* ones complement of version */ | ||
|
||
unsigned char fc_proto_data[8]; /* protocol specific data */ | ||
|
||
__be16 fc_len_flags; /* 10-bit length/4 w/ 6 flag bits */ | ||
__be16 fc_len_flags_n; /* ones complement of length / flags */ | ||
|
||
/* | ||
* Offset 0x10 | ||
*/ | ||
__be32 fc_time[2]; /* time stamp: seconds and fraction */ | ||
__be32 fc_crc; /* CRC */ | ||
__be32 fc_sof; /* start of frame (see FC_SOF below) */ | ||
|
||
/* 0x20 - FC frame content followed by EOF word */ | ||
}; | ||
|
||
#define FCIP_ENCAPS_HDR_LEN 0x20 /* expected length for asserts */ | ||
|
||
/* | ||
* Macro's for making redundant copies of EOF and SOF. | ||
*/ | ||
#define FC_XY(x, y) ((((x) & 0xff) << 8) | ((y) & 0xff)) | ||
#define FC_XYXY(x, y) ((FCIP_XY(x, y) << 16) | FCIP_XY(x, y)) | ||
#define FC_XYNN(x, y) (FCIP_XYXY(x, y) ^ 0xffff) | ||
|
||
#define FC_SOF_ENCODE(n) FC_XYNN(n, n) | ||
#define FC_EOF_ENCODE(n) FC_XYNN(n, n) | ||
|
||
/* | ||
* SOF / EOF bytes. | ||
*/ | ||
enum fc_sof { | ||
FC_SOF_F = 0x28, /* fabric */ | ||
FC_SOF_I4 = 0x29, /* initiate class 4 */ | ||
FC_SOF_I2 = 0x2d, /* initiate class 2 */ | ||
FC_SOF_I3 = 0x2e, /* initiate class 3 */ | ||
FC_SOF_N4 = 0x31, /* normal class 4 */ | ||
FC_SOF_N2 = 0x35, /* normal class 2 */ | ||
FC_SOF_N3 = 0x36, /* normal class 3 */ | ||
FC_SOF_C4 = 0x39, /* activate class 4 */ | ||
} __attribute__((packed)); | ||
|
||
enum fc_eof { | ||
FC_EOF_N = 0x41, /* normal (not last frame of seq) */ | ||
FC_EOF_T = 0x42, /* terminate (last frame of sequence) */ | ||
FC_EOF_RT = 0x44, | ||
FC_EOF_DT = 0x46, /* disconnect-terminate class-1 */ | ||
FC_EOF_NI = 0x49, /* normal-invalid */ | ||
FC_EOF_DTI = 0x4e, /* disconnect-terminate-invalid */ | ||
FC_EOF_RTI = 0x4f, | ||
FC_EOF_A = 0x50, /* abort */ | ||
} __attribute__((packed)); | ||
|
||
#define FC_SOF_CLASS_MASK 0x06 /* mask for class of service in SOF */ | ||
|
||
/* | ||
* Define classes in terms of the SOF code (initial). | ||
*/ | ||
enum fc_class { | ||
FC_CLASS_NONE = 0, /* software value indicating no class */ | ||
FC_CLASS_2 = FC_SOF_I2, | ||
FC_CLASS_3 = FC_SOF_I3, | ||
FC_CLASS_4 = FC_SOF_I4, | ||
FC_CLASS_F = FC_SOF_F, | ||
}; | ||
|
||
/* | ||
* Determine whether SOF code indicates the need for a BLS ACK. | ||
*/ | ||
static inline int fc_sof_needs_ack(enum fc_sof sof) | ||
{ | ||
return (~sof) & 0x02; /* true for class 1, 2, 4, 6, or F */ | ||
} | ||
|
||
/* | ||
* Given an fc_class, return the normal (non-initial) SOF value. | ||
*/ | ||
static inline enum fc_sof fc_sof_normal(enum fc_class class) | ||
{ | ||
return class + FC_SOF_N3 - FC_SOF_I3; /* diff is always 8 */ | ||
} | ||
|
||
/* | ||
* Compute class from SOF value. | ||
*/ | ||
static inline enum fc_class fc_sof_class(enum fc_sof sof) | ||
{ | ||
return (sof & 0x7) | FC_SOF_F; | ||
} | ||
|
||
/* | ||
* Determine whether SOF is for the initial frame of a sequence. | ||
*/ | ||
static inline int fc_sof_is_init(enum fc_sof sof) | ||
{ | ||
return sof < 0x30; | ||
} | ||
|
||
#endif /* _FC_ENCAPS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* | ||
* Copyright(c) 2007 Intel Corporation. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope 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. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Maintained at www.Open-FCoE.org | ||
*/ | ||
|
||
#ifndef _FC_FC2_H_ | ||
#define _FC_FC2_H_ | ||
|
||
/* | ||
* Fibre Channel Exchanges and Sequences. | ||
*/ | ||
#ifndef PACKED | ||
#define PACKED __attribute__ ((__packed__)) | ||
#endif /* PACKED */ | ||
|
||
|
||
/* | ||
* Sequence Status Block. | ||
* This format is set by the FC-FS standard and is sent over the wire. | ||
* Note that the fields aren't all naturally aligned. | ||
*/ | ||
struct fc_ssb { | ||
__u8 ssb_seq_id; /* sequence ID */ | ||
__u8 _ssb_resvd; | ||
__be16 ssb_low_seq_cnt; /* lowest SEQ_CNT */ | ||
|
||
__be16 ssb_high_seq_cnt; /* highest SEQ_CNT */ | ||
__be16 ssb_s_stat; /* sequence status flags */ | ||
|
||
__be16 ssb_err_seq_cnt; /* error SEQ_CNT */ | ||
__u8 ssb_fh_cs_ctl; /* frame header CS_CTL */ | ||
__be16 ssb_fh_ox_id; /* frame header OX_ID */ | ||
__be16 ssb_rx_id; /* responder's exchange ID */ | ||
__u8 _ssb_resvd2[2]; | ||
} PACKED; | ||
|
||
/* | ||
* The SSB should be 17 bytes. Since it's layout is somewhat strange, | ||
* we define the size here so that code can ASSERT that the size comes out | ||
* correct. | ||
*/ | ||
#define FC_SSB_SIZE 17 /* length of fc_ssb for assert */ | ||
|
||
/* | ||
* ssb_s_stat - flags from FC-FS-2 T11/1619-D Rev 0.90. | ||
*/ | ||
#define SSB_ST_RESP (1 << 15) /* sequence responder */ | ||
#define SSB_ST_ACTIVE (1 << 14) /* sequence is active */ | ||
#define SSB_ST_ABNORMAL (1 << 12) /* abnormal ending condition */ | ||
|
||
#define SSB_ST_REQ_MASK (3 << 10) /* ACK, abort sequence condition */ | ||
#define SSB_ST_REQ_CONT (0 << 10) | ||
#define SSB_ST_REQ_ABORT (1 << 10) | ||
#define SSB_ST_REQ_STOP (2 << 10) | ||
#define SSB_ST_REQ_RETRANS (3 << 10) | ||
|
||
#define SSB_ST_ABTS (1 << 9) /* ABTS protocol completed */ | ||
#define SSB_ST_RETRANS (1 << 8) /* retransmission completed */ | ||
#define SSB_ST_TIMEOUT (1 << 7) /* sequence timed out by recipient */ | ||
#define SSB_ST_P_RJT (1 << 6) /* P_RJT transmitted */ | ||
|
||
#define SSB_ST_CLASS_BIT 4 /* class of service field LSB */ | ||
#define SSB_ST_CLASS_MASK 3 /* class of service mask */ | ||
#define SSB_ST_ACK (1 << 3) /* ACK (EOFt or EOFdt) transmitted */ | ||
|
||
/* | ||
* Exchange Status Block. | ||
* This format is set by the FC-FS standard and is sent over the wire. | ||
* Note that the fields aren't all naturally aligned. | ||
*/ | ||
struct fc_esb { | ||
__u8 esb_cs_ctl; /* CS_CTL for frame header */ | ||
__be16 esb_ox_id; /* originator exchange ID */ | ||
__be16 esb_rx_id; /* responder exchange ID */ | ||
__be32 esb_orig_fid; /* fabric ID of originator */ | ||
__be32 esb_resp_fid; /* fabric ID of responder */ | ||
__be32 esb_e_stat; /* status */ | ||
__u8 _esb_resvd[4]; | ||
__u8 esb_service_params[112]; /* TBD */ | ||
__u8 esb_seq_status[8]; /* sequence statuses, 8 bytes each */ | ||
} __attribute__((packed));; | ||
|
||
|
||
/* | ||
* Define expected size for ASSERTs. | ||
* See comments on FC_SSB_SIZE. | ||
*/ | ||
#define FC_ESB_SIZE (1 + 5*4 + 112 + 8) /* expected size */ | ||
|
||
/* | ||
* esb_e_stat - flags from FC-FS-2 T11/1619-D Rev 0.90. | ||
*/ | ||
#define ESB_ST_RESP (1 << 31) /* responder to exchange */ | ||
#define ESB_ST_SEQ_INIT (1 << 30) /* port holds sequence initiaive */ | ||
#define ESB_ST_COMPLETE (1 << 29) /* exchange is complete */ | ||
#define ESB_ST_ABNORMAL (1 << 28) /* abnormal ending condition */ | ||
#define ESB_ST_REC_QUAL (1 << 26) /* recovery qualifier active */ | ||
|
||
#define ESB_ST_ERRP_BIT 24 /* LSB for error policy */ | ||
#define ESB_ST_ERRP_MASK (3 << 24) /* mask for error policy */ | ||
#define ESB_ST_ERRP_MULT (0 << 24) /* abort, discard multiple sequences */ | ||
#define ESB_ST_ERRP_SING (1 << 24) /* abort, discard single sequence */ | ||
#define ESB_ST_ERRP_INF (2 << 24) /* process with infinite buffers */ | ||
#define ESB_ST_ERRP_IMM (3 << 24) /* discard mult. with immed. retran. */ | ||
|
||
#define ESB_ST_OX_ID_INVL (1 << 23) /* originator XID invalid */ | ||
#define ESB_ST_RX_ID_INVL (1 << 22) /* responder XID invalid */ | ||
#define ESB_ST_PRI_INUSE (1 << 21) /* priority / preemption in use */ | ||
|
||
#endif /* _FC_FC2_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
* Copyright(c) 2007 Intel Corporation. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope 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. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Maintained at www.Open-FCoE.org | ||
*/ | ||
|
||
#ifndef _FC_FCOE_H_ | ||
#define _FC_FCOE_H_ | ||
|
||
/* | ||
* FCoE - Fibre Channel over Ethernet. | ||
*/ | ||
|
||
/* | ||
* The FCoE ethertype eventually goes in net/if_ether.h. | ||
*/ | ||
#ifndef ETH_P_FCOE | ||
#define ETH_P_FCOE 0x8906 /* FCOE ether type */ | ||
#endif | ||
|
||
#ifndef ETH_P_8021Q | ||
#define ETH_P_8021Q 0x8100 | ||
#endif | ||
|
||
/* | ||
* FC_FCOE_OUI hasn't been standardized yet. XXX TBD. | ||
*/ | ||
#ifndef FC_FCOE_OUI | ||
#define FC_FCOE_OUI 0x0efc00 /* upper 24 bits of FCOE dest MAC TBD */ | ||
#endif | ||
|
||
/* | ||
* The destination MAC address for the fabric login may get a different OUI. | ||
* This isn't standardized yet. | ||
*/ | ||
#ifndef FC_FCOE_FLOGI_MAC | ||
/* gateway MAC - TBD */ | ||
#define FC_FCOE_FLOGI_MAC { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe } | ||
#endif | ||
|
||
#define FC_FCOE_VER 0 /* version */ | ||
|
||
/* | ||
* Ethernet Addresses based on FC S_ID and D_ID. | ||
* Generated by FC_FCOE_OUI | S_ID/D_ID | ||
*/ | ||
#define FC_FCOE_ENCAPS_ID(n) (((u64) FC_FCOE_OUI << 24) | (n)) | ||
#define FC_FCOE_DECAPS_ID(n) ((n) >> 24) | ||
|
||
/* | ||
* FCoE frame header - 14 bytes | ||
* | ||
* This is the August 2007 version of the FCoE header as defined by T11. | ||
* This follows the VLAN header, which includes the ethertype. | ||
*/ | ||
struct fcoe_hdr { | ||
__u8 fcoe_ver; /* version field - upper 4 bits */ | ||
__u8 fcoe_resvd[12]; /* reserved - send zero and ignore */ | ||
__u8 fcoe_sof; /* start of frame per RFC 3643 */ | ||
}; | ||
|
||
#define FC_FCOE_DECAPS_VER(hp) ((hp)->fcoe_ver >> 4) | ||
#define FC_FCOE_ENCAPS_VER(hp, ver) ((hp)->fcoe_ver = (ver) << 4) | ||
|
||
/* | ||
* FCoE CRC & EOF - 8 bytes. | ||
*/ | ||
struct fcoe_crc_eof { | ||
__le32 fcoe_crc32; /* CRC for FC packet */ | ||
__u8 fcoe_eof; /* EOF from RFC 3643 */ | ||
__u8 fcoe_resvd[3]; /* reserved - send zero and ignore */ | ||
} __attribute__((packed)); | ||
|
||
/* | ||
* Minimum FCoE + FC header length | ||
* 14 bytes FCoE header + 24 byte FC header = 38 bytes | ||
*/ | ||
#define FCOE_HEADER_LEN 38 | ||
|
||
/* | ||
* Minimum FCoE frame size | ||
* 14 bytes FCoE header + 24 byte FC header + 8 byte FCoE trailer = 46 bytes | ||
*/ | ||
#define FCOE_MIN_FRAME 46 | ||
|
||
/* | ||
* fc_fcoe_set_mac - Store OUI + DID into MAC address field. | ||
* @mac: mac address to be set | ||
* @did: fc dest id to use | ||
*/ | ||
static inline void fc_fcoe_set_mac(u8 *mac, u8 *did) | ||
{ | ||
mac[0] = (u8) (FC_FCOE_OUI >> 16); | ||
mac[1] = (u8) (FC_FCOE_OUI >> 8); | ||
mac[2] = (u8) FC_FCOE_OUI; | ||
mac[3] = did[0]; | ||
mac[4] = did[1]; | ||
mac[5] = did[2]; | ||
} | ||
|
||
#endif /* _FC_FCOE_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
/* | ||
* Copyright(c) 2007 Intel Corporation. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope 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. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Maintained at www.Open-FCoE.org | ||
*/ | ||
|
||
#ifndef _FC_FCP_H_ | ||
#define _FC_FCP_H_ | ||
|
||
/* | ||
* Fibre Channel Protocol for SCSI. | ||
* From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005. | ||
*/ | ||
|
||
/* | ||
* fc/fs.h defines FC_TYPE_FCP. | ||
*/ | ||
|
||
/* | ||
* Service parameter page parameters (word 3 bits) for Process Login. | ||
*/ | ||
#define FCP_SPPF_TASK_RETRY_ID 0x0200 /* task retry ID requested */ | ||
#define FCP_SPPF_RETRY 0x0100 /* retry supported */ | ||
#define FCP_SPPF_CONF_COMPL 0x0080 /* confirmed completion allowed */ | ||
#define FCP_SPPF_OVLY_ALLOW 0x0040 /* data overlay allowed */ | ||
#define FCP_SPPF_INIT_FCN 0x0020 /* initiator function */ | ||
#define FCP_SPPF_TARG_FCN 0x0010 /* target function */ | ||
#define FCP_SPPF_RD_XRDY_DIS 0x0002 /* disable XFER_RDY for reads */ | ||
#define FCP_SPPF_WR_XRDY_DIS 0x0001 /* disable XFER_RDY for writes */ | ||
|
||
/* | ||
* FCP_CMND IU Payload. | ||
*/ | ||
struct fcp_cmnd { | ||
__u8 fc_lun[8]; /* logical unit number */ | ||
__u8 fc_cmdref; /* commmand reference number */ | ||
__u8 fc_pri_ta; /* priority and task attribute */ | ||
__u8 fc_tm_flags; /* task management flags */ | ||
__u8 fc_flags; /* additional len & flags */ | ||
__u8 fc_cdb[16]; /* base CDB */ | ||
__be32 fc_dl; /* data length (must follow fc_cdb) */ | ||
}; | ||
|
||
#define FCP_CMND_LEN 32 /* expected length of structure */ | ||
|
||
struct fcp_cmnd32 { | ||
__u8 fc_lun[8]; /* logical unit number */ | ||
__u8 fc_cmdref; /* commmand reference number */ | ||
__u8 fc_pri_ta; /* priority and task attribute */ | ||
__u8 fc_tm_flags; /* task management flags */ | ||
__u8 fc_flags; /* additional len & flags */ | ||
__u8 fc_cdb[32]; /* base CDB */ | ||
__be32 fc_dl; /* data length (must follow fc_cdb) */ | ||
}; | ||
|
||
#define FCP_CMND32_LEN 48 /* expected length of structure */ | ||
#define FCP_CMND32_ADD_LEN (16 / 4) /* Additional cdb length */ | ||
|
||
/* | ||
* fc_pri_ta. | ||
*/ | ||
#define FCP_PTA_SIMPLE 0 /* simple task attribute */ | ||
#define FCP_PTA_HEADQ 1 /* head of queue task attribute */ | ||
#define FCP_PTA_ORDERED 2 /* ordered task attribute */ | ||
#define FCP_PTA_ACA 4 /* auto. contigent allegiance */ | ||
#define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */ | ||
#define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */ | ||
|
||
/* | ||
* fc_tm_flags - task management flags field. | ||
*/ | ||
#define FCP_TMF_CLR_ACA 0x40 /* clear ACA condition */ | ||
#define FCP_TMF_LUN_RESET 0x10 /* logical unit reset task management */ | ||
#define FCP_TMF_CLR_TASK_SET 0x04 /* clear task set */ | ||
#define FCP_TMF_ABT_TASK_SET 0x02 /* abort task set */ | ||
|
||
/* | ||
* fc_flags. | ||
* Bits 7:2 are the additional FCP_CDB length / 4. | ||
*/ | ||
#define FCP_CFL_LEN_MASK 0xfc /* mask for additional length */ | ||
#define FCP_CFL_LEN_SHIFT 2 /* shift bits for additional length */ | ||
#define FCP_CFL_RDDATA 0x02 /* read data */ | ||
#define FCP_CFL_WRDATA 0x01 /* write data */ | ||
|
||
/* | ||
* FCP_TXRDY IU - transfer ready payload. | ||
*/ | ||
struct fcp_txrdy { | ||
__be32 ft_data_ro; /* data relative offset */ | ||
__be32 ft_burst_len; /* burst length */ | ||
__u8 _ft_resvd[4]; /* reserved */ | ||
}; | ||
|
||
#define FCP_TXRDY_LEN 12 /* expected length of structure */ | ||
|
||
/* | ||
* FCP_RESP IU - response payload. | ||
* | ||
* The response payload comes in three parts: the flags/status, the | ||
* sense/response lengths and the sense data/response info section. | ||
* | ||
* From FCP3r04, note 6 of section 9.5.13: | ||
* | ||
* Some early implementations presented the FCP_RSP IU without the FCP_RESID, | ||
* FCP_SNS_LEN, and FCP_RSP_LEN fields if the FCP_RESID_UNDER, FCP_RESID_OVER, | ||
* FCP_SNS_LEN_VALID, and FCP_RSP_LEN_VALID bits were all set to zero. This | ||
* non-standard behavior should be tolerated. | ||
* | ||
* All response frames will always contain the fcp_resp template. Some | ||
* will also include the fcp_resp_len template. | ||
*/ | ||
struct fcp_resp { | ||
__u8 _fr_resvd[8]; /* reserved */ | ||
__be16 fr_retry_delay; /* retry delay timer */ | ||
__u8 fr_flags; /* flags */ | ||
__u8 fr_status; /* SCSI status code */ | ||
}; | ||
|
||
#define FCP_RESP_LEN 12 /* expected length of structure */ | ||
|
||
struct fcp_resp_ext { | ||
__be32 fr_resid; /* Residual value */ | ||
__be32 fr_sns_len; /* SCSI Sense length */ | ||
__be32 fr_rsp_len; /* Response Info length */ | ||
|
||
/* | ||
* Optionally followed by RSP info and/or SNS info and/or | ||
* bidirectional read residual length, if any. | ||
*/ | ||
}; | ||
|
||
#define FCP_RESP_EXT_LEN 12 /* expected length of the structure */ | ||
|
||
struct fcp_resp_rsp_info { | ||
__u8 _fr_resvd[3]; /* reserved */ | ||
__u8 rsp_code; /* Response Info Code */ | ||
__u8 _fr_resvd2[4]; /* reserved */ | ||
}; | ||
|
||
struct fcp_resp_with_ext { | ||
struct fcp_resp resp; | ||
struct fcp_resp_ext ext; | ||
}; | ||
|
||
#define FCP_RESP_WITH_EXT (FCP_RESP_LEN + FCP_RESP_EXT_LEN) | ||
|
||
/* | ||
* fr_flags. | ||
*/ | ||
#define FCP_BIDI_RSP 0x80 /* bidirectional read response */ | ||
#define FCP_BIDI_READ_UNDER 0x40 /* bidir. read less than requested */ | ||
#define FCP_BIDI_READ_OVER 0x20 /* DL insufficient for full transfer */ | ||
#define FCP_CONF_REQ 0x10 /* confirmation requested */ | ||
#define FCP_RESID_UNDER 0x08 /* transfer shorter than expected */ | ||
#define FCP_RESID_OVER 0x04 /* DL insufficient for full transfer */ | ||
#define FCP_SNS_LEN_VAL 0x02 /* SNS_LEN field is valid */ | ||
#define FCP_RSP_LEN_VAL 0x01 /* RSP_LEN field is valid */ | ||
|
||
/* | ||
* rsp_codes | ||
*/ | ||
enum fcp_resp_rsp_codes { | ||
FCP_TMF_CMPL = 0, | ||
FCP_DATA_LEN_INVALID = 1, | ||
FCP_CMND_FIELDS_INVALID = 2, | ||
FCP_DATA_PARAM_MISMATCH = 3, | ||
FCP_TMF_REJECTED = 4, | ||
FCP_TMF_FAILED = 5, | ||
FCP_TMF_INVALID_LUN = 9, | ||
}; | ||
|
||
/* | ||
* FCP SRR Link Service request - Sequence Retransmission Request. | ||
*/ | ||
struct fcp_srr { | ||
__u8 srr_op; /* opcode ELS_SRR */ | ||
__u8 srr_resvd[3]; /* opcode / reserved - must be zero */ | ||
__be16 srr_ox_id; /* OX_ID of failed command */ | ||
__be16 srr_rx_id; /* RX_ID of failed command */ | ||
__be32 srr_rel_off; /* relative offset */ | ||
__u8 srr_r_ctl; /* r_ctl for the information unit */ | ||
__u8 srr_resvd2[3]; /* reserved */ | ||
}; | ||
|
||
#endif /* _FC_FCP_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,340 @@ | ||
/* | ||
* Copyright(c) 2007 Intel Corporation. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope 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. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Maintained at www.Open-FCoE.org | ||
*/ | ||
|
||
#ifndef _FC_FS_H_ | ||
#define _FC_FS_H_ | ||
|
||
/* | ||
* Fibre Channel Framing and Signalling definitions. | ||
* From T11 FC-FS-2 Rev 0.90 - 9 August 2005. | ||
*/ | ||
|
||
/* | ||
* Frame header | ||
*/ | ||
struct fc_frame_header { | ||
__u8 fh_r_ctl; /* routing control */ | ||
__u8 fh_d_id[3]; /* Destination ID */ | ||
|
||
__u8 fh_cs_ctl; /* class of service control / pri */ | ||
__u8 fh_s_id[3]; /* Source ID */ | ||
|
||
__u8 fh_type; /* see enum fc_fh_type below */ | ||
__u8 fh_f_ctl[3]; /* frame control */ | ||
|
||
__u8 fh_seq_id; /* sequence ID */ | ||
__u8 fh_df_ctl; /* data field control */ | ||
__be16 fh_seq_cnt; /* sequence count */ | ||
|
||
__be16 fh_ox_id; /* originator exchange ID */ | ||
__be16 fh_rx_id; /* responder exchange ID */ | ||
__be32 fh_parm_offset; /* parameter or relative offset */ | ||
}; | ||
|
||
#define FC_FRAME_HEADER_LEN 24 /* expected length of structure */ | ||
|
||
#define FC_MAX_PAYLOAD 2112U /* max payload length in bytes */ | ||
#define FC_MIN_MAX_PAYLOAD 256U /* lower limit on max payload */ | ||
|
||
#define FC_MAX_FRAME (FC_MAX_PAYLOAD + FC_FRAME_HEADER_LEN) | ||
#define FC_MIN_MAX_FRAME (FC_MIN_MAX_PAYLOAD + FC_FRAME_HEADER_LEN) | ||
|
||
/* | ||
* fh_r_ctl - Routing control definitions. | ||
*/ | ||
/* | ||
* FC-4 device_data. | ||
*/ | ||
enum fc_rctl { | ||
FC_RCTL_DD_UNCAT = 0x00, /* uncategorized information */ | ||
FC_RCTL_DD_SOL_DATA = 0x01, /* solicited data */ | ||
FC_RCTL_DD_UNSOL_CTL = 0x02, /* unsolicited control */ | ||
FC_RCTL_DD_SOL_CTL = 0x03, /* solicited control or reply */ | ||
FC_RCTL_DD_UNSOL_DATA = 0x04, /* unsolicited data */ | ||
FC_RCTL_DD_DATA_DESC = 0x05, /* data descriptor */ | ||
FC_RCTL_DD_UNSOL_CMD = 0x06, /* unsolicited command */ | ||
FC_RCTL_DD_CMD_STATUS = 0x07, /* command status */ | ||
|
||
#define FC_RCTL_ILS_REQ FC_RCTL_DD_UNSOL_CTL /* ILS request */ | ||
#define FC_RCTL_ILS_REP FC_RCTL_DD_SOL_CTL /* ILS reply */ | ||
|
||
/* | ||
* Extended Link_Data | ||
*/ | ||
FC_RCTL_ELS_REQ = 0x22, /* extended link services request */ | ||
FC_RCTL_ELS_REP = 0x23, /* extended link services reply */ | ||
FC_RCTL_ELS4_REQ = 0x32, /* FC-4 ELS request */ | ||
FC_RCTL_ELS4_REP = 0x33, /* FC-4 ELS reply */ | ||
/* | ||
* Optional Extended Headers | ||
*/ | ||
FC_RCTL_VFTH = 0x50, /* virtual fabric tagging header */ | ||
FC_RCTL_IFRH = 0x51, /* inter-fabric routing header */ | ||
FC_RCTL_ENCH = 0x52, /* encapsulation header */ | ||
/* | ||
* Basic Link Services fh_r_ctl values. | ||
*/ | ||
FC_RCTL_BA_NOP = 0x80, /* basic link service NOP */ | ||
FC_RCTL_BA_ABTS = 0x81, /* basic link service abort */ | ||
FC_RCTL_BA_RMC = 0x82, /* remove connection */ | ||
FC_RCTL_BA_ACC = 0x84, /* basic accept */ | ||
FC_RCTL_BA_RJT = 0x85, /* basic reject */ | ||
FC_RCTL_BA_PRMT = 0x86, /* dedicated connection preempted */ | ||
/* | ||
* Link Control Information. | ||
*/ | ||
FC_RCTL_ACK_1 = 0xc0, /* acknowledge_1 */ | ||
FC_RCTL_ACK_0 = 0xc1, /* acknowledge_0 */ | ||
FC_RCTL_P_RJT = 0xc2, /* port reject */ | ||
FC_RCTL_F_RJT = 0xc3, /* fabric reject */ | ||
FC_RCTL_P_BSY = 0xc4, /* port busy */ | ||
FC_RCTL_F_BSY = 0xc5, /* fabric busy to data frame */ | ||
FC_RCTL_F_BSYL = 0xc6, /* fabric busy to link control frame */ | ||
FC_RCTL_LCR = 0xc7, /* link credit reset */ | ||
FC_RCTL_END = 0xc9, /* end */ | ||
}; | ||
/* incomplete list of definitions */ | ||
|
||
/* | ||
* R_CTL names initializer. | ||
* Please keep this matching the above definitions. | ||
*/ | ||
#define FC_RCTL_NAMES_INIT { \ | ||
[FC_RCTL_DD_UNCAT] = "uncat", \ | ||
[FC_RCTL_DD_SOL_DATA] = "sol data", \ | ||
[FC_RCTL_DD_UNSOL_CTL] = "unsol ctl", \ | ||
[FC_RCTL_DD_SOL_CTL] = "sol ctl/reply", \ | ||
[FC_RCTL_DD_UNSOL_DATA] = "unsol data", \ | ||
[FC_RCTL_DD_DATA_DESC] = "data desc", \ | ||
[FC_RCTL_DD_UNSOL_CMD] = "unsol cmd", \ | ||
[FC_RCTL_DD_CMD_STATUS] = "cmd status", \ | ||
[FC_RCTL_ELS_REQ] = "ELS req", \ | ||
[FC_RCTL_ELS_REP] = "ELS rep", \ | ||
[FC_RCTL_ELS4_REQ] = "FC-4 ELS req", \ | ||
[FC_RCTL_ELS4_REP] = "FC-4 ELS rep", \ | ||
[FC_RCTL_BA_NOP] = "BLS NOP", \ | ||
[FC_RCTL_BA_ABTS] = "BLS abort", \ | ||
[FC_RCTL_BA_RMC] = "BLS remove connection", \ | ||
[FC_RCTL_BA_ACC] = "BLS accept", \ | ||
[FC_RCTL_BA_RJT] = "BLS reject", \ | ||
[FC_RCTL_BA_PRMT] = "BLS dedicated connection preempted", \ | ||
[FC_RCTL_ACK_1] = "LC ACK_1", \ | ||
[FC_RCTL_ACK_0] = "LC ACK_0", \ | ||
[FC_RCTL_P_RJT] = "LC port reject", \ | ||
[FC_RCTL_F_RJT] = "LC fabric reject", \ | ||
[FC_RCTL_P_BSY] = "LC port busy", \ | ||
[FC_RCTL_F_BSY] = "LC fabric busy to data frame", \ | ||
[FC_RCTL_F_BSYL] = "LC fabric busy to link control frame",\ | ||
[FC_RCTL_LCR] = "LC link credit reset", \ | ||
[FC_RCTL_END] = "LC end", \ | ||
} | ||
|
||
/* | ||
* Well-known fabric addresses. | ||
*/ | ||
enum fc_well_known_fid { | ||
FC_FID_BCAST = 0xffffff, /* broadcast */ | ||
FC_FID_FLOGI = 0xfffffe, /* fabric login */ | ||
FC_FID_FCTRL = 0xfffffd, /* fabric controller */ | ||
FC_FID_DIR_SERV = 0xfffffc, /* directory server */ | ||
FC_FID_TIME_SERV = 0xfffffb, /* time server */ | ||
FC_FID_MGMT_SERV = 0xfffffa, /* management server */ | ||
FC_FID_QOS = 0xfffff9, /* QoS Facilitator */ | ||
FC_FID_ALIASES = 0xfffff8, /* alias server (FC-PH2) */ | ||
FC_FID_SEC_KEY = 0xfffff7, /* Security key dist. server */ | ||
FC_FID_CLOCK = 0xfffff6, /* clock synch server */ | ||
FC_FID_MCAST_SERV = 0xfffff5, /* multicast server */ | ||
}; | ||
|
||
#define FC_FID_WELL_KNOWN_MAX 0xffffff /* highest well-known fabric ID */ | ||
#define FC_FID_WELL_KNOWN_BASE 0xfffff5 /* start of well-known fabric ID */ | ||
|
||
/* | ||
* Other well-known addresses, outside the above contiguous range. | ||
*/ | ||
#define FC_FID_DOM_MGR 0xfffc00 /* domain manager base */ | ||
|
||
/* | ||
* Fabric ID bytes. | ||
*/ | ||
#define FC_FID_DOMAIN 0 | ||
#define FC_FID_PORT 1 | ||
#define FC_FID_LINK 2 | ||
|
||
/* | ||
* fh_type codes | ||
*/ | ||
enum fc_fh_type { | ||
FC_TYPE_BLS = 0x00, /* basic link service */ | ||
FC_TYPE_ELS = 0x01, /* extended link service */ | ||
FC_TYPE_IP = 0x05, /* IP over FC, RFC 4338 */ | ||
FC_TYPE_FCP = 0x08, /* SCSI FCP */ | ||
FC_TYPE_CT = 0x20, /* Fibre Channel Services (FC-CT) */ | ||
FC_TYPE_ILS = 0x22, /* internal link service */ | ||
}; | ||
|
||
/* | ||
* FC_TYPE names initializer. | ||
* Please keep this matching the above definitions. | ||
*/ | ||
#define FC_TYPE_NAMES_INIT { \ | ||
[FC_TYPE_BLS] = "BLS", \ | ||
[FC_TYPE_ELS] = "ELS", \ | ||
[FC_TYPE_IP] = "IP", \ | ||
[FC_TYPE_FCP] = "FCP", \ | ||
[FC_TYPE_CT] = "CT", \ | ||
[FC_TYPE_ILS] = "ILS", \ | ||
} | ||
|
||
/* | ||
* Exchange IDs. | ||
*/ | ||
#define FC_XID_UNKNOWN 0xffff /* unknown exchange ID */ | ||
#define FC_XID_MIN 0x0 /* supported min exchange ID */ | ||
#define FC_XID_MAX 0xfffe /* supported max exchange ID */ | ||
|
||
/* | ||
* fh_f_ctl - Frame control flags. | ||
*/ | ||
#define FC_FC_EX_CTX (1 << 23) /* sent by responder to exchange */ | ||
#define FC_FC_SEQ_CTX (1 << 22) /* sent by responder to sequence */ | ||
#define FC_FC_FIRST_SEQ (1 << 21) /* first sequence of this exchange */ | ||
#define FC_FC_LAST_SEQ (1 << 20) /* last sequence of this exchange */ | ||
#define FC_FC_END_SEQ (1 << 19) /* last frame of sequence */ | ||
#define FC_FC_END_CONN (1 << 18) /* end of class 1 connection pending */ | ||
#define FC_FC_RES_B17 (1 << 17) /* reserved */ | ||
#define FC_FC_SEQ_INIT (1 << 16) /* transfer of sequence initiative */ | ||
#define FC_FC_X_ID_REASS (1 << 15) /* exchange ID has been changed */ | ||
#define FC_FC_X_ID_INVAL (1 << 14) /* exchange ID invalidated */ | ||
|
||
#define FC_FC_ACK_1 (1 << 12) /* 13:12 = 1: ACK_1 expected */ | ||
#define FC_FC_ACK_N (2 << 12) /* 13:12 = 2: ACK_N expected */ | ||
#define FC_FC_ACK_0 (3 << 12) /* 13:12 = 3: ACK_0 expected */ | ||
|
||
#define FC_FC_RES_B11 (1 << 11) /* reserved */ | ||
#define FC_FC_RES_B10 (1 << 10) /* reserved */ | ||
#define FC_FC_RETX_SEQ (1 << 9) /* retransmitted sequence */ | ||
#define FC_FC_UNI_TX (1 << 8) /* unidirectional transmit (class 1) */ | ||
#define FC_FC_CONT_SEQ(i) ((i) << 6) | ||
#define FC_FC_ABT_SEQ(i) ((i) << 4) | ||
#define FC_FC_REL_OFF (1 << 3) /* parameter is relative offset */ | ||
#define FC_FC_RES2 (1 << 2) /* reserved */ | ||
#define FC_FC_FILL(i) ((i) & 3) /* 1:0: bytes of trailing fill */ | ||
|
||
/* | ||
* BA_ACC payload. | ||
*/ | ||
struct fc_ba_acc { | ||
__u8 ba_seq_id_val; /* SEQ_ID validity */ | ||
#define FC_BA_SEQ_ID_VAL 0x80 | ||
__u8 ba_seq_id; /* SEQ_ID of seq last deliverable */ | ||
__u8 ba_resvd[2]; /* reserved */ | ||
__be16 ba_ox_id; /* OX_ID for aborted seq or exch */ | ||
__be16 ba_rx_id; /* RX_ID for aborted seq or exch */ | ||
__be16 ba_low_seq_cnt; /* low SEQ_CNT of aborted seq */ | ||
__be16 ba_high_seq_cnt; /* high SEQ_CNT of aborted seq */ | ||
}; | ||
|
||
/* | ||
* BA_RJT: Basic Reject payload. | ||
*/ | ||
struct fc_ba_rjt { | ||
__u8 br_resvd; /* reserved */ | ||
__u8 br_reason; /* reason code */ | ||
__u8 br_explan; /* reason explanation */ | ||
__u8 br_vendor; /* vendor unique code */ | ||
}; | ||
|
||
/* | ||
* BA_RJT reason codes. | ||
* From FS-2. | ||
*/ | ||
enum fc_ba_rjt_reason { | ||
FC_BA_RJT_NONE = 0, /* in software this means no reject */ | ||
FC_BA_RJT_INVL_CMD = 0x01, /* invalid command code */ | ||
FC_BA_RJT_LOG_ERR = 0x03, /* logical error */ | ||
FC_BA_RJT_LOG_BUSY = 0x05, /* logical busy */ | ||
FC_BA_RJT_PROTO_ERR = 0x07, /* protocol error */ | ||
FC_BA_RJT_UNABLE = 0x09, /* unable to perform request */ | ||
FC_BA_RJT_VENDOR = 0xff, /* vendor-specific (see br_vendor) */ | ||
}; | ||
|
||
/* | ||
* BA_RJT reason code explanations. | ||
*/ | ||
enum fc_ba_rjt_explan { | ||
FC_BA_RJT_EXP_NONE = 0x00, /* no additional expanation */ | ||
FC_BA_RJT_INV_XID = 0x03, /* invalid OX_ID-RX_ID combination */ | ||
FC_BA_RJT_ABT = 0x05, /* sequence aborted, no seq info */ | ||
}; | ||
|
||
/* | ||
* P_RJT or F_RJT: Port Reject or Fabric Reject parameter field. | ||
*/ | ||
struct fc_pf_rjt { | ||
__u8 rj_action; /* reserved */ | ||
__u8 rj_reason; /* reason code */ | ||
__u8 rj_resvd; /* reserved */ | ||
__u8 rj_vendor; /* vendor unique code */ | ||
}; | ||
|
||
/* | ||
* P_RJT and F_RJT reject reason codes. | ||
*/ | ||
enum fc_pf_rjt_reason { | ||
FC_RJT_NONE = 0, /* non-reject (reserved by standard) */ | ||
FC_RJT_INVL_DID = 0x01, /* invalid destination ID */ | ||
FC_RJT_INVL_SID = 0x02, /* invalid source ID */ | ||
FC_RJT_P_UNAV_T = 0x03, /* port unavailable, temporary */ | ||
FC_RJT_P_UNAV = 0x04, /* port unavailable, permanent */ | ||
FC_RJT_CLS_UNSUP = 0x05, /* class not supported */ | ||
FC_RJT_DEL_USAGE = 0x06, /* delimiter usage error */ | ||
FC_RJT_TYPE_UNSUP = 0x07, /* type not supported */ | ||
FC_RJT_LINK_CTL = 0x08, /* invalid link control */ | ||
FC_RJT_R_CTL = 0x09, /* invalid R_CTL field */ | ||
FC_RJT_F_CTL = 0x0a, /* invalid F_CTL field */ | ||
FC_RJT_OX_ID = 0x0b, /* invalid originator exchange ID */ | ||
FC_RJT_RX_ID = 0x0c, /* invalid responder exchange ID */ | ||
FC_RJT_SEQ_ID = 0x0d, /* invalid sequence ID */ | ||
FC_RJT_DF_CTL = 0x0e, /* invalid DF_CTL field */ | ||
FC_RJT_SEQ_CNT = 0x0f, /* invalid SEQ_CNT field */ | ||
FC_RJT_PARAM = 0x10, /* invalid parameter field */ | ||
FC_RJT_EXCH_ERR = 0x11, /* exchange error */ | ||
FC_RJT_PROTO = 0x12, /* protocol error */ | ||
FC_RJT_LEN = 0x13, /* incorrect length */ | ||
FC_RJT_UNEXP_ACK = 0x14, /* unexpected ACK */ | ||
FC_RJT_FAB_CLASS = 0x15, /* class unsupported by fabric entity */ | ||
FC_RJT_LOGI_REQ = 0x16, /* login required */ | ||
FC_RJT_SEQ_XS = 0x17, /* excessive sequences attempted */ | ||
FC_RJT_EXCH_EST = 0x18, /* unable to establish exchange */ | ||
FC_RJT_FAB_UNAV = 0x1a, /* fabric unavailable */ | ||
FC_RJT_VC_ID = 0x1b, /* invalid VC_ID (class 4) */ | ||
FC_RJT_CS_CTL = 0x1c, /* invalid CS_CTL field */ | ||
FC_RJT_INSUF_RES = 0x1d, /* insuff. resources for VC (Class 4) */ | ||
FC_RJT_INVL_CLS = 0x1f, /* invalid class of service */ | ||
FC_RJT_PREEMT_RJT = 0x20, /* preemption request rejected */ | ||
FC_RJT_PREEMT_DIS = 0x21, /* preemption not enabled */ | ||
FC_RJT_MCAST_ERR = 0x22, /* multicast error */ | ||
FC_RJT_MCAST_ET = 0x23, /* multicast error terminate */ | ||
FC_RJT_PRLI_REQ = 0x24, /* process login required */ | ||
FC_RJT_INVL_ATT = 0x25, /* invalid attachment */ | ||
FC_RJT_VENDOR = 0xff, /* vendor specific reject */ | ||
}; | ||
|
||
#endif /* _FC_FS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* Copyright(c) 2007 Intel Corporation. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope 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. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Maintained at www.Open-FCoE.org | ||
*/ | ||
|
||
#ifndef _FC_GS_H_ | ||
#define _FC_GS_H_ | ||
|
||
/* | ||
* Fibre Channel Services - Common Transport. | ||
* From T11.org FC-GS-2 Rev 5.3 November 1998. | ||
*/ | ||
|
||
struct fc_ct_hdr { | ||
__u8 ct_rev; /* revision */ | ||
__u8 ct_in_id[3]; /* N_Port ID of original requestor */ | ||
__u8 ct_fs_type; /* type of fibre channel service */ | ||
__u8 ct_fs_subtype; /* subtype */ | ||
__u8 ct_options; | ||
__u8 _ct_resvd1; | ||
__be16 ct_cmd; /* command / response code */ | ||
__be16 ct_mr_size; /* maximum / residual size */ | ||
__u8 _ct_resvd2; | ||
__u8 ct_reason; /* reject reason */ | ||
__u8 ct_explan; /* reason code explanation */ | ||
__u8 ct_vendor; /* vendor unique data */ | ||
}; | ||
|
||
#define FC_CT_HDR_LEN 16 /* expected sizeof (struct fc_ct_hdr) */ | ||
|
||
enum fc_ct_rev { | ||
FC_CT_REV = 1 /* common transport revision */ | ||
}; | ||
|
||
/* | ||
* ct_fs_type values. | ||
*/ | ||
enum fc_ct_fs_type { | ||
FC_FST_ALIAS = 0xf8, /* alias service */ | ||
FC_FST_MGMT = 0xfa, /* management service */ | ||
FC_FST_TIME = 0xfb, /* time service */ | ||
FC_FST_DIR = 0xfc, /* directory service */ | ||
}; | ||
|
||
/* | ||
* ct_cmd: Command / response codes | ||
*/ | ||
enum fc_ct_cmd { | ||
FC_FS_RJT = 0x8001, /* reject */ | ||
FC_FS_ACC = 0x8002, /* accept */ | ||
}; | ||
|
||
/* | ||
* FS_RJT reason codes. | ||
*/ | ||
enum fc_ct_reason { | ||
FC_FS_RJT_CMD = 0x01, /* invalid command code */ | ||
FC_FS_RJT_VER = 0x02, /* invalid version level */ | ||
FC_FS_RJT_LOG = 0x03, /* logical error */ | ||
FC_FS_RJT_IUSIZ = 0x04, /* invalid IU size */ | ||
FC_FS_RJT_BSY = 0x05, /* logical busy */ | ||
FC_FS_RJT_PROTO = 0x07, /* protocol error */ | ||
FC_FS_RJT_UNABL = 0x09, /* unable to perform command request */ | ||
FC_FS_RJT_UNSUP = 0x0b, /* command not supported */ | ||
}; | ||
|
||
/* | ||
* FS_RJT reason code explanations. | ||
*/ | ||
enum fc_ct_explan { | ||
FC_FS_EXP_NONE = 0x00, /* no additional explanation */ | ||
FC_FS_EXP_PID = 0x01, /* port ID not registered */ | ||
FC_FS_EXP_PNAM = 0x02, /* port name not registered */ | ||
FC_FS_EXP_NNAM = 0x03, /* node name not registered */ | ||
FC_FS_EXP_COS = 0x04, /* class of service not registered */ | ||
/* definitions not complete */ | ||
}; | ||
|
||
#endif /* _FC_GS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
/* | ||
* Copyright(c) 2007 Intel Corporation. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope 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. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Maintained at www.Open-FCoE.org | ||
*/ | ||
|
||
#ifndef _FC_NS_H_ | ||
#define _FC_NS_H_ | ||
|
||
/* | ||
* Fibre Channel Services - Name Service (dNS) | ||
* From T11.org FC-GS-2 Rev 5.3 November 1998. | ||
*/ | ||
|
||
/* | ||
* Common-transport sub-type for Name Server. | ||
*/ | ||
#define FC_NS_SUBTYPE 2 /* fs_ct_hdr.ct_fs_subtype */ | ||
|
||
/* | ||
* Name server Requests. | ||
* Note: this is an incomplete list, some unused requests are omitted. | ||
*/ | ||
enum fc_ns_req { | ||
FC_NS_GA_NXT = 0x0100, /* get all next */ | ||
FC_NS_GI_A = 0x0101, /* get identifiers - scope */ | ||
FC_NS_GPN_ID = 0x0112, /* get port name by ID */ | ||
FC_NS_GNN_ID = 0x0113, /* get node name by ID */ | ||
FC_NS_GID_PN = 0x0121, /* get ID for port name */ | ||
FC_NS_GID_NN = 0x0131, /* get IDs for node name */ | ||
FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ | ||
FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */ | ||
FC_NS_GID_PT = 0x01a1, /* get IDs by port type */ | ||
FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */ | ||
FC_NS_RPN_ID = 0x0212, /* reg port name for ID */ | ||
FC_NS_RNN_ID = 0x0213, /* reg node name for ID */ | ||
}; | ||
|
||
/* | ||
* Port type values. | ||
*/ | ||
enum fc_ns_pt { | ||
FC_NS_UNID_PORT = 0x00, /* unidentified */ | ||
FC_NS_N_PORT = 0x01, /* N port */ | ||
FC_NS_NL_PORT = 0x02, /* NL port */ | ||
FC_NS_FNL_PORT = 0x03, /* F/NL port */ | ||
FC_NS_NX_PORT = 0x7f, /* Nx port */ | ||
FC_NS_F_PORT = 0x81, /* F port */ | ||
FC_NS_FL_PORT = 0x82, /* FL port */ | ||
FC_NS_E_PORT = 0x84, /* E port */ | ||
FC_NS_B_PORT = 0x85, /* B port */ | ||
}; | ||
|
||
/* | ||
* Port type object. | ||
*/ | ||
struct fc_ns_pt_obj { | ||
__u8 pt_type; | ||
}; | ||
|
||
/* | ||
* Port ID object | ||
*/ | ||
struct fc_ns_fid { | ||
__u8 fp_flags; /* flags for responses only */ | ||
__u8 fp_fid[3]; | ||
}; | ||
|
||
/* | ||
* fp_flags in port ID object, for responses only. | ||
*/ | ||
#define FC_NS_FID_LAST 0x80 /* last object */ | ||
|
||
/* | ||
* FC4-types object. | ||
*/ | ||
#define FC_NS_TYPES 256 /* number of possible FC-4 types */ | ||
#define FC_NS_BPW 32 /* bits per word in bitmap */ | ||
|
||
struct fc_ns_fts { | ||
__be32 ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */ | ||
}; | ||
|
||
/* | ||
* GID_PT request. | ||
*/ | ||
struct fc_ns_gid_pt { | ||
__u8 fn_pt_type; | ||
__u8 fn_domain_id_scope; | ||
__u8 fn_area_id_scope; | ||
__u8 fn_resvd; | ||
}; | ||
|
||
/* | ||
* GID_FT or GPN_FT request. | ||
*/ | ||
struct fc_ns_gid_ft { | ||
__u8 fn_resvd; | ||
__u8 fn_domain_id_scope; | ||
__u8 fn_area_id_scope; | ||
__u8 fn_fc4_type; | ||
}; | ||
|
||
/* | ||
* GPN_FT response. | ||
*/ | ||
struct fc_gpn_ft_resp { | ||
__u8 fp_flags; /* see fp_flags definitions above */ | ||
__u8 fp_fid[3]; /* port ID */ | ||
__be32 fp_resvd; | ||
__be64 fp_wwpn; /* port name */ | ||
}; | ||
|
||
/* | ||
* GID_PN request | ||
*/ | ||
struct fc_ns_gid_pn { | ||
__be64 fn_wwpn; /* port name */ | ||
}; | ||
|
||
/* | ||
* GID_PN response | ||
*/ | ||
struct fc_gid_pn_resp { | ||
__u8 fp_resvd; | ||
__u8 fp_fid[3]; /* port ID */ | ||
}; | ||
|
||
/* | ||
* RFT_ID request - register FC-4 types for ID. | ||
*/ | ||
struct fc_ns_rft_id { | ||
struct fc_ns_fid fr_fid; /* port ID object */ | ||
struct fc_ns_fts fr_fts; /* FC-4 types object */ | ||
}; | ||
|
||
/* | ||
* RPN_ID request - register port name for ID. | ||
* RNN_ID request - register node name for ID. | ||
*/ | ||
struct fc_ns_rn_id { | ||
struct fc_ns_fid fr_fid; /* port ID object */ | ||
__be64 fr_wwn; /* node name or port name */ | ||
} __attribute__((__packed__)); | ||
|
||
#endif /* _FC_NS_H_ */ |