fc_fc2.h 3.9 KB

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