forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/scsi/ibmvscsi/ibmvfc.h
....@@ -1,24 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * ibmvfc.h -- driver for IBM Power Virtual Fibre Channel Adapter
34 *
45 * Written By: Brian King <brking@linux.vnet.ibm.com>, IBM Corporation
56 *
67 * Copyright (C) IBM Corporation, 2008
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
- *
228 */
239
2410 #ifndef _IBMVFC_H
....@@ -78,9 +64,14 @@
7864 IBMVFC_CRQ_XPORT_EVENT = 0xFF,
7965 };
8066
81
-enum ibmvfc_crq_format {
67
+enum ibmvfc_crq_init_msg {
8268 IBMVFC_CRQ_INIT = 0x01,
8369 IBMVFC_CRQ_INIT_COMPLETE = 0x02,
70
+};
71
+
72
+enum ibmvfc_crq_xport_evts {
73
+ IBMVFC_PARTNER_FAILED = 0x01,
74
+ IBMVFC_PARTNER_DEREGISTER = 0x02,
8475 IBMVFC_PARTITION_MIGRATED = 0x06,
8576 };
8677
....@@ -129,10 +120,14 @@
129120 IBMVFC_PORT_LOGIN = 0x0004,
130121 IBMVFC_PROCESS_LOGIN = 0x0008,
131122 IBMVFC_QUERY_TARGET = 0x0010,
123
+ IBMVFC_MOVE_LOGIN = 0x0020,
132124 IBMVFC_IMPLICIT_LOGOUT = 0x0040,
133125 IBMVFC_PASSTHRU = 0x0200,
134126 IBMVFC_TMF_MAD = 0x0100,
135127 IBMVFC_NPIV_LOGOUT = 0x0800,
128
+ IBMVFC_CHANNEL_ENQUIRY = 0x1000,
129
+ IBMVFC_CHANNEL_SETUP = 0x2000,
130
+ IBMVFC_CONNECTION_INFO = 0x4000,
136131 };
137132
138133 struct ibmvfc_mad_common {
....@@ -142,16 +137,16 @@
142137 __be16 status;
143138 __be16 length;
144139 __be64 tag;
145
-}__attribute__((packed, aligned (8)));
140
+} __packed __aligned(8);
146141
147142 struct ibmvfc_npiv_login_mad {
148143 struct ibmvfc_mad_common common;
149144 struct srp_direct_buf buffer;
150
-}__attribute__((packed, aligned (8)));
145
+} __packed __aligned(8);
151146
152147 struct ibmvfc_npiv_logout_mad {
153148 struct ibmvfc_mad_common common;
154
-}__attribute__((packed, aligned (8)));
149
+} __packed __aligned(8);
155150
156151 #define IBMVFC_MAX_NAME 256
157152
....@@ -171,13 +166,15 @@
171166 __be32 max_cmds;
172167 __be64 capabilities;
173168 #define IBMVFC_CAN_MIGRATE 0x01
169
+#define IBMVFC_CAN_USE_CHANNELS 0x02
170
+#define IBMVFC_CAN_HANDLE_FPIN 0x04
174171 __be64 node_name;
175172 struct srp_direct_buf async;
176173 u8 partition_name[IBMVFC_MAX_NAME];
177174 u8 device_name[IBMVFC_MAX_NAME];
178175 u8 drc_name[IBMVFC_MAX_NAME];
179176 __be64 reserved2[2];
180
-}__attribute__((packed, aligned (8)));
177
+} __packed __aligned(8);
181178
182179 struct ibmvfc_common_svc_parms {
183180 __be16 fcph_version;
....@@ -186,7 +183,7 @@
186183 __be16 bb_rcv_sz; /* upper nibble is BB_SC_N */
187184 __be32 ratov;
188185 __be32 edtov;
189
-}__attribute__((packed, aligned (4)));
186
+} __packed __aligned(4);
190187
191188 struct ibmvfc_service_parms {
192189 struct ibmvfc_common_svc_parms common;
....@@ -201,7 +198,8 @@
201198 __be32 ext_len;
202199 __be32 reserved[30];
203200 __be32 clk_sync_qos[2];
204
-}__attribute__((packed, aligned (4)));
201
+ __be32 reserved2;
202
+} __packed __aligned(4);
205203
206204 struct ibmvfc_npiv_login_resp {
207205 __be32 version;
....@@ -213,6 +211,7 @@
213211 __be64 capabilities;
214212 #define IBMVFC_CAN_FLUSH_ON_HALT 0x08
215213 #define IBMVFC_CAN_SUPPRESS_ABTS 0x10
214
+#define IBMVFC_CAN_SUPPORT_CHANNELS 0x20
216215 __be32 max_cmds;
217216 __be32 scsi_id_sz;
218217 __be64 max_dma_len;
....@@ -226,29 +225,32 @@
226225 u8 drc_name[IBMVFC_MAX_NAME];
227226 struct ibmvfc_service_parms service_parms;
228227 __be64 reserved2;
229
-}__attribute__((packed, aligned (8)));
228
+} __packed __aligned(8);
230229
231230 union ibmvfc_npiv_login_data {
232231 struct ibmvfc_npiv_login login;
233232 struct ibmvfc_npiv_login_resp resp;
234
-}__attribute__((packed, aligned (8)));
233
+} __packed __aligned(8);
235234
236
-struct ibmvfc_discover_targets_buf {
237
- __be32 scsi_id[1];
235
+struct ibmvfc_discover_targets_entry {
236
+ __be32 scsi_id;
237
+ __be32 pad;
238
+ __be64 wwpn;
238239 #define IBMVFC_DISC_TGT_SCSI_ID_MASK 0x00ffffff
239
-};
240
+} __packed __aligned(8);
240241
241242 struct ibmvfc_discover_targets {
242243 struct ibmvfc_mad_common common;
243244 struct srp_direct_buf buffer;
244245 __be32 flags;
246
+#define IBMVFC_DISC_TGT_PORT_ID_WWPN_LIST 0x02
245247 __be16 status;
246248 __be16 error;
247249 __be32 bufflen;
248250 __be32 num_avail;
249251 __be32 num_written;
250252 __be64 reserved[2];
251
-}__attribute__((packed, aligned (8)));
253
+} __packed __aligned(8);
252254
253255 enum ibmvfc_fc_reason {
254256 IBMVFC_INVALID_ELS_CMD_CODE = 0x01,
....@@ -292,7 +294,27 @@
292294 struct ibmvfc_service_parms service_parms;
293295 struct ibmvfc_service_parms service_parms_change;
294296 __be64 reserved3[2];
295
-}__attribute__((packed, aligned (8)));
297
+} __packed __aligned(8);
298
+
299
+struct ibmvfc_move_login {
300
+ struct ibmvfc_mad_common common;
301
+ __be64 old_scsi_id;
302
+ __be64 new_scsi_id;
303
+ __be64 wwpn;
304
+ __be64 node_name;
305
+ __be32 flags;
306
+#define IBMVFC_MOVE_LOGIN_IMPLICIT_OLD_FAILED 0x01
307
+#define IBMVFC_MOVE_LOGIN_IMPLICIT_NEW_FAILED 0x02
308
+#define IBMVFC_MOVE_LOGIN_PORT_LOGIN_FAILED 0x04
309
+ __be32 reserved;
310
+ struct ibmvfc_service_parms service_parms;
311
+ struct ibmvfc_service_parms service_parms_change;
312
+ __be32 reserved2;
313
+ __be16 service_class;
314
+ __be16 vios_flags;
315
+#define IBMVFC_MOVE_LOGIN_VF_NOT_SENT_ADAPTER 0x01
316
+ __be64 reserved3;
317
+} __packed __aligned(8);
296318
297319 struct ibmvfc_prli_svc_parms {
298320 u8 type;
....@@ -312,7 +334,7 @@
312334 #define IBMVFC_PRLI_TARGET_FUNC 0x00000010
313335 #define IBMVFC_PRLI_READ_FCP_XFER_RDY_DISABLED 0x00000002
314336 #define IBMVFC_PRLI_WR_FCP_XFER_RDY_DISABLED 0x00000001
315
-}__attribute__((packed, aligned (4)));
337
+} __packed __aligned(4);
316338
317339 struct ibmvfc_process_login {
318340 struct ibmvfc_mad_common common;
....@@ -323,7 +345,7 @@
323345 __be16 error; /* also fc_reason */
324346 __be32 reserved2;
325347 __be64 reserved3[2];
326
-}__attribute__((packed, aligned (8)));
348
+} __packed __aligned(8);
327349
328350 struct ibmvfc_query_tgt {
329351 struct ibmvfc_mad_common common;
....@@ -334,13 +356,13 @@
334356 __be16 fc_explain;
335357 __be16 fc_type;
336358 __be64 reserved[2];
337
-}__attribute__((packed, aligned (8)));
359
+} __packed __aligned(8);
338360
339361 struct ibmvfc_implicit_logout {
340362 struct ibmvfc_mad_common common;
341363 __be64 old_scsi_id;
342364 __be64 reserved[2];
343
-}__attribute__((packed, aligned (8)));
365
+} __packed __aligned(8);
344366
345367 struct ibmvfc_tmf {
346368 struct ibmvfc_mad_common common;
....@@ -357,7 +379,7 @@
357379 __be32 my_cancel_key;
358380 __be32 pad;
359381 __be64 reserved[2];
360
-}__attribute__((packed, aligned (8)));
382
+} __packed __aligned(8);
361383
362384 enum ibmvfc_fcp_rsp_info_codes {
363385 RSP_NO_FAILURE = 0x00,
....@@ -370,7 +392,7 @@
370392 u8 reserved[3];
371393 u8 rsp_code;
372394 u8 reserved2[4];
373
-}__attribute__((packed, aligned (2)));
395
+} __packed __aligned(2);
374396
375397 enum ibmvfc_fcp_rsp_flags {
376398 FCP_BIDI_RSP = 0x80,
....@@ -386,7 +408,7 @@
386408 union ibmvfc_fcp_rsp_data {
387409 struct ibmvfc_fcp_rsp_info info;
388410 u8 sense[SCSI_SENSE_BUFFERSIZE + sizeof(struct ibmvfc_fcp_rsp_info)];
389
-}__attribute__((packed, aligned (8)));
411
+} __packed __aligned(8);
390412
391413 struct ibmvfc_fcp_rsp {
392414 __be64 reserved;
....@@ -397,7 +419,7 @@
397419 __be32 fcp_sense_len;
398420 __be32 fcp_rsp_len;
399421 union ibmvfc_fcp_rsp_data data;
400
-}__attribute__((packed, aligned (8)));
422
+} __packed __aligned(8);
401423
402424 enum ibmvfc_cmd_flags {
403425 IBMVFC_SCATTERLIST = 0x0001,
....@@ -431,7 +453,7 @@
431453 #define IBMVFC_WRDATA 0x01
432454 u8 cdb[IBMVFC_MAX_CDB_LEN];
433455 __be32 xfer_len;
434
-}__attribute__((packed, aligned (4)));
456
+} __packed __aligned(4);
435457
436458 struct ibmvfc_cmd {
437459 __be64 task_tag;
....@@ -455,7 +477,7 @@
455477 __be64 reserved3[2];
456478 struct ibmvfc_fcp_cmd_iu iu;
457479 struct ibmvfc_fcp_rsp rsp;
458
-}__attribute__((packed, aligned (8)));
480
+} __packed __aligned(8);
459481
460482 struct ibmvfc_passthru_fc_iu {
461483 __be32 payload[7];
....@@ -482,18 +504,64 @@
482504 __be64 scsi_id;
483505 __be64 tag;
484506 __be64 reserved2[2];
485
-}__attribute__((packed, aligned (8)));
507
+} __packed __aligned(8);
486508
487509 struct ibmvfc_passthru_mad {
488510 struct ibmvfc_mad_common common;
489511 struct srp_direct_buf cmd_ioba;
490512 struct ibmvfc_passthru_iu iu;
491513 struct ibmvfc_passthru_fc_iu fc_iu;
492
-}__attribute__((packed, aligned (8)));
514
+} __packed __aligned(8);
515
+
516
+struct ibmvfc_channel_enquiry {
517
+ struct ibmvfc_mad_common common;
518
+ __be32 flags;
519
+#define IBMVFC_NO_CHANNELS_TO_CRQ_SUPPORT 0x01
520
+#define IBMVFC_SUPPORT_VARIABLE_SUBQ_MSG 0x02
521
+#define IBMVFC_NO_N_TO_M_CHANNELS_SUPPORT 0x04
522
+ __be32 num_scsi_subq_channels;
523
+ __be32 num_nvmeof_subq_channels;
524
+ __be32 num_scsi_vas_channels;
525
+ __be32 num_nvmeof_vas_channels;
526
+} __packed __aligned(8);
527
+
528
+struct ibmvfc_channel_setup_mad {
529
+ struct ibmvfc_mad_common common;
530
+ struct srp_direct_buf buffer;
531
+} __packed __aligned(8);
532
+
533
+#define IBMVFC_MAX_CHANNELS 502
534
+
535
+struct ibmvfc_channel_setup {
536
+ __be32 flags;
537
+#define IBMVFC_CANCEL_CHANNELS 0x01
538
+#define IBMVFC_USE_BUFFER 0x02
539
+#define IBMVFC_CHANNELS_CANCELED 0x04
540
+ __be32 reserved;
541
+ __be32 num_scsi_subq_channels;
542
+ __be32 num_nvmeof_subq_channels;
543
+ __be32 num_scsi_vas_channels;
544
+ __be32 num_nvmeof_vas_channels;
545
+ struct srp_direct_buf buffer;
546
+ __be64 reserved2[5];
547
+ __be64 channel_handles[IBMVFC_MAX_CHANNELS];
548
+} __packed __aligned(8);
549
+
550
+struct ibmvfc_connection_info {
551
+ struct ibmvfc_mad_common common;
552
+ __be64 information_bits;
553
+#define IBMVFC_NO_FC_IO_CHANNEL 0x01
554
+#define IBMVFC_NO_PHYP_VAS 0x02
555
+#define IBMVFC_NO_PHYP_SUBQ 0x04
556
+#define IBMVFC_PHYP_DEPRECATED_SUBQ 0x08
557
+#define IBMVFC_PHYP_PRESERVED_SUBQ 0x10
558
+#define IBMVFC_PHYP_FULL_SUBQ 0x20
559
+ __be64 reserved[16];
560
+} __packed __aligned(8);
493561
494562 struct ibmvfc_trace_start_entry {
495563 u32 xfer_len;
496
-}__attribute__((packed));
564
+} __packed;
497565
498566 struct ibmvfc_trace_end_entry {
499567 u16 status;
....@@ -502,7 +570,7 @@
502570 u8 rsp_code;
503571 u8 scsi_status;
504572 u8 reserved;
505
-}__attribute__((packed));
573
+} __packed;
506574
507575 struct ibmvfc_trace_entry {
508576 struct ibmvfc_event *evt;
....@@ -519,7 +587,7 @@
519587 struct ibmvfc_trace_start_entry start;
520588 struct ibmvfc_trace_end_entry end;
521589 } u;
522
-}__attribute__((packed, aligned (8)));
590
+} __packed __aligned(8);
523591
524592 enum ibmvfc_crq_formats {
525593 IBMVFC_CMD_FORMAT = 0x01,
....@@ -541,6 +609,7 @@
541609 IBMVFC_AE_HALT = 0x0400,
542610 IBMVFC_AE_RESUME = 0x0800,
543611 IBMVFC_AE_ADAPTER_FAILED = 0x1000,
612
+ IBMVFC_AE_FPIN = 0x2000,
544613 };
545614
546615 struct ibmvfc_async_desc {
....@@ -554,7 +623,7 @@
554623 volatile u8 format;
555624 u8 reserved[6];
556625 volatile __be64 ioba;
557
-}__attribute__((packed, aligned (8)));
626
+} __packed __aligned(8);
558627
559628 struct ibmvfc_crq_queue {
560629 struct ibmvfc_crq *msgs;
....@@ -569,17 +638,25 @@
569638 IBMVFC_AE_LS_LINK_DEAD = 0x08,
570639 };
571640
641
+enum ibmvfc_ae_fpin_status {
642
+ IBMVFC_AE_FPIN_LINK_CONGESTED = 0x1,
643
+ IBMVFC_AE_FPIN_PORT_CONGESTED = 0x2,
644
+ IBMVFC_AE_FPIN_PORT_CLEARED = 0x3,
645
+ IBMVFC_AE_FPIN_PORT_DEGRADED = 0x4,
646
+};
647
+
572648 struct ibmvfc_async_crq {
573649 volatile u8 valid;
574650 u8 link_state;
575
- u8 pad[2];
651
+ u8 fpin_status;
652
+ u8 pad;
576653 __be32 pad2;
577654 volatile __be64 event;
578655 volatile __be64 scsi_id;
579656 volatile __be64 wwpn;
580657 volatile __be64 node_name;
581658 __be64 reserved;
582
-}__attribute__((packed, aligned (8)));
659
+} __packed __aligned(8);
583660
584661 struct ibmvfc_async_crq_queue {
585662 struct ibmvfc_async_crq *msgs;
....@@ -594,26 +671,35 @@
594671 struct ibmvfc_discover_targets discover_targets;
595672 struct ibmvfc_port_login plogi;
596673 struct ibmvfc_process_login prli;
674
+ struct ibmvfc_move_login move_login;
597675 struct ibmvfc_query_tgt query_tgt;
598676 struct ibmvfc_implicit_logout implicit_logout;
599677 struct ibmvfc_tmf tmf;
600678 struct ibmvfc_cmd cmd;
601679 struct ibmvfc_passthru_mad passthru;
602
-}__attribute__((packed, aligned (8)));
680
+ struct ibmvfc_channel_enquiry channel_enquiry;
681
+ struct ibmvfc_channel_setup_mad channel_setup;
682
+ struct ibmvfc_connection_info connection_info;
683
+} __packed __aligned(8);
603684
604685 enum ibmvfc_target_action {
605686 IBMVFC_TGT_ACTION_NONE = 0,
606687 IBMVFC_TGT_ACTION_INIT,
607688 IBMVFC_TGT_ACTION_INIT_WAIT,
689
+ IBMVFC_TGT_ACTION_LOGOUT_RPORT,
690
+ IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT,
608691 IBMVFC_TGT_ACTION_DEL_RPORT,
609692 IBMVFC_TGT_ACTION_DELETED_RPORT,
693
+ IBMVFC_TGT_ACTION_DEL_AND_LOGOUT_RPORT,
694
+ IBMVFC_TGT_ACTION_LOGOUT_DELETED_RPORT,
610695 };
611696
612697 struct ibmvfc_target {
613698 struct list_head queue;
614699 struct ibmvfc_host *vhost;
615700 u64 scsi_id;
616
- u64 new_scsi_id;
701
+ u64 wwpn;
702
+ u64 old_scsi_id;
617703 struct fc_rport *rport;
618704 int target_id;
619705 enum ibmvfc_target_action action;
....@@ -709,7 +795,7 @@
709795 dma_addr_t login_buf_dma;
710796 int disc_buf_sz;
711797 int log_level;
712
- struct ibmvfc_discover_targets_buf *disc_buf;
798
+ struct ibmvfc_discover_targets_entry *disc_buf;
713799 struct mutex passthru_mutex;
714800 int task_set;
715801 int init_retries;