Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright(c) 2007 Intel Corporation. All rights reserved.
0004  *
0005  * Maintained at www.Open-FCoE.org
0006  */
0007 
0008 #ifndef _FC_FC2_H_
0009 #define _FC_FC2_H_
0010 
0011 /*
0012  * Fibre Channel Exchanges and Sequences.
0013  */
0014 #ifndef PACKED
0015 #define PACKED  __attribute__ ((__packed__))
0016 #endif /* PACKED */
0017 
0018 
0019 /*
0020  * Sequence Status Block.
0021  * This format is set by the FC-FS standard and is sent over the wire.
0022  * Note that the fields aren't all naturally aligned.
0023  */
0024 struct fc_ssb {
0025     __u8    ssb_seq_id;     /* sequence ID */
0026     __u8    _ssb_resvd;
0027     __be16  ssb_low_seq_cnt;    /* lowest SEQ_CNT */
0028 
0029     __be16  ssb_high_seq_cnt;   /* highest SEQ_CNT */
0030     __be16  ssb_s_stat;     /* sequence status flags */
0031 
0032     __be16  ssb_err_seq_cnt;    /* error SEQ_CNT */
0033     __u8    ssb_fh_cs_ctl;      /* frame header CS_CTL */
0034     __be16  ssb_fh_ox_id;       /* frame header OX_ID */
0035     __be16  ssb_rx_id;      /* responder's exchange ID */
0036     __u8    _ssb_resvd2[2];
0037 } PACKED;
0038 
0039 /*
0040  * The SSB should be 17 bytes.  Since it's layout is somewhat strange,
0041  * we define the size here so that code can ASSERT that the size comes out
0042  * correct.
0043  */
0044 #define FC_SSB_SIZE         17          /* length of fc_ssb for assert */
0045 
0046 /*
0047  * ssb_s_stat - flags from FC-FS-2 T11/1619-D Rev 0.90.
0048  */
0049 #define SSB_ST_RESP         (1 << 15)   /* sequence responder */
0050 #define SSB_ST_ACTIVE       (1 << 14)   /* sequence is active */
0051 #define SSB_ST_ABNORMAL     (1 << 12)   /* abnormal ending condition */
0052 
0053 #define SSB_ST_REQ_MASK     (3 << 10)   /* ACK, abort sequence condition */
0054 #define SSB_ST_REQ_CONT     (0 << 10)
0055 #define SSB_ST_REQ_ABORT    (1 << 10)
0056 #define SSB_ST_REQ_STOP     (2 << 10)
0057 #define SSB_ST_REQ_RETRANS  (3 << 10)
0058 
0059 #define SSB_ST_ABTS         (1 << 9)    /* ABTS protocol completed */
0060 #define SSB_ST_RETRANS      (1 << 8)    /* retransmission completed */
0061 #define SSB_ST_TIMEOUT      (1 << 7)    /* sequence timed out by recipient */
0062 #define SSB_ST_P_RJT        (1 << 6)    /* P_RJT transmitted */
0063 
0064 #define SSB_ST_CLASS_BIT    4           /* class of service field LSB */
0065 #define SSB_ST_CLASS_MASK   3           /* class of service mask */
0066 #define SSB_ST_ACK          (1 << 3)    /* ACK (EOFt or EOFdt) transmitted */
0067 
0068 /*
0069  * Exchange Status Block.
0070  * This format is set by the FC-FS standard and is sent over the wire.
0071  * Note that the fields aren't all naturally aligned.
0072  */
0073 struct fc_esb {
0074     __u8    esb_cs_ctl;     /* CS_CTL for frame header */
0075     __be16  esb_ox_id;      /* originator exchange ID */
0076     __be16  esb_rx_id;      /* responder exchange ID */
0077     __be32  esb_orig_fid;       /* fabric ID of originator */
0078     __be32  esb_resp_fid;       /* fabric ID of responder */
0079     __be32  esb_e_stat;     /* status */
0080     __u8    _esb_resvd[4];
0081     __u8    esb_service_params[112]; /* TBD */
0082     __u8    esb_seq_status[8];  /* sequence statuses, 8 bytes each */
0083 } __attribute__((packed));
0084 
0085 /*
0086  * Define expected size for ASSERTs.
0087  * See comments on FC_SSB_SIZE.
0088  */
0089 #define FC_ESB_SIZE         (1 + 5*4 + 112 + 8)     /* expected size */
0090 
0091 /*
0092  * esb_e_stat - flags from FC-FS-2 T11/1619-D Rev 0.90.
0093  */
0094 #define ESB_ST_RESP         (1 << 31)   /* responder to exchange */
0095 #define ESB_ST_SEQ_INIT     (1 << 30)   /* port holds sequence initiative */
0096 #define ESB_ST_COMPLETE     (1 << 29)   /* exchange is complete */
0097 #define ESB_ST_ABNORMAL     (1 << 28)   /* abnormal ending condition */
0098 #define ESB_ST_REC_QUAL     (1 << 26)   /* recovery qualifier active */
0099 
0100 #define ESB_ST_ERRP_BIT     24          /* LSB for error policy */
0101 #define ESB_ST_ERRP_MASK    (3 << 24)   /* mask for error policy */
0102 #define ESB_ST_ERRP_MULT    (0 << 24)   /* abort, discard multiple sequences */
0103 #define ESB_ST_ERRP_SING    (1 << 24)   /* abort, discard single sequence */
0104 #define ESB_ST_ERRP_INF     (2 << 24)   /* process with infinite buffers */
0105 #define ESB_ST_ERRP_IMM     (3 << 24)   /* discard mult. with immed. retran. */
0106 
0107 #define ESB_ST_OX_ID_INVL   (1 << 23)   /* originator XID invalid */
0108 #define ESB_ST_RX_ID_INVL   (1 << 22)   /* responder XID invalid */
0109 #define ESB_ST_PRI_INUSE    (1 << 21)   /* priority / preemption in use */
0110 
0111 #endif /* _FC_FC2_H_ */