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 #define EDIF_VERSION1 1
12 /* BSG Vendor specific commands */
13 #define ELS_MAX_PAYLOAD 2112
17 #define VND_CMD_APP_RESERVED_SIZE 28
18 #define VND_CMD_PAD_SIZE 3
19 enum auth_els_sub_cmd
{
25 struct extra_auth_els
{
26 enum auth_els_sub_cmd sub_cmd
;
27 uint32_t extra_rx_xchg_address
;
28 uint8_t extra_control_flags
;
29 #define BSG_CTL_FLAG_INIT 0
30 #define BSG_CTL_FLAG_LS_ACC 1
31 #define BSG_CTL_FLAG_LS_RJT 2
32 #define BSG_CTL_FLAG_TRM 3
35 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
38 struct qla_bsg_auth_els_request
{
39 struct fc_bsg_request r
;
40 struct extra_auth_els e
;
43 struct qla_bsg_auth_els_reply
{
44 struct fc_bsg_reply r
;
45 uint32_t rx_xchg_address
;
47 uint8_t pad
[VND_CMD_PAD_SIZE
];
48 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
54 uint8_t pad
[VND_CMD_PAD_SIZE
];
55 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
58 struct app_start_reply
{
59 uint32_t host_support_edif
;
60 uint32_t edif_enode_active
;
61 uint32_t edif_edb_active
;
63 uint8_t pad
[VND_CMD_PAD_SIZE
];
64 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
68 struct app_id app_info
;
69 uint8_t app_start_flags
;
72 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
76 struct app_id app_info
;
78 uint8_t pad
[VND_CMD_PAD_SIZE
];
79 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
82 struct app_plogi_reply
{
85 uint8_t pad
[VND_CMD_PAD_SIZE
];
86 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
89 struct app_pinfo_req
{
90 struct app_id app_info
;
97 #elif defined(__LITTLE_ENDIAN)
102 #error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined!"
107 uint8_t pad
[VND_CMD_PAD_SIZE
];
108 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
112 port_id_t remote_pid
;
113 uint8_t remote_wwpn
[WWN_SIZE
];
115 #define VND_CMD_RTYPE_UNKNOWN 0
116 #define VND_CMD_RTYPE_TARGET 1
117 #define VND_CMD_RTYPE_INITIATOR 2
118 uint8_t remote_state
;
121 uint8_t pad
[VND_CMD_PAD_SIZE
];
122 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
126 #define VND_CMD_AUTH_STATE_UNDEF 0
127 #define VND_CMD_AUTH_STATE_SESSION_SHUTDOWN 1
128 #define VND_CMD_AUTH_STATE_NEEDED 2
129 #define VND_CMD_AUTH_STATE_ELS_RCVD 3
130 #define VND_CMD_AUTH_STATE_SAUPDATE_COMPL 4
132 struct app_pinfo_reply
{
135 uint8_t pad
[VND_CMD_PAD_SIZE
];
136 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
137 struct app_pinfo ports
[];
140 struct app_sinfo_req
{
141 struct app_id app_info
;
144 uint8_t pad
[VND_CMD_PAD_SIZE
];
145 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
149 uint8_t remote_wwpn
[WWN_SIZE
];
156 struct app_stats_reply
{
159 uint8_t pad
[VND_CMD_PAD_SIZE
];
160 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
161 struct app_sinfo elem
[];
164 struct qla_sa_update_frame
{
165 struct app_id app_info
;
167 #define SAU_FLG_INV 0x01 /* delete key */
168 #define SAU_FLG_TX 0x02 /* 1=tx, 0 = rx */
169 #define SAU_FLG_FORCE_DELETE 0x08
170 #define SAU_FLG_GMAC_MODE 0x20 /*
171 * GMAC mode is cleartext for the IO
172 * (i.e. NULL encryption)
174 #define SAU_FLG_KEY128 0x40
175 #define SAU_FLG_KEY256 0x80
176 uint16_t fast_sa_index
:10,
181 uint8_t node_name
[WWN_SIZE
];
182 uint8_t port_name
[WWN_SIZE
];
185 uint8_t pad
[VND_CMD_PAD_SIZE
];
186 uint8_t reserved2
[VND_CMD_APP_RESERVED_SIZE
];
189 #define QL_VND_SC_UNDEF 0
190 #define QL_VND_SC_SA_UPDATE 1
191 #define QL_VND_SC_APP_START 2
192 #define QL_VND_SC_APP_STOP 3
193 #define QL_VND_SC_AUTH_OK 4
194 #define QL_VND_SC_AUTH_FAIL 5
195 #define QL_VND_SC_REKEY_CONFIG 6
196 #define QL_VND_SC_GET_FCINFO 7
197 #define QL_VND_SC_GET_STATS 8
198 #define QL_VND_SC_AEN_COMPLETE 9
199 #define QL_VND_SC_READ_DBELL 10
202 * bsg caller to provide empty buffer for doorbell events.
204 * sg_io_v4.din_xferp = empty buffer for door bell events
205 * sg_io_v4.dout_xferp = struct edif_read_dbell *buf
207 struct edif_read_dbell
{
208 struct app_id app_info
;
210 uint8_t pad
[VND_CMD_PAD_SIZE
];
211 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
215 /* Application interface data structure for rtn data */
216 #define EXT_DEF_EVENT_DATA_SIZE 64
217 struct edif_app_dbell
{
219 uint32_t event_data_size
;
222 uint8_t event_data
[EXT_DEF_EVENT_DATA_SIZE
];
226 struct edif_sa_update_aen
{
228 uint32_t key_type
; /* Tx (1) or RX (2) */
229 uint32_t status
; /* 0 succes, 1 failed, 2 timeout , 3 error */
231 uint8_t pad
[VND_CMD_PAD_SIZE
];
232 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
235 #define QL_VND_SA_STAT_SUCCESS 0
236 #define QL_VND_SA_STAT_FAILED 1
237 #define QL_VND_SA_STAT_TIMEOUT 2
238 #define QL_VND_SA_STAT_ERROR 3
240 #define QL_VND_RX_SA_KEY 1
241 #define QL_VND_TX_SA_KEY 2
243 /* App defines for plogi auth'd ok and plogi auth bad requests */
244 struct auth_complete_cmd
{
245 struct app_id app_info
;
246 #define PL_TYPE_WWPN 1
247 #define PL_TYPE_DID 2
250 uint8_t wwpn
[WWN_SIZE
];
254 uint8_t pad
[VND_CMD_PAD_SIZE
];
255 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
258 struct aen_complete_cmd
{
259 struct app_id app_info
;
263 uint8_t pad
[VND_CMD_PAD_SIZE
];
264 uint8_t reserved
[VND_CMD_APP_RESERVED_SIZE
];
267 #define RX_DELAY_DELETE_TIMEOUT 20
269 #define FCH_EVT_VENDOR_UNIQUE_VPORT_DOWN 1
271 #endif /* QLA_EDIF_BSG_H */