/*1* Copyright(c) 2007 Intel Corporation. All rights reserved.2*3* This program is free software; you can redistribute it and/or modify it4* under the terms and conditions of the GNU General Public License,5* version 2, as published by the Free Software Foundation.6*7* This program is distributed in the hope it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for10* more details.11*12* You should have received a copy of the GNU General Public License along with13* this program; if not, write to the Free Software Foundation, Inc.,14* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.15*16* Maintained at www.Open-FCoE.org17*/1819#ifndef _FC_FC2_H_20#define _FC_FC2_H_2122/*23* Fibre Channel Exchanges and Sequences.24*/25#ifndef PACKED26#define PACKED __attribute__ ((__packed__))27#endif /* PACKED */282930/*31* Sequence Status Block.32* This format is set by the FC-FS standard and is sent over the wire.33* Note that the fields aren't all naturally aligned.34*/35struct fc_ssb {36__u8 ssb_seq_id; /* sequence ID */37__u8 _ssb_resvd;38__be16 ssb_low_seq_cnt; /* lowest SEQ_CNT */3940__be16 ssb_high_seq_cnt; /* highest SEQ_CNT */41__be16 ssb_s_stat; /* sequence status flags */4243__be16 ssb_err_seq_cnt; /* error SEQ_CNT */44__u8 ssb_fh_cs_ctl; /* frame header CS_CTL */45__be16 ssb_fh_ox_id; /* frame header OX_ID */46__be16 ssb_rx_id; /* responder's exchange ID */47__u8 _ssb_resvd2[2];48} PACKED;4950/*51* The SSB should be 17 bytes. Since it's layout is somewhat strange,52* we define the size here so that code can ASSERT that the size comes out53* correct.54*/55#define FC_SSB_SIZE 17 /* length of fc_ssb for assert */5657/*58* ssb_s_stat - flags from FC-FS-2 T11/1619-D Rev 0.90.59*/60#define SSB_ST_RESP (1 << 15) /* sequence responder */61#define SSB_ST_ACTIVE (1 << 14) /* sequence is active */62#define SSB_ST_ABNORMAL (1 << 12) /* abnormal ending condition */6364#define SSB_ST_REQ_MASK (3 << 10) /* ACK, abort sequence condition */65#define SSB_ST_REQ_CONT (0 << 10)66#define SSB_ST_REQ_ABORT (1 << 10)67#define SSB_ST_REQ_STOP (2 << 10)68#define SSB_ST_REQ_RETRANS (3 << 10)6970#define SSB_ST_ABTS (1 << 9) /* ABTS protocol completed */71#define SSB_ST_RETRANS (1 << 8) /* retransmission completed */72#define SSB_ST_TIMEOUT (1 << 7) /* sequence timed out by recipient */73#define SSB_ST_P_RJT (1 << 6) /* P_RJT transmitted */7475#define SSB_ST_CLASS_BIT 4 /* class of service field LSB */76#define SSB_ST_CLASS_MASK 3 /* class of service mask */77#define SSB_ST_ACK (1 << 3) /* ACK (EOFt or EOFdt) transmitted */7879/*80* Exchange Status Block.81* This format is set by the FC-FS standard and is sent over the wire.82* Note that the fields aren't all naturally aligned.83*/84struct fc_esb {85__u8 esb_cs_ctl; /* CS_CTL for frame header */86__be16 esb_ox_id; /* originator exchange ID */87__be16 esb_rx_id; /* responder exchange ID */88__be32 esb_orig_fid; /* fabric ID of originator */89__be32 esb_resp_fid; /* fabric ID of responder */90__be32 esb_e_stat; /* status */91__u8 _esb_resvd[4];92__u8 esb_service_params[112]; /* TBD */93__u8 esb_seq_status[8]; /* sequence statuses, 8 bytes each */94} __attribute__((packed));9596/*97* Define expected size for ASSERTs.98* See comments on FC_SSB_SIZE.99*/100#define FC_ESB_SIZE (1 + 5*4 + 112 + 8) /* expected size */101102/*103* esb_e_stat - flags from FC-FS-2 T11/1619-D Rev 0.90.104*/105#define ESB_ST_RESP (1 << 31) /* responder to exchange */106#define ESB_ST_SEQ_INIT (1 << 30) /* port holds sequence initiaive */107#define ESB_ST_COMPLETE (1 << 29) /* exchange is complete */108#define ESB_ST_ABNORMAL (1 << 28) /* abnormal ending condition */109#define ESB_ST_REC_QUAL (1 << 26) /* recovery qualifier active */110111#define ESB_ST_ERRP_BIT 24 /* LSB for error policy */112#define ESB_ST_ERRP_MASK (3 << 24) /* mask for error policy */113#define ESB_ST_ERRP_MULT (0 << 24) /* abort, discard multiple sequences */114#define ESB_ST_ERRP_SING (1 << 24) /* abort, discard single sequence */115#define ESB_ST_ERRP_INF (2 << 24) /* process with infinite buffers */116#define ESB_ST_ERRP_IMM (3 << 24) /* discard mult. with immed. retran. */117118#define ESB_ST_OX_ID_INVL (1 << 23) /* originator XID invalid */119#define ESB_ST_RX_ID_INVL (1 << 22) /* responder XID invalid */120#define ESB_ST_PRI_INUSE (1 << 21) /* priority / preemption in use */121122#endif /* _FC_FC2_H_ */123124125