qla_edif.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Marvell Fibre Channel HBA Driver
  4. * Copyright (c) 2021 Marvell
  5. */
  6. #ifndef __QLA_EDIF_H
  7. #define __QLA_EDIF_H
  8. struct qla_scsi_host;
  9. #define EDIF_APP_ID 0x73730001
  10. #define EDIF_MAX_INDEX 2048
  11. struct edif_sa_ctl {
  12. struct list_head next;
  13. uint16_t del_index;
  14. uint16_t index;
  15. uint16_t slot;
  16. uint16_t flags;
  17. #define EDIF_SA_CTL_FLG_REPL BIT_0
  18. #define EDIF_SA_CTL_FLG_DEL BIT_1
  19. #define EDIF_SA_CTL_FLG_CLEANUP_DEL BIT_4
  20. // Invalidate Index bit and mirrors QLA_SA_UPDATE_FLAGS_DELETE
  21. unsigned long state;
  22. #define EDIF_SA_CTL_USED 1 /* Active Sa update */
  23. #define EDIF_SA_CTL_PEND 2 /* Waiting for slot */
  24. #define EDIF_SA_CTL_REPL 3 /* Active Replace and Delete */
  25. #define EDIF_SA_CTL_DEL 4 /* Delete Pending */
  26. struct fc_port *fcport;
  27. struct bsg_job *bsg_job;
  28. struct qla_sa_update_frame sa_frame;
  29. };
  30. enum enode_flags_t {
  31. ENODE_ACTIVE = 0x1,
  32. };
  33. struct pur_core {
  34. enum enode_flags_t enode_flags;
  35. spinlock_t pur_lock;
  36. struct list_head head;
  37. };
  38. enum db_flags_t {
  39. EDB_ACTIVE = BIT_0,
  40. };
  41. #define DBELL_ACTIVE(_v) (_v->e_dbell.db_flags & EDB_ACTIVE)
  42. #define DBELL_INACTIVE(_v) (!(_v->e_dbell.db_flags & EDB_ACTIVE))
  43. struct edif_dbell {
  44. enum db_flags_t db_flags;
  45. spinlock_t db_lock;
  46. struct list_head head;
  47. struct bsg_job *dbell_bsg_job;
  48. unsigned long bsg_expire;
  49. };
  50. #define SA_UPDATE_IOCB_TYPE 0x71 /* Security Association Update IOCB entry */
  51. struct sa_update_28xx {
  52. uint8_t entry_type; /* Entry type. */
  53. uint8_t entry_count; /* Entry count. */
  54. uint8_t sys_define; /* System Defined. */
  55. uint8_t entry_status; /* Entry Status. */
  56. uint32_t handle; /* IOCB System handle. */
  57. union {
  58. __le16 nport_handle; /* in: N_PORT handle. */
  59. __le16 comp_sts; /* out: completion status */
  60. #define CS_PORT_EDIF_UNAVAIL 0x28
  61. #define CS_PORT_EDIF_LOGOUT 0x29
  62. #define CS_PORT_EDIF_SUPP_NOT_RDY 0x64
  63. #define CS_PORT_EDIF_INV_REQ 0x66
  64. } u;
  65. uint8_t vp_index;
  66. uint8_t reserved_1;
  67. uint8_t port_id[3];
  68. uint8_t flags;
  69. #define SA_FLAG_INVALIDATE BIT_0
  70. #define SA_FLAG_TX BIT_1 // 1=tx, 0=rx
  71. uint8_t sa_key[32]; /* 256 bit key */
  72. __le32 salt;
  73. __le32 spi;
  74. uint8_t sa_control;
  75. #define SA_CNTL_ENC_FCSP (1 << 3)
  76. #define SA_CNTL_ENC_OPD (2 << 3)
  77. #define SA_CNTL_ENC_MSK (3 << 3) // mask bits 4,3
  78. #define SA_CNTL_AES_GMAC (1 << 2)
  79. #define SA_CNTL_KEY256 (2 << 0)
  80. #define SA_CNTL_KEY128 0
  81. uint8_t reserved_2;
  82. __le16 sa_index; // reserve: bit 11-15
  83. __le16 old_sa_info;
  84. __le16 new_sa_info;
  85. };
  86. #define NUM_ENTRIES 256
  87. #define PUR_GET 1
  88. struct dinfo {
  89. int nodecnt;
  90. int lstate;
  91. };
  92. struct pur_ninfo {
  93. port_id_t pur_sid;
  94. port_id_t pur_did;
  95. uint8_t vp_idx;
  96. short pur_bytes_rcvd;
  97. unsigned short pur_nphdl;
  98. unsigned int pur_rx_xchg_address;
  99. };
  100. struct purexevent {
  101. struct pur_ninfo pur_info;
  102. unsigned char *msgp;
  103. u32 msgp_len;
  104. };
  105. #define N_UNDEF 0
  106. #define N_PUREX 1
  107. struct enode {
  108. struct list_head list;
  109. struct dinfo dinfo;
  110. uint32_t ntype;
  111. union {
  112. struct purexevent purexinfo;
  113. } u;
  114. };
  115. #define RX_ELS_SIZE (roundup(sizeof(struct enode) + ELS_MAX_PAYLOAD, SMP_CACHE_BYTES))
  116. #define EDIF_SESSION_DOWN(_s) \
  117. (qla_ini_mode_enabled(_s->vha) && (_s->disc_state == DSC_DELETE_PEND || \
  118. _s->disc_state == DSC_DELETED || \
  119. !_s->edif.app_sess_online))
  120. #define EDIF_NEGOTIATION_PENDING(_fcport) \
  121. (DBELL_ACTIVE(_fcport->vha) && \
  122. (_fcport->disc_state == DSC_LOGIN_AUTH_PEND))
  123. #define EDIF_SESS_DELETE(_s) \
  124. (qla_ini_mode_enabled(_s->vha) && (_s->disc_state == DSC_DELETE_PEND || \
  125. _s->disc_state == DSC_DELETED))
  126. #endif /* __QLA_EDIF_H */