diff options
author | Robert Love <robert.w.love@intel.com> | 2008-12-09 18:10:11 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-12-29 12:24:32 -0500 |
commit | f032c2f7cdaae0e8907cd3b26426fc651dc5c275 (patch) | |
tree | a8ee4e4aee28c9d5173cd2c39d83dbbc0b7ebcdb /include/scsi/fc/fc_fc2.h | |
parent | 21465eda9eafa275ed11c27779d90aa95559b6f6 (diff) |
[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>
Diffstat (limited to 'include/scsi/fc/fc_fc2.h')
-rw-r--r-- | include/scsi/fc/fc_fc2.h | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/include/scsi/fc/fc_fc2.h b/include/scsi/fc/fc_fc2.h new file mode 100644 index 000000000000..cff8a8c22f50 --- /dev/null +++ b/include/scsi/fc/fc_fc2.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * Copyright(c) 2007 Intel Corporation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program; if not, write to the Free Software Foundation, Inc., | ||
15 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
16 | * | ||
17 | * Maintained at www.Open-FCoE.org | ||
18 | */ | ||
19 | |||
20 | #ifndef _FC_FC2_H_ | ||
21 | #define _FC_FC2_H_ | ||
22 | |||
23 | /* | ||
24 | * Fibre Channel Exchanges and Sequences. | ||
25 | */ | ||
26 | #ifndef PACKED | ||
27 | #define PACKED __attribute__ ((__packed__)) | ||
28 | #endif /* PACKED */ | ||
29 | |||
30 | |||
31 | /* | ||
32 | * Sequence Status Block. | ||
33 | * This format is set by the FC-FS standard and is sent over the wire. | ||
34 | * Note that the fields aren't all naturally aligned. | ||
35 | */ | ||
36 | struct fc_ssb { | ||
37 | __u8 ssb_seq_id; /* sequence ID */ | ||
38 | __u8 _ssb_resvd; | ||
39 | __be16 ssb_low_seq_cnt; /* lowest SEQ_CNT */ | ||
40 | |||
41 | __be16 ssb_high_seq_cnt; /* highest SEQ_CNT */ | ||
42 | __be16 ssb_s_stat; /* sequence status flags */ | ||
43 | |||
44 | __be16 ssb_err_seq_cnt; /* error SEQ_CNT */ | ||
45 | __u8 ssb_fh_cs_ctl; /* frame header CS_CTL */ | ||
46 | __be16 ssb_fh_ox_id; /* frame header OX_ID */ | ||
47 | __be16 ssb_rx_id; /* responder's exchange ID */ | ||
48 | __u8 _ssb_resvd2[2]; | ||
49 | } PACKED; | ||
50 | |||
51 | /* | ||
52 | * The SSB should be 17 bytes. Since it's layout is somewhat strange, | ||
53 | * we define the size here so that code can ASSERT that the size comes out | ||
54 | * correct. | ||
55 | */ | ||
56 | #define FC_SSB_SIZE 17 /* length of fc_ssb for assert */ | ||
57 | |||
58 | /* | ||
59 | * ssb_s_stat - flags from FC-FS-2 T11/1619-D Rev 0.90. | ||
60 | */ | ||
61 | #define SSB_ST_RESP (1 << 15) /* sequence responder */ | ||
62 | #define SSB_ST_ACTIVE (1 << 14) /* sequence is active */ | ||
63 | #define SSB_ST_ABNORMAL (1 << 12) /* abnormal ending condition */ | ||
64 | |||
65 | #define SSB_ST_REQ_MASK (3 << 10) /* ACK, abort sequence condition */ | ||
66 | #define SSB_ST_REQ_CONT (0 << 10) | ||
67 | #define SSB_ST_REQ_ABORT (1 << 10) | ||
68 | #define SSB_ST_REQ_STOP (2 << 10) | ||
69 | #define SSB_ST_REQ_RETRANS (3 << 10) | ||
70 | |||
71 | #define SSB_ST_ABTS (1 << 9) /* ABTS protocol completed */ | ||
72 | #define SSB_ST_RETRANS (1 << 8) /* retransmission completed */ | ||
73 | #define SSB_ST_TIMEOUT (1 << 7) /* sequence timed out by recipient */ | ||
74 | #define SSB_ST_P_RJT (1 << 6) /* P_RJT transmitted */ | ||
75 | |||
76 | #define SSB_ST_CLASS_BIT 4 /* class of service field LSB */ | ||
77 | #define SSB_ST_CLASS_MASK 3 /* class of service mask */ | ||
78 | #define SSB_ST_ACK (1 << 3) /* ACK (EOFt or EOFdt) transmitted */ | ||
79 | |||
80 | /* | ||
81 | * Exchange Status Block. | ||
82 | * This format is set by the FC-FS standard and is sent over the wire. | ||
83 | * Note that the fields aren't all naturally aligned. | ||
84 | */ | ||
85 | struct fc_esb { | ||
86 | __u8 esb_cs_ctl; /* CS_CTL for frame header */ | ||
87 | __be16 esb_ox_id; /* originator exchange ID */ | ||
88 | __be16 esb_rx_id; /* responder exchange ID */ | ||
89 | __be32 esb_orig_fid; /* fabric ID of originator */ | ||
90 | __be32 esb_resp_fid; /* fabric ID of responder */ | ||
91 | __be32 esb_e_stat; /* status */ | ||
92 | __u8 _esb_resvd[4]; | ||
93 | __u8 esb_service_params[112]; /* TBD */ | ||
94 | __u8 esb_seq_status[8]; /* sequence statuses, 8 bytes each */ | ||
95 | } __attribute__((packed));; | ||
96 | |||
97 | |||
98 | /* | ||
99 | * Define expected size for ASSERTs. | ||
100 | * See comments on FC_SSB_SIZE. | ||
101 | */ | ||
102 | #define FC_ESB_SIZE (1 + 5*4 + 112 + 8) /* expected size */ | ||
103 | |||
104 | /* | ||
105 | * esb_e_stat - flags from FC-FS-2 T11/1619-D Rev 0.90. | ||
106 | */ | ||
107 | #define ESB_ST_RESP (1 << 31) /* responder to exchange */ | ||
108 | #define ESB_ST_SEQ_INIT (1 << 30) /* port holds sequence initiaive */ | ||
109 | #define ESB_ST_COMPLETE (1 << 29) /* exchange is complete */ | ||
110 | #define ESB_ST_ABNORMAL (1 << 28) /* abnormal ending condition */ | ||
111 | #define ESB_ST_REC_QUAL (1 << 26) /* recovery qualifier active */ | ||
112 | |||
113 | #define ESB_ST_ERRP_BIT 24 /* LSB for error policy */ | ||
114 | #define ESB_ST_ERRP_MASK (3 << 24) /* mask for error policy */ | ||
115 | #define ESB_ST_ERRP_MULT (0 << 24) /* abort, discard multiple sequences */ | ||
116 | #define ESB_ST_ERRP_SING (1 << 24) /* abort, discard single sequence */ | ||
117 | #define ESB_ST_ERRP_INF (2 << 24) /* process with infinite buffers */ | ||
118 | #define ESB_ST_ERRP_IMM (3 << 24) /* discard mult. with immed. retran. */ | ||
119 | |||
120 | #define ESB_ST_OX_ID_INVL (1 << 23) /* originator XID invalid */ | ||
121 | #define ESB_ST_RX_ID_INVL (1 << 22) /* responder XID invalid */ | ||
122 | #define ESB_ST_PRI_INUSE (1 << 21) /* priority / preemption in use */ | ||
123 | |||
124 | #endif /* _FC_FC2_H_ */ | ||