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