/* SPDX-License-Identifier: GPL-2.0-only */1/*2* Copyright(c) 2007 Intel Corporation. All rights reserved.3*4* Maintained at www.Open-FCoE.org5*/67#ifndef _FC_FC2_H_8#define _FC_FC2_H_910/*11* Fibre Channel Exchanges and Sequences.12*/13#ifndef PACKED14#define PACKED __attribute__ ((__packed__))15#endif /* PACKED */161718/*19* Sequence Status Block.20* This format is set by the FC-FS standard and is sent over the wire.21* Note that the fields aren't all naturally aligned.22*/23struct fc_ssb {24__u8 ssb_seq_id; /* sequence ID */25__u8 _ssb_resvd;26__be16 ssb_low_seq_cnt; /* lowest SEQ_CNT */2728__be16 ssb_high_seq_cnt; /* highest SEQ_CNT */29__be16 ssb_s_stat; /* sequence status flags */3031__be16 ssb_err_seq_cnt; /* error SEQ_CNT */32__u8 ssb_fh_cs_ctl; /* frame header CS_CTL */33__be16 ssb_fh_ox_id; /* frame header OX_ID */34__be16 ssb_rx_id; /* responder's exchange ID */35__u8 _ssb_resvd2[2];36} PACKED;3738/*39* The SSB should be 17 bytes. Since it's layout is somewhat strange,40* we define the size here so that code can ASSERT that the size comes out41* correct.42*/43#define FC_SSB_SIZE 17 /* length of fc_ssb for assert */4445/*46* ssb_s_stat - flags from FC-FS-2 T11/1619-D Rev 0.90.47*/48#define SSB_ST_RESP (1 << 15) /* sequence responder */49#define SSB_ST_ACTIVE (1 << 14) /* sequence is active */50#define SSB_ST_ABNORMAL (1 << 12) /* abnormal ending condition */5152#define SSB_ST_REQ_MASK (3 << 10) /* ACK, abort sequence condition */53#define SSB_ST_REQ_CONT (0 << 10)54#define SSB_ST_REQ_ABORT (1 << 10)55#define SSB_ST_REQ_STOP (2 << 10)56#define SSB_ST_REQ_RETRANS (3 << 10)5758#define SSB_ST_ABTS (1 << 9) /* ABTS protocol completed */59#define SSB_ST_RETRANS (1 << 8) /* retransmission completed */60#define SSB_ST_TIMEOUT (1 << 7) /* sequence timed out by recipient */61#define SSB_ST_P_RJT (1 << 6) /* P_RJT transmitted */6263#define SSB_ST_CLASS_BIT 4 /* class of service field LSB */64#define SSB_ST_CLASS_MASK 3 /* class of service mask */65#define SSB_ST_ACK (1 << 3) /* ACK (EOFt or EOFdt) transmitted */6667/*68* Exchange Status Block.69* This format is set by the FC-FS standard and is sent over the wire.70* Note that the fields aren't all naturally aligned.71*/72struct fc_esb {73__u8 esb_cs_ctl; /* CS_CTL for frame header */74__be16 esb_ox_id; /* originator exchange ID */75__be16 esb_rx_id; /* responder exchange ID */76__be32 esb_orig_fid; /* fabric ID of originator */77__be32 esb_resp_fid; /* fabric ID of responder */78__be32 esb_e_stat; /* status */79__u8 _esb_resvd[4];80__u8 esb_service_params[112]; /* TBD */81__u8 esb_seq_status[8]; /* sequence statuses, 8 bytes each */82} __attribute__((packed));8384/*85* Define expected size for ASSERTs.86* See comments on FC_SSB_SIZE.87*/88#define FC_ESB_SIZE (1 + 5*4 + 112 + 8) /* expected size */8990/*91* esb_e_stat - flags from FC-FS-2 T11/1619-D Rev 0.90.92*/93#define ESB_ST_RESP (1 << 31) /* responder to exchange */94#define ESB_ST_SEQ_INIT (1 << 30) /* port holds sequence initiative */95#define ESB_ST_COMPLETE (1 << 29) /* exchange is complete */96#define ESB_ST_ABNORMAL (1 << 28) /* abnormal ending condition */97#define ESB_ST_REC_QUAL (1 << 26) /* recovery qualifier active */9899#define ESB_ST_ERRP_BIT 24 /* LSB for error policy */100#define ESB_ST_ERRP_MASK (3 << 24) /* mask for error policy */101#define ESB_ST_ERRP_MULT (0 << 24) /* abort, discard multiple sequences */102#define ESB_ST_ERRP_SING (1 << 24) /* abort, discard single sequence */103#define ESB_ST_ERRP_INF (2 << 24) /* process with infinite buffers */104#define ESB_ST_ERRP_IMM (3 << 24) /* discard mult. with immed. retran. */105106#define ESB_ST_OX_ID_INVL (1 << 23) /* originator XID invalid */107#define ESB_ST_RX_ID_INVL (1 << 22) /* responder XID invalid */108#define ESB_ST_PRI_INUSE (1 << 21) /* priority / preemption in use */109110#endif /* _FC_FC2_H_ */111112113