1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Marvell Fibre Channel HBA Driver
4 * Copyright (C) 2018- Marvell
7 #ifndef __QLA_EDIF_BSG_H
8 #define __QLA_EDIF_BSG_H
10 /* BSG Vendor specific commands */
11 #define ELS_MAX_PAYLOAD 2112
15 #define VND_CMD_APP_RESERVED_SIZE 32
17 enum auth_els_sub_cmd {
23 struct extra_auth_els {
24 enum auth_els_sub_cmd sub_cmd;
25 uint32_t extra_rx_xchg_address;
26 uint8_t extra_control_flags;
27 #define BSG_CTL_FLAG_INIT 0
28 #define BSG_CTL_FLAG_LS_ACC 1
29 #define BSG_CTL_FLAG_LS_RJT 2
30 #define BSG_CTL_FLAG_TRM 3
31 uint8_t extra_rsvd[3];
34 struct qla_bsg_auth_els_request {
35 struct fc_bsg_request r;
36 struct extra_auth_els e;
39 struct qla_bsg_auth_els_reply {
40 struct fc_bsg_reply r;
41 uint32_t rx_xchg_address;
49 struct app_start_reply {
50 uint32_t host_support_edif;
51 uint32_t edif_enode_active;
52 uint32_t edif_edb_active;
53 uint32_t reserved[VND_CMD_APP_RESERVED_SIZE];
57 struct app_id app_info;
60 uint8_t app_start_flags;
61 uint8_t reserved[VND_CMD_APP_RESERVED_SIZE - 1];
65 struct app_id app_info;
69 struct app_plogi_reply {
71 uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
77 struct app_rekey_cfg {
78 struct app_id app_info;
87 uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
90 struct app_pinfo_req {
91 struct app_id app_info;
94 uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
99 uint8_t remote_wwpn[WWN_SIZE];
101 #define VND_CMD_RTYPE_UNKNOWN 0
102 #define VND_CMD_RTYPE_TARGET 1
103 #define VND_CMD_RTYPE_INITIATOR 2
104 uint8_t remote_state;
108 int64_t rekey_config_value;
109 int64_t rekey_consumed_value;
111 uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
115 #define VND_CMD_AUTH_STATE_UNDEF 0
116 #define VND_CMD_AUTH_STATE_SESSION_SHUTDOWN 1
117 #define VND_CMD_AUTH_STATE_NEEDED 2
118 #define VND_CMD_AUTH_STATE_ELS_RCVD 3
119 #define VND_CMD_AUTH_STATE_SAUPDATE_COMPL 4
121 struct app_pinfo_reply {
123 uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
124 struct app_pinfo ports[0];
127 struct app_sinfo_req {
128 struct app_id app_info;
130 uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
134 uint8_t remote_wwpn[WWN_SIZE];
141 struct app_stats_reply {
143 struct app_sinfo elem[0];
146 struct qla_sa_update_frame {
147 struct app_id app_info;
149 #define SAU_FLG_INV 0x01 /* delete key */
150 #define SAU_FLG_TX 0x02 /* 1=tx, 0 = rx */
151 #define SAU_FLG_FORCE_DELETE 0x08
152 #define SAU_FLG_GMAC_MODE 0x20 /*
153 * GMAC mode is cleartext for the IO
154 * (i.e. NULL encryption)
156 #define SAU_FLG_KEY128 0x40
157 #define SAU_FLG_KEY256 0x80
158 uint16_t fast_sa_index:10,
163 uint8_t node_name[WWN_SIZE];
164 uint8_t port_name[WWN_SIZE];
168 // used for edif mgmt bsg interface
169 #define QL_VND_SC_UNDEF 0
170 #define QL_VND_SC_SA_UPDATE 1
171 #define QL_VND_SC_APP_START 2
172 #define QL_VND_SC_APP_STOP 3
173 #define QL_VND_SC_AUTH_OK 4
174 #define QL_VND_SC_AUTH_FAIL 5
175 #define QL_VND_SC_REKEY_CONFIG 6
176 #define QL_VND_SC_GET_FCINFO 7
177 #define QL_VND_SC_GET_STATS 8
179 /* Application interface data structure for rtn data */
180 #define EXT_DEF_EVENT_DATA_SIZE 64
181 struct edif_app_dbell {
183 uint32_t event_data_size;
186 uint8_t event_data[EXT_DEF_EVENT_DATA_SIZE];
190 struct edif_sa_update_aen {
192 uint32_t key_type; /* Tx (1) or RX (2) */
193 uint32_t status; /* 0 succes, 1 failed, 2 timeout , 3 error */
194 uint8_t reserved[16];
197 #define QL_VND_SA_STAT_SUCCESS 0
198 #define QL_VND_SA_STAT_FAILED 1
199 #define QL_VND_SA_STAT_TIMEOUT 2
200 #define QL_VND_SA_STAT_ERROR 3
202 #define QL_VND_RX_SA_KEY 1
203 #define QL_VND_TX_SA_KEY 2
205 /* App defines for plogi auth'd ok and plogi auth bad requests */
206 struct auth_complete_cmd {
207 struct app_id app_info;
208 #define PL_TYPE_WWPN 1
209 #define PL_TYPE_DID 2
212 uint8_t wwpn[WWN_SIZE];
215 uint32_t reserved[VND_CMD_APP_RESERVED_SIZE];
218 #define RX_DELAY_DELETE_TIMEOUT 20
220 #endif /* QLA_EDIF_BSG_H */