blob: ce5274a017fa202e02d9a780a33de6d505b0c53b [file] [log] [blame]
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001/*
2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
5 *
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef __BFA_FC_H__
19#define __BFA_FC_H__
20
21#include "bfa_os_inc.h"
22
23typedef u64 wwn_t;
24typedef u64 lun_t;
25
26#define WWN_NULL (0)
27#define FC_SYMNAME_MAX 256 /* max name server symbolic name size */
28#define FC_ALPA_MAX 128
29
30#pragma pack(1)
31
32#define MAC_ADDRLEN (6)
33struct mac_s { u8 mac[MAC_ADDRLEN]; };
34#define mac_t struct mac_s
35
36/*
37 * generic SCSI cdb definition
38 */
39#define SCSI_MAX_CDBLEN 16
40struct scsi_cdb_s {
41 u8 scsi_cdb[SCSI_MAX_CDBLEN];
42};
43#define scsi_cdb_t struct scsi_cdb_s
44
45/* ------------------------------------------------------------
46 * SCSI status byte values
47 * ------------------------------------------------------------
48 */
49#define SCSI_STATUS_GOOD 0x00
50#define SCSI_STATUS_CHECK_CONDITION 0x02
51#define SCSI_STATUS_CONDITION_MET 0x04
52#define SCSI_STATUS_BUSY 0x08
53#define SCSI_STATUS_INTERMEDIATE 0x10
54#define SCSI_STATUS_ICM 0x14 /* intermediate condition met */
55#define SCSI_STATUS_RESERVATION_CONFLICT 0x18
56#define SCSI_STATUS_COMMAND_TERMINATED 0x22
57#define SCSI_STATUS_QUEUE_FULL 0x28
58#define SCSI_STATUS_ACA_ACTIVE 0x30
59
60#define SCSI_MAX_ALLOC_LEN 0xFF /* maximum allocarion length */
61
62/*
63 * Fibre Channel Header Structure (FCHS) definition
64 */
65struct fchs_s {
66#ifdef __BIGENDIAN
67 u32 routing:4; /* routing bits */
68 u32 cat_info:4; /* category info */
69#else
70 u32 cat_info:4; /* category info */
71 u32 routing:4; /* routing bits */
72#endif
73 u32 d_id:24; /* destination identifier */
74
75 u32 cs_ctl:8; /* class specific control */
76 u32 s_id:24; /* source identifier */
77
78 u32 type:8; /* data structure type */
79 u32 f_ctl:24; /* initial frame control */
80
81 u8 seq_id; /* sequence identifier */
82 u8 df_ctl; /* data field control */
83 u16 seq_cnt; /* sequence count */
84
Maggie50444a32010-11-29 18:26:32 -080085 __be16 ox_id; /* originator exchange ID */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070086 u16 rx_id; /* responder exchange ID */
87
88 u32 ro; /* relative offset */
89};
90
91#define FC_SOF_LEN 4
92#define FC_EOF_LEN 4
93#define FC_CRC_LEN 4
94
95/*
96 * Fibre Channel BB_E Header Structure
97 */
98struct fcbbehs_s {
99 u16 ver_rsvd;
100 u32 rsvd[2];
101 u32 rsvd__sof;
102};
103
104#define FC_SEQ_ID_MAX 256
105
106/*
107 * routing bit definitions
108 */
109enum {
110 FC_RTG_FC4_DEV_DATA = 0x0, /* FC-4 Device Data */
111 FC_RTG_EXT_LINK = 0x2, /* Extended Link Data */
112 FC_RTG_FC4_LINK_DATA = 0x3, /* FC-4 Link Data */
113 FC_RTG_VIDEO_DATA = 0x4, /* Video Data */
114 FC_RTG_EXT_HDR = 0x5, /* VFT, IFR or Encapsuled */
115 FC_RTG_BASIC_LINK = 0x8, /* Basic Link data */
116 FC_RTG_LINK_CTRL = 0xC, /* Link Control */
117};
118
119/*
120 * information category for extended link data and FC-4 Link Data
121 */
122enum {
123 FC_CAT_LD_REQUEST = 0x2, /* Request */
124 FC_CAT_LD_REPLY = 0x3, /* Reply */
125 FC_CAT_LD_DIAG = 0xF, /* for DIAG use only */
126};
127
128/*
129 * information category for extended headers (VFT, IFR or encapsulation)
130 */
131enum {
132 FC_CAT_VFT_HDR = 0x0, /* Virtual fabric tagging header */
133 FC_CAT_IFR_HDR = 0x1, /* Inter-Fabric routing header */
134 FC_CAT_ENC_HDR = 0x2, /* Encapsulation header */
135};
136
137/*
138 * information category for FC-4 device data
139 */
140enum {
141 FC_CAT_UNCATEG_INFO = 0x0, /* Uncategorized information */
142 FC_CAT_SOLICIT_DATA = 0x1, /* Solicited Data */
143 FC_CAT_UNSOLICIT_CTRL = 0x2, /* Unsolicited Control */
144 FC_CAT_SOLICIT_CTRL = 0x3, /* Solicited Control */
145 FC_CAT_UNSOLICIT_DATA = 0x4, /* Unsolicited Data */
146 FC_CAT_DATA_DESC = 0x5, /* Data Descriptor */
147 FC_CAT_UNSOLICIT_CMD = 0x6, /* Unsolicited Command */
148 FC_CAT_CMD_STATUS = 0x7, /* Command Status */
149};
150
151/*
152 * information category for Link Control
153 */
154enum {
155 FC_CAT_ACK_1 = 0x00,
156 FC_CAT_ACK_0_N = 0x01,
157 FC_CAT_P_RJT = 0x02,
158 FC_CAT_F_RJT = 0x03,
159 FC_CAT_P_BSY = 0x04,
160 FC_CAT_F_BSY_DATA = 0x05,
161 FC_CAT_F_BSY_LINK_CTL = 0x06,
162 FC_CAT_F_LCR = 0x07,
163 FC_CAT_NTY = 0x08,
164 FC_CAT_END = 0x09,
165};
166
167/*
168 * Type Field Definitions. FC-PH Section 18.5 pg. 165
169 */
170enum {
171 FC_TYPE_BLS = 0x0, /* Basic Link Service */
172 FC_TYPE_ELS = 0x1, /* Extended Link Service */
173 FC_TYPE_IP = 0x5, /* IP */
174 FC_TYPE_FCP = 0x8, /* SCSI-FCP */
175 FC_TYPE_GPP = 0x9, /* SCSI_GPP */
176 FC_TYPE_SERVICES = 0x20, /* Fibre Channel Services */
177 FC_TYPE_FC_FSS = 0x22, /* Fabric Switch Services */
178 FC_TYPE_FC_AL = 0x23, /* FC-AL */
179 FC_TYPE_FC_SNMP = 0x24, /* FC-SNMP */
180 FC_TYPE_FC_SPINFAB = 0xEE, /* SPINFAB */
181 FC_TYPE_FC_DIAG = 0xEF, /* DIAG */
182 FC_TYPE_MAX = 256, /* 256 FC-4 types */
183};
184
185struct fc_fc4types_s {
186 u8 bits[FC_TYPE_MAX / 8];
187};
188
189/*
190 * Frame Control Definitions. FC-PH Table-45. pg. 168
191 */
192enum {
193 FCTL_EC_ORIG = 0x000000, /* exchange originator */
194 FCTL_EC_RESP = 0x800000, /* exchange responder */
195 FCTL_SEQ_INI = 0x000000, /* sequence initiator */
196 FCTL_SEQ_REC = 0x400000, /* sequence recipient */
197 FCTL_FS_EXCH = 0x200000, /* first sequence of xchg */
198 FCTL_LS_EXCH = 0x100000, /* last sequence of xchg */
199 FCTL_END_SEQ = 0x080000, /* last frame of sequence */
200 FCTL_SI_XFER = 0x010000, /* seq initiative transfer */
201 FCTL_RO_PRESENT = 0x000008, /* relative offset present */
202 FCTL_FILLBYTE_MASK = 0x000003 /* , fill byte mask */
203};
204
205/*
206 * Fabric Well Known Addresses
207 */
208enum {
209 FC_MIN_WELL_KNOWN_ADDR = 0xFFFFF0,
210 FC_DOMAIN_CONTROLLER_MASK = 0xFFFC00,
211 FC_ALIAS_SERVER = 0xFFFFF8,
212 FC_MGMT_SERVER = 0xFFFFFA,
213 FC_TIME_SERVER = 0xFFFFFB,
214 FC_NAME_SERVER = 0xFFFFFC,
215 FC_FABRIC_CONTROLLER = 0xFFFFFD,
216 FC_FABRIC_PORT = 0xFFFFFE,
217 FC_BROADCAST_SERVER = 0xFFFFFF
218};
219
220/*
221 * domain/area/port defines
222 */
223#define FC_DOMAIN_MASK 0xFF0000
224#define FC_DOMAIN_SHIFT 16
225#define FC_AREA_MASK 0x00FF00
226#define FC_AREA_SHIFT 8
227#define FC_PORT_MASK 0x0000FF
228#define FC_PORT_SHIFT 0
229
230#define FC_GET_DOMAIN(p) (((p) & FC_DOMAIN_MASK) >> FC_DOMAIN_SHIFT)
231#define FC_GET_AREA(p) (((p) & FC_AREA_MASK) >> FC_AREA_SHIFT)
232#define FC_GET_PORT(p) (((p) & FC_PORT_MASK) >> FC_PORT_SHIFT)
233
234#define FC_DOMAIN_CTRLR(p) (FC_DOMAIN_CONTROLLER_MASK | (FC_GET_DOMAIN(p)))
235
236enum {
237 FC_RXID_ANY = 0xFFFFU,
238};
239
240/*
241 * generic ELS command
242 */
243struct fc_els_cmd_s {
244 u32 els_code:8; /* ELS Command Code */
245 u32 reserved:24;
246};
247
248/*
249 * ELS Command Codes. FC-PH Table-75. pg. 223
250 */
251enum {
252 FC_ELS_LS_RJT = 0x1, /* Link Service Reject. */
253 FC_ELS_ACC = 0x02, /* Accept */
254 FC_ELS_PLOGI = 0x03, /* N_Port Login. */
255 FC_ELS_FLOGI = 0x04, /* F_Port Login. */
256 FC_ELS_LOGO = 0x05, /* Logout. */
257 FC_ELS_ABTX = 0x06, /* Abort Exchange */
258 FC_ELS_RES = 0x08, /* Read Exchange status */
259 FC_ELS_RSS = 0x09, /* Read sequence status block */
260 FC_ELS_RSI = 0x0A, /* Request Sequence Initiative */
261 FC_ELS_ESTC = 0x0C, /* Estimate Credit. */
262 FC_ELS_RTV = 0x0E, /* Read Timeout Value. */
263 FC_ELS_RLS = 0x0F, /* Read Link Status. */
264 FC_ELS_ECHO = 0x10, /* Echo */
265 FC_ELS_TEST = 0x11, /* Test */
266 FC_ELS_RRQ = 0x12, /* Reinstate Recovery Qualifier. */
267 FC_ELS_REC = 0x13, /* Add this for TAPE support in FCR */
268 FC_ELS_PRLI = 0x20, /* Process Login */
269 FC_ELS_PRLO = 0x21, /* Process Logout. */
270 FC_ELS_SCN = 0x22, /* State Change Notification. */
271 FC_ELS_TPRLO = 0x24, /* Third Party Process Logout. */
272 FC_ELS_PDISC = 0x50, /* Discover N_Port Parameters. */
273 FC_ELS_FDISC = 0x51, /* Discover F_Port Parameters. */
274 FC_ELS_ADISC = 0x52, /* Discover Address. */
275 FC_ELS_FARP_REQ = 0x54, /* FARP Request. */
276 FC_ELS_FARP_REP = 0x55, /* FARP Reply. */
277 FC_ELS_FAN = 0x60, /* Fabric Address Notification */
278 FC_ELS_RSCN = 0x61, /* Reg State Change Notification */
279 FC_ELS_SCR = 0x62, /* State Change Registration. */
280 FC_ELS_RTIN = 0x77, /* Mangement server request */
281 FC_ELS_RNID = 0x78, /* Mangement server request */
282 FC_ELS_RLIR = 0x79, /* Registered Link Incident Record */
283
284 FC_ELS_RPSC = 0x7D, /* Report Port Speed Capabilities */
285 FC_ELS_QSA = 0x7E, /* Query Security Attributes. Ref FC-SP */
286 FC_ELS_E2E_LBEACON = 0x81,
287 /* End-to-End Link Beacon */
288 FC_ELS_AUTH = 0x90, /* Authentication. Ref FC-SP */
289 FC_ELS_RFCN = 0x97, /* Request Fabric Change Notification. Ref
290 *FC-SP */
291
292};
293
294/*
295 * Version numbers for FC-PH standards,
296 * used in login to indicate what port
297 * supports. See FC-PH-X table 158.
298 */
299enum {
300 FC_PH_VER_4_3 = 0x09,
301 FC_PH_VER_PH_3 = 0x20,
302};
303
304/*
305 * PDU size defines
306 */
307enum {
308 FC_MIN_PDUSZ = 512,
309 FC_MAX_PDUSZ = 2112,
310};
311
312/*
313 * N_Port PLOGI Common Service Parameters.
314 * FC-PH-x. Figure-76. pg. 308.
315 */
316struct fc_plogi_csp_s {
317 u8 verhi; /* FC-PH high version */
318 u8 verlo; /* FC-PH low version */
Maggie50444a32010-11-29 18:26:32 -0800319 __be16 bbcred; /* BB_Credit */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700320
321#ifdef __BIGENDIAN
322 u8 ciro:1, /* continuously increasing RO */
323 rro:1, /* random relative offset */
324 npiv_supp:1, /* NPIV supported */
325 port_type:1, /* N_Port/F_port */
326 altbbcred:1, /* alternate BB_Credit */
327 resolution:1, /* ms/ns ED_TOV resolution */
328 vvl_info:1, /* VVL Info included */
329 reserved1:1;
330
331 u8 hg_supp:1,
332 query_dbc:1,
333 security:1,
334 sync_cap:1,
335 r_t_tov:1,
336 dh_dup_supp:1,
337 cisc:1, /* continuously increasing seq count */
338 payload:1;
339#else
340 u8 reserved2:2,
341 resolution:1, /* ms/ns ED_TOV resolution */
342 altbbcred:1, /* alternate BB_Credit */
343 port_type:1, /* N_Port/F_port */
344 npiv_supp:1, /* NPIV supported */
345 rro:1, /* random relative offset */
346 ciro:1; /* continuously increasing RO */
347
348 u8 payload:1,
349 cisc:1, /* continuously increasing seq count */
350 dh_dup_supp:1,
351 r_t_tov:1,
352 sync_cap:1,
353 security:1,
354 query_dbc:1,
355 hg_supp:1;
356#endif
357
Maggie50444a32010-11-29 18:26:32 -0800358 __be16 rxsz; /* recieve data_field size */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700359
Maggie50444a32010-11-29 18:26:32 -0800360 __be16 conseq;
361 __be16 ro_bitmap;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700362
Maggie50444a32010-11-29 18:26:32 -0800363 __be32 e_d_tov;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700364};
365
366/*
367 * N_Port PLOGI Class Specific Parameters.
368 * FC-PH-x. Figure 78. pg. 318.
369 */
370struct fc_plogi_clp_s {
371#ifdef __BIGENDIAN
372 u32 class_valid:1;
373 u32 intermix:1; /* class intermix supported if set =1.
374 * valid only for class1. Reserved for
375 * class2 & class3
376 */
377 u32 reserved1:2;
378 u32 sequential:1;
379 u32 reserved2:3;
380#else
381 u32 reserved2:3;
382 u32 sequential:1;
383 u32 reserved1:2;
384 u32 intermix:1; /* class intermix supported if set =1.
385 * valid only for class1. Reserved for
386 * class2 & class3
387 */
388 u32 class_valid:1;
389#endif
390
391 u32 reserved3:24;
392
393 u32 reserved4:16;
394 u32 rxsz:16; /* Receive data_field size */
395
396 u32 reserved5:8;
397 u32 conseq:8;
398 u32 e2e_credit:16; /* end to end credit */
399
400 u32 reserved7:8;
401 u32 ospx:8;
402 u32 reserved8:16;
403};
404
405/* ASCII value for each character in string "BRCD" */
406#define FLOGI_VVL_BRCD 0x42524344
407
408/*
409 * PLOGI els command and reply payload
410 */
411struct fc_logi_s {
412 struct fc_els_cmd_s els_cmd; /* ELS command code */
413 struct fc_plogi_csp_s csp; /* common service params */
414 wwn_t port_name;
415 wwn_t node_name;
416 struct fc_plogi_clp_s class1; /* class 1 service parameters */
417 struct fc_plogi_clp_s class2; /* class 2 service parameters */
418 struct fc_plogi_clp_s class3; /* class 3 service parameters */
419 struct fc_plogi_clp_s class4; /* class 4 service parameters */
420 u8 vvl[16]; /* vendor version level */
421};
422
423/*
424 * LOGO els command payload
425 */
426struct fc_logo_s {
427 struct fc_els_cmd_s els_cmd; /* ELS command code */
428 u32 res1:8;
429 u32 nport_id:24; /* N_Port identifier of source */
430 wwn_t orig_port_name; /* Port name of the LOGO originator */
431};
432
433/*
434 * ADISC els command payload
435 */
436struct fc_adisc_s {
437 struct fc_els_cmd_s els_cmd; /* ELS command code */
438 u32 res1:8;
439 u32 orig_HA:24; /* originator hard address */
440 wwn_t orig_port_name; /* originator port name */
441 wwn_t orig_node_name; /* originator node name */
442 u32 res2:8;
443 u32 nport_id:24; /* originator NPortID */
444};
445
446/*
447 * Exchange status block
448 */
449struct fc_exch_status_blk_s {
450 u32 oxid:16;
451 u32 rxid:16;
452 u32 res1:8;
453 u32 orig_np:24; /* originator NPortID */
454 u32 res2:8;
455 u32 resp_np:24; /* responder NPortID */
456 u32 es_bits;
457 u32 res3;
458 /*
459 * un modified section of the fields
460 */
461};
462
463/*
464 * RES els command payload
465 */
466struct fc_res_s {
467 struct fc_els_cmd_s els_cmd; /* ELS command code */
468 u32 res1:8;
469 u32 nport_id:24; /* N_Port identifier of source */
470 u32 oxid:16;
471 u32 rxid:16;
472 u8 assoc_hdr[32];
473};
474
475/*
476 * RES els accept payload
477 */
478struct fc_res_acc_s {
479 struct fc_els_cmd_s els_cmd; /* ELS command code */
480 struct fc_exch_status_blk_s fc_exch_blk; /* Exchange status block */
481};
482
483/*
484 * REC els command payload
485 */
486struct fc_rec_s {
487 struct fc_els_cmd_s els_cmd; /* ELS command code */
488 u32 res1:8;
489 u32 nport_id:24; /* N_Port identifier of source */
490 u32 oxid:16;
491 u32 rxid:16;
492};
493
494#define FC_REC_ESB_OWN_RSP 0x80000000 /* responder owns */
495#define FC_REC_ESB_SI 0x40000000 /* SI is owned */
496#define FC_REC_ESB_COMP 0x20000000 /* exchange is complete */
497#define FC_REC_ESB_ENDCOND_ABN 0x10000000 /* abnormal ending */
498#define FC_REC_ESB_RQACT 0x04000000 /* recovery qual active */
499#define FC_REC_ESB_ERRP_MSK 0x03000000
500#define FC_REC_ESB_OXID_INV 0x00800000 /* invalid OXID */
501#define FC_REC_ESB_RXID_INV 0x00400000 /* invalid RXID */
502#define FC_REC_ESB_PRIO_INUSE 0x00200000
503
504/*
505 * REC els accept payload
506 */
507struct fc_rec_acc_s {
508 struct fc_els_cmd_s els_cmd; /* ELS command code */
509 u32 oxid:16;
510 u32 rxid:16;
511 u32 res1:8;
512 u32 orig_id:24; /* N_Port id of exchange originator */
513 u32 res2:8;
514 u32 resp_id:24; /* N_Port id of exchange responder */
515 u32 count; /* data transfer count */
516 u32 e_stat; /* exchange status */
517};
518
519/*
520 * RSI els payload
521 */
522struct fc_rsi_s {
523 struct fc_els_cmd_s els_cmd;
524 u32 res1:8;
525 u32 orig_sid:24;
526 u32 oxid:16;
527 u32 rxid:16;
528};
529
530/*
531 * structure for PRLI paramater pages, both request & response
532 * see FC-PH-X table 113 & 115 for explanation also FCP table 8
533 */
534struct fc_prli_params_s {
535 u32 reserved:16;
536#ifdef __BIGENDIAN
537 u32 reserved1:5;
538 u32 rec_support:1;
539 u32 task_retry_id:1;
540 u32 retry:1;
541
542 u32 confirm:1;
543 u32 doverlay:1;
544 u32 initiator:1;
545 u32 target:1;
546 u32 cdmix:1;
547 u32 drmix:1;
548 u32 rxrdisab:1;
549 u32 wxrdisab:1;
550#else
551 u32 retry:1;
552 u32 task_retry_id:1;
553 u32 rec_support:1;
554 u32 reserved1:5;
555
556 u32 wxrdisab:1;
557 u32 rxrdisab:1;
558 u32 drmix:1;
559 u32 cdmix:1;
560 u32 target:1;
561 u32 initiator:1;
562 u32 doverlay:1;
563 u32 confirm:1;
564#endif
565};
566
567/*
568 * valid values for rspcode in PRLI ACC payload
569 */
570enum {
571 FC_PRLI_ACC_XQTD = 0x1, /* request executed */
572 FC_PRLI_ACC_PREDEF_IMG = 0x5, /* predefined image - no prli needed */
573};
574
575struct fc_prli_params_page_s {
576 u32 type:8;
577 u32 codext:8;
578#ifdef __BIGENDIAN
579 u32 origprocasv:1;
580 u32 rsppav:1;
581 u32 imagepair:1;
582 u32 reserved1:1;
583 u32 rspcode:4;
584#else
585 u32 rspcode:4;
586 u32 reserved1:1;
587 u32 imagepair:1;
588 u32 rsppav:1;
589 u32 origprocasv:1;
590#endif
591 u32 reserved2:8;
592
593 u32 origprocas;
594 u32 rspprocas;
595 struct fc_prli_params_s servparams;
596};
597
598/*
599 * PRLI request and accept payload, FC-PH-X tables 112 & 114
600 */
601struct fc_prli_s {
602 u32 command:8;
603 u32 pglen:8;
604 u32 pagebytes:16;
605 struct fc_prli_params_page_s parampage;
606};
607
608/*
609 * PRLO logout params page
610 */
611struct fc_prlo_params_page_s {
612 u32 type:8;
613 u32 type_ext:8;
614#ifdef __BIGENDIAN
615 u32 opa_valid:1; /* originator process associator
616 * valid
617 */
618 u32 rpa_valid:1; /* responder process associator valid */
619 u32 res1:14;
620#else
621 u32 res1:14;
622 u32 rpa_valid:1; /* responder process associator valid */
623 u32 opa_valid:1; /* originator process associator
624 * valid
625 */
626#endif
627 u32 orig_process_assc;
628 u32 resp_process_assc;
629
630 u32 res2;
631};
632
633/*
634 * PRLO els command payload
635 */
636struct fc_prlo_s {
637 u32 command:8;
638 u32 page_len:8;
639 u32 payload_len:16;
640 struct fc_prlo_params_page_s prlo_params[1];
641};
642
643/*
644 * PRLO Logout response parameter page
645 */
646struct fc_prlo_acc_params_page_s {
647 u32 type:8;
648 u32 type_ext:8;
649
650#ifdef __BIGENDIAN
651 u32 opa_valid:1; /* originator process associator
652 * valid
653 */
654 u32 rpa_valid:1; /* responder process associator valid */
655 u32 res1:14;
656#else
657 u32 res1:14;
658 u32 rpa_valid:1; /* responder process associator valid */
659 u32 opa_valid:1; /* originator process associator
660 * valid
661 */
662#endif
663 u32 orig_process_assc;
664 u32 resp_process_assc;
665
666 u32 fc4type_csp;
667};
668
669/*
670 * PRLO els command ACC payload
671 */
672struct fc_prlo_acc_s {
673 u32 command:8;
674 u32 page_len:8;
675 u32 payload_len:16;
676 struct fc_prlo_acc_params_page_s prlo_acc_params[1];
677};
678
679/*
680 * SCR els command payload
681 */
682enum {
683 FC_SCR_REG_FUNC_FABRIC_DETECTED = 0x01,
684 FC_SCR_REG_FUNC_N_PORT_DETECTED = 0x02,
685 FC_SCR_REG_FUNC_FULL = 0x03,
686 FC_SCR_REG_FUNC_CLEAR_REG = 0xFF,
687};
688
689/* SCR VU registrations */
690enum {
691 FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE = 0x01
692};
693
694struct fc_scr_s {
695 u32 command:8;
696 u32 res:24;
697 u32 vu_reg_func:8; /* Vendor Unique Registrations */
698 u32 res1:16;
699 u32 reg_func:8;
700};
701
702/*
703 * Information category for Basic link data
704 */
705enum {
706 FC_CAT_NOP = 0x0,
707 FC_CAT_ABTS = 0x1,
708 FC_CAT_RMC = 0x2,
709 FC_CAT_BA_ACC = 0x4,
710 FC_CAT_BA_RJT = 0x5,
711 FC_CAT_PRMT = 0x6,
712};
713
714/*
715 * LS_RJT els reply payload
716 */
717struct fc_ls_rjt_s {
718 struct fc_els_cmd_s els_cmd; /* ELS command code */
719 u32 res1:8;
720 u32 reason_code:8; /* Reason code for reject */
721 u32 reason_code_expl:8; /* Reason code explanation */
722 u32 vendor_unique:8; /* Vendor specific */
723};
724
725/*
726 * LS_RJT reason codes
727 */
728enum {
729 FC_LS_RJT_RSN_INV_CMD_CODE = 0x01,
730 FC_LS_RJT_RSN_LOGICAL_ERROR = 0x03,
731 FC_LS_RJT_RSN_LOGICAL_BUSY = 0x05,
732 FC_LS_RJT_RSN_PROTOCOL_ERROR = 0x07,
733 FC_LS_RJT_RSN_UNABLE_TO_PERF_CMD = 0x09,
734 FC_LS_RJT_RSN_CMD_NOT_SUPP = 0x0B,
735};
736
737/*
738 * LS_RJT reason code explanation
739 */
740enum {
741 FC_LS_RJT_EXP_NO_ADDL_INFO = 0x00,
742 FC_LS_RJT_EXP_SPARMS_ERR_OPTIONS = 0x01,
743 FC_LS_RJT_EXP_SPARMS_ERR_INI_CTL = 0x03,
744 FC_LS_RJT_EXP_SPARMS_ERR_REC_CTL = 0x05,
745 FC_LS_RJT_EXP_SPARMS_ERR_RXSZ = 0x07,
746 FC_LS_RJT_EXP_SPARMS_ERR_CONSEQ = 0x09,
747 FC_LS_RJT_EXP_SPARMS_ERR_CREDIT = 0x0B,
748 FC_LS_RJT_EXP_INV_PORT_NAME = 0x0D,
749 FC_LS_RJT_EXP_INV_NODE_FABRIC_NAME = 0x0E,
750 FC_LS_RJT_EXP_INV_CSP = 0x0F,
751 FC_LS_RJT_EXP_INV_ASSOC_HDR = 0x11,
752 FC_LS_RJT_EXP_ASSOC_HDR_REQD = 0x13,
753 FC_LS_RJT_EXP_INV_ORIG_S_ID = 0x15,
754 FC_LS_RJT_EXP_INV_OXID_RXID_COMB = 0x17,
755 FC_LS_RJT_EXP_CMD_ALREADY_IN_PROG = 0x19,
756 FC_LS_RJT_EXP_LOGIN_REQUIRED = 0x1E,
757 FC_LS_RJT_EXP_INVALID_NPORT_ID = 0x1F,
758 FC_LS_RJT_EXP_INSUFF_RES = 0x29,
759 FC_LS_RJT_EXP_CMD_NOT_SUPP = 0x2C,
760 FC_LS_RJT_EXP_INV_PAYLOAD_LEN = 0x2D,
761};
762
763/*
764 * RRQ els command payload
765 */
766struct fc_rrq_s {
767 struct fc_els_cmd_s els_cmd; /* ELS command code */
768 u32 res1:8;
769 u32 s_id:24; /* exchange originator S_ID */
770
771 u32 ox_id:16; /* originator exchange ID */
772 u32 rx_id:16; /* responder exchange ID */
773
774 u32 res2[8]; /* optional association header */
775};
776
777/*
778 * ABTS BA_ACC reply payload
779 */
780struct fc_ba_acc_s {
781 u32 seq_id_valid:8; /* set to 0x00 for Abort Exchange */
782 u32 seq_id:8; /* invalid for Abort Exchange */
783 u32 res2:16;
784 u32 ox_id:16; /* OX_ID from ABTS frame */
785 u32 rx_id:16; /* RX_ID from ABTS frame */
786 u32 low_seq_cnt:16; /* set to 0x0000 for Abort Exchange */
787 u32 high_seq_cnt:16;/* set to 0xFFFF for Abort Exchange */
788};
789
790/*
791 * ABTS BA_RJT reject payload
792 */
793struct fc_ba_rjt_s {
794 u32 res1:8; /* Reserved */
795 u32 reason_code:8; /* reason code for reject */
796 u32 reason_expl:8; /* reason code explanation */
797 u32 vendor_unique:8;/* vendor unique reason code,set to 0 */
798};
799
800/*
801 * TPRLO logout parameter page
802 */
803struct fc_tprlo_params_page_s {
804u32 type:8;
805u32 type_ext:8;
806
807#ifdef __BIGENDIAN
808 u32 opa_valid:1;
809 u32 rpa_valid:1;
810 u32 tpo_nport_valid:1;
811 u32 global_process_logout:1;
812 u32 res1:12;
813#else
814 u32 res1:12;
815 u32 global_process_logout:1;
816 u32 tpo_nport_valid:1;
817 u32 rpa_valid:1;
818 u32 opa_valid:1;
819#endif
820
821 u32 orig_process_assc;
822 u32 resp_process_assc;
823
824 u32 res2:8;
825 u32 tpo_nport_id;
826};
827
828/*
829 * TPRLO ELS command payload
830 */
831struct fc_tprlo_s {
832 u32 command:8;
833 u32 page_len:8;
834 u32 payload_len:16;
835
836 struct fc_tprlo_params_page_s tprlo_params[1];
837};
838
839enum fc_tprlo_type {
840 FC_GLOBAL_LOGO = 1,
841 FC_TPR_LOGO
842};
843
844/*
845 * TPRLO els command ACC payload
846 */
847struct fc_tprlo_acc_s {
848 u32 command:8;
849 u32 page_len:8;
850 u32 payload_len:16;
851 struct fc_prlo_acc_params_page_s tprlo_acc_params[1];
852};
853
854/*
855 * RSCN els command req payload
856 */
857#define FC_RSCN_PGLEN 0x4
858
859enum fc_rscn_format {
860 FC_RSCN_FORMAT_PORTID = 0x0,
861 FC_RSCN_FORMAT_AREA = 0x1,
862 FC_RSCN_FORMAT_DOMAIN = 0x2,
863 FC_RSCN_FORMAT_FABRIC = 0x3,
864};
865
866struct fc_rscn_event_s {
867 u32 format:2;
868 u32 qualifier:4;
869 u32 resvd:2;
870 u32 portid:24;
871};
872
873struct fc_rscn_pl_s {
874 u8 command;
875 u8 pagelen;
Maggie50444a32010-11-29 18:26:32 -0800876 __be16 payldlen;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700877 struct fc_rscn_event_s event[1];
878};
879
880/*
881 * ECHO els command req payload
882 */
883struct fc_echo_s {
884 struct fc_els_cmd_s els_cmd;
885};
886
887/*
888 * RNID els command
889 */
890
891#define RNID_NODEID_DATA_FORMAT_COMMON 0x00
892#define RNID_NODEID_DATA_FORMAT_FCP3 0x08
893#define RNID_NODEID_DATA_FORMAT_DISCOVERY 0xDF
894
895#define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
896#define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
897#define RNID_ASSOCIATED_TYPE_HUB 0x00000003
898#define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
899#define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
900#define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
901#define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
902#define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
903#define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
904#define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
905#define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
906#define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
907#define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
908
909/*
910 * RNID els command payload
911 */
912struct fc_rnid_cmd_s {
913 struct fc_els_cmd_s els_cmd;
914 u32 node_id_data_format:8;
915 u32 reserved:24;
916};
917
918/*
919 * RNID els response payload
920 */
921
922struct fc_rnid_common_id_data_s {
923 wwn_t port_name;
924 wwn_t node_name;
925};
926
927struct fc_rnid_general_topology_data_s {
928 u32 vendor_unique[4];
Maggie50444a32010-11-29 18:26:32 -0800929 __be32 asso_type;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700930 u32 phy_port_num;
Maggie50444a32010-11-29 18:26:32 -0800931 __be32 num_attached_nodes;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700932 u32 node_mgmt:8;
933 u32 ip_version:8;
934 u32 udp_tcp_port_num:16;
935 u32 ip_address[4];
936 u32 reserved:16;
937 u32 vendor_specific:16;
938};
939
940struct fc_rnid_acc_s {
941 struct fc_els_cmd_s els_cmd;
942 u32 node_id_data_format:8;
943 u32 common_id_data_length:8;
944 u32 reserved:8;
945 u32 specific_id_data_length:8;
946 struct fc_rnid_common_id_data_s common_id_data;
947 struct fc_rnid_general_topology_data_s gen_topology_data;
948};
949
950#define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
951#define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
952#define RNID_ASSOCIATED_TYPE_HUB 0x00000003
953#define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
954#define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
955#define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
956#define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
957#define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
958#define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
959#define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
960#define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
961#define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
962#define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
963
964enum fc_rpsc_speed_cap {
965 RPSC_SPEED_CAP_1G = 0x8000,
966 RPSC_SPEED_CAP_2G = 0x4000,
967 RPSC_SPEED_CAP_4G = 0x2000,
968 RPSC_SPEED_CAP_10G = 0x1000,
969 RPSC_SPEED_CAP_8G = 0x0800,
970 RPSC_SPEED_CAP_16G = 0x0400,
971
972 RPSC_SPEED_CAP_UNKNOWN = 0x0001,
973};
974
975enum fc_rpsc_op_speed {
976 RPSC_OP_SPEED_1G = 0x8000,
977 RPSC_OP_SPEED_2G = 0x4000,
978 RPSC_OP_SPEED_4G = 0x2000,
979 RPSC_OP_SPEED_10G = 0x1000,
980 RPSC_OP_SPEED_8G = 0x0800,
981 RPSC_OP_SPEED_16G = 0x0400,
982
983 RPSC_OP_SPEED_NOT_EST = 0x0001, /*! speed not established */
984};
985
986struct fc_rpsc_speed_info_s {
Maggie50444a32010-11-29 18:26:32 -0800987 __be16 port_speed_cap; /*! see enum fc_rpsc_speed_cap */
988 __be16 port_op_speed; /*! see enum fc_rpsc_op_speed */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700989};
990
991enum link_e2e_beacon_subcmd {
992 LINK_E2E_BEACON_ON = 1,
993 LINK_E2E_BEACON_OFF = 2
994};
995
996enum beacon_type {
997 BEACON_TYPE_NORMAL = 1, /*! Normal Beaconing. Green */
998 BEACON_TYPE_WARN = 2, /*! Warning Beaconing. Yellow/Amber */
999 BEACON_TYPE_CRITICAL = 3 /*! Critical Beaconing. Red */
1000};
1001
1002struct link_e2e_beacon_param_s {
1003 u8 beacon_type; /* Beacon Type. See enum beacon_type */
1004 u8 beacon_frequency;
1005 /* Beacon frequency. Number of blinks
1006 * per 10 seconds
1007 */
1008 u16 beacon_duration;/* Beacon duration (in Seconds). The
1009 * command operation should be
1010 * terminated at the end of this
1011 * timeout value.
1012 *
1013 * Ignored if diag_sub_cmd is
1014 * LINK_E2E_BEACON_OFF.
1015 *
1016 * If 0, beaconing will continue till a
1017 * BEACON OFF request is received
1018 */
1019};
1020
1021/*
1022 * Link E2E beacon request/good response format.
1023 * For LS_RJTs use struct fc_ls_rjt_s
1024 */
1025struct link_e2e_beacon_req_s {
1026 u32 ls_code; /*! FC_ELS_E2E_LBEACON in requests *
1027 *or FC_ELS_ACC in good replies */
1028 u32 ls_sub_cmd; /*! See enum link_e2e_beacon_subcmd */
1029 struct link_e2e_beacon_param_s beacon_parm;
1030};
1031
Jing Huangacdc79a2010-10-18 17:15:55 -07001032/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001033 * If RPSC request is sent to the Domain Controller, the request is for
1034 * all the ports within that domain (TODO - I don't think FOS implements
1035 * this...).
1036 */
1037struct fc_rpsc_cmd_s {
1038 struct fc_els_cmd_s els_cmd;
1039};
1040
1041/*
1042 * RPSC Acc
1043 */
1044struct fc_rpsc_acc_s {
1045 u32 command:8;
1046 u32 rsvd:8;
1047 u32 num_entries:16;
1048
1049 struct fc_rpsc_speed_info_s speed_info[1];
1050};
1051
Jing Huangacdc79a2010-10-18 17:15:55 -07001052/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001053 * If RPSC2 request is sent to the Domain Controller,
1054 */
1055#define FC_BRCD_TOKEN 0x42524344
1056
1057struct fc_rpsc2_cmd_s {
1058 struct fc_els_cmd_s els_cmd;
Maggie50444a32010-11-29 18:26:32 -08001059 __be32 token;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001060 u16 resvd;
Maggie50444a32010-11-29 18:26:32 -08001061 __be16 num_pids; /* Number of pids in the request */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001062 struct {
1063 u32 rsvd1:8;
1064 u32 pid:24; /* port identifier */
1065 } pid_list[1];
1066};
1067
1068enum fc_rpsc2_port_type {
1069 RPSC2_PORT_TYPE_UNKNOWN = 0,
1070 RPSC2_PORT_TYPE_NPORT = 1,
1071 RPSC2_PORT_TYPE_NLPORT = 2,
1072 RPSC2_PORT_TYPE_NPIV_PORT = 0x5f,
1073 RPSC2_PORT_TYPE_NPORT_TRUNK = 0x6f,
1074};
1075/*
1076 * RPSC2 portInfo entry structure
1077 */
1078struct fc_rpsc2_port_info_s {
Maggie50444a32010-11-29 18:26:32 -08001079 __be32 pid; /* PID */
1080 u16 resvd1;
1081 __be16 index; /* port number / index */
1082 u8 resvd2;
1083 u8 type; /* port type N/NL/... */
1084 __be16 speed; /* port Operating Speed */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001085};
1086
1087/*
1088 * RPSC2 Accept payload
1089 */
1090struct fc_rpsc2_acc_s {
1091 u8 els_cmd;
1092 u8 resvd;
Maggie50444a32010-11-29 18:26:32 -08001093 __be16 num_pids; /* Number of pids in the request */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001094 struct fc_rpsc2_port_info_s port_info[1]; /* port information */
1095};
1096
Jing Huangacdc79a2010-10-18 17:15:55 -07001097/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001098 * bit fields so that multiple classes can be specified
1099 */
1100enum fc_cos {
1101 FC_CLASS_2 = 0x04,
1102 FC_CLASS_3 = 0x08,
1103 FC_CLASS_2_3 = 0x0C,
1104};
1105
1106/*
1107 * symbolic name
1108 */
1109struct fc_symname_s {
1110 u8 symname[FC_SYMNAME_MAX];
1111};
1112
1113struct fc_alpabm_s {
1114 u8 alpa_bm[FC_ALPA_MAX / 8];
1115};
1116
1117/*
1118 * protocol default timeout values
1119 */
1120#define FC_ED_TOV 2
1121#define FC_REC_TOV (FC_ED_TOV + 1)
1122#define FC_RA_TOV 10
1123#define FC_ELS_TOV (2 * FC_RA_TOV)
1124#define FC_FCCT_TOV (3 * FC_RA_TOV)
1125
1126/*
1127 * virtual fabric related defines
1128 */
1129#define FC_VF_ID_NULL 0 /* must not be used as VF_ID */
1130#define FC_VF_ID_MIN 1
1131#define FC_VF_ID_MAX 0xEFF
1132#define FC_VF_ID_CTL 0xFEF /* control VF_ID */
1133
Jing Huangacdc79a2010-10-18 17:15:55 -07001134/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001135 * Virtual Fabric Tagging header format
1136 * @caution This is defined only in BIG ENDIAN format.
1137 */
1138struct fc_vft_s {
1139 u32 r_ctl:8;
1140 u32 ver:2;
1141 u32 type:4;
1142 u32 res_a:2;
1143 u32 priority:3;
1144 u32 vf_id:12;
1145 u32 res_b:1;
1146 u32 hopct:8;
1147 u32 res_c:24;
1148};
1149
1150/*
1151 * FCP
1152 */
1153enum {
1154 FCP_RJT = 0x01000000, /* SRR reject */
1155 FCP_SRR_ACCEPT = 0x02000000, /* SRR accept */
1156 FCP_SRR = 0x14000000, /* Sequence Retransmission Request */
1157};
1158
1159/*
1160 * SRR FC-4 LS payload
1161 */
1162struct fc_srr_s {
1163 u32 ls_cmd;
1164 u32 ox_id:16; /* ox-id */
1165 u32 rx_id:16; /* rx-id */
1166 u32 ro; /* relative offset */
1167 u32 r_ctl:8; /* R_CTL for I.U. */
1168 u32 res:24;
1169};
1170
1171
1172/*
1173 * FCP_CMND definitions
1174 */
1175#define FCP_CMND_CDB_LEN 16
1176#define FCP_CMND_LUN_LEN 8
1177
1178struct fcp_cmnd_s {
1179 lun_t lun; /* 64-bit LU number */
1180 u8 crn; /* command reference number */
1181#ifdef __BIGENDIAN
1182 u8 resvd:1,
1183 priority:4, /* FCP-3: SAM-3 priority */
1184 taskattr:3; /* scsi task attribute */
1185#else
1186 u8 taskattr:3, /* scsi task attribute */
1187 priority:4, /* FCP-3: SAM-3 priority */
1188 resvd:1;
1189#endif
1190 u8 tm_flags; /* task management flags */
1191#ifdef __BIGENDIAN
1192 u8 addl_cdb_len:6, /* additional CDB length words */
1193 iodir:2; /* read/write FCP_DATA IUs */
1194#else
1195 u8 iodir:2, /* read/write FCP_DATA IUs */
1196 addl_cdb_len:6; /* additional CDB length */
1197#endif
1198 scsi_cdb_t cdb;
1199
1200 /*
1201 * !!! additional cdb bytes follows here!!!
1202 */
Maggie50444a32010-11-29 18:26:32 -08001203 __be32 fcp_dl; /* bytes to be transferred */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001204};
1205
1206#define fcp_cmnd_cdb_len(_cmnd) ((_cmnd)->addl_cdb_len * 4 + FCP_CMND_CDB_LEN)
1207#define fcp_cmnd_fcpdl(_cmnd) ((&(_cmnd)->fcp_dl)[(_cmnd)->addl_cdb_len])
1208
1209/*
1210 * struct fcp_cmnd_s .iodir field values
1211 */
1212enum fcp_iodir {
1213 FCP_IODIR_NONE = 0,
1214 FCP_IODIR_WRITE = 1,
1215 FCP_IODIR_READ = 2,
1216 FCP_IODIR_RW = 3,
1217};
1218
1219/*
1220 * Task attribute field
1221 */
1222enum {
1223 FCP_TASK_ATTR_SIMPLE = 0,
1224 FCP_TASK_ATTR_HOQ = 1,
1225 FCP_TASK_ATTR_ORDERED = 2,
1226 FCP_TASK_ATTR_ACA = 4,
1227 FCP_TASK_ATTR_UNTAGGED = 5, /* obsolete in FCP-3 */
1228};
1229
1230/*
1231 * Task management flags field - only one bit shall be set
1232 */
1233enum fcp_tm_cmnd {
1234 FCP_TM_ABORT_TASK_SET = BIT(1),
1235 FCP_TM_CLEAR_TASK_SET = BIT(2),
1236 FCP_TM_LUN_RESET = BIT(4),
1237 FCP_TM_TARGET_RESET = BIT(5), /* obsolete in FCP-3 */
1238 FCP_TM_CLEAR_ACA = BIT(6),
1239};
1240
1241/*
1242 * FCP_XFER_RDY IU defines
1243 */
1244struct fcp_xfer_rdy_s {
1245 u32 data_ro;
1246 u32 burst_len;
1247 u32 reserved;
1248};
1249
1250/*
1251 * FCP_RSP residue flags
1252 */
1253enum fcp_residue {
1254 FCP_NO_RESIDUE = 0, /* no residue */
1255 FCP_RESID_OVER = 1, /* more data left that was not sent */
1256 FCP_RESID_UNDER = 2, /* less data than requested */
1257};
1258
1259enum {
1260 FCP_RSPINFO_GOOD = 0,
1261 FCP_RSPINFO_DATALEN_MISMATCH = 1,
1262 FCP_RSPINFO_CMND_INVALID = 2,
1263 FCP_RSPINFO_ROLEN_MISMATCH = 3,
1264 FCP_RSPINFO_TM_NOT_SUPP = 4,
1265 FCP_RSPINFO_TM_FAILED = 5,
1266};
1267
1268struct fcp_rspinfo_s {
1269 u32 res0:24;
1270 u32 rsp_code:8; /* response code (as above) */
1271 u32 res1;
1272};
1273
1274struct fcp_resp_s {
1275 u32 reserved[2]; /* 2 words reserved */
1276 u16 reserved2;
1277#ifdef __BIGENDIAN
1278 u8 reserved3:3;
1279 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1280 u8 resid_flags:2; /* underflow/overflow */
1281 u8 sns_len_valid:1;/* sense len is valid */
1282 u8 rsp_len_valid:1;/* response len is valid */
1283#else
1284 u8 rsp_len_valid:1;/* response len is valid */
1285 u8 sns_len_valid:1;/* sense len is valid */
1286 u8 resid_flags:2; /* underflow/overflow */
1287 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1288 u8 reserved3:3;
1289#endif
1290 u8 scsi_status; /* one byte SCSI status */
1291 u32 residue; /* residual data bytes */
1292 u32 sns_len; /* length od sense info */
1293 u32 rsp_len; /* length of response info */
1294};
1295
1296#define fcp_snslen(__fcprsp) ((__fcprsp)->sns_len_valid ? \
1297 (__fcprsp)->sns_len : 0)
1298#define fcp_rsplen(__fcprsp) ((__fcprsp)->rsp_len_valid ? \
1299 (__fcprsp)->rsp_len : 0)
1300#define fcp_rspinfo(__fcprsp) ((struct fcp_rspinfo_s *)((__fcprsp) + 1))
1301#define fcp_snsinfo(__fcprsp) (((u8 *)fcp_rspinfo(__fcprsp)) + \
1302 fcp_rsplen(__fcprsp))
1303
1304struct fcp_cmnd_fr_s {
1305 struct fchs_s fchs;
1306 struct fcp_cmnd_s fcp;
1307};
1308
1309/*
1310 * CT
1311 */
1312struct ct_hdr_s {
1313 u32 rev_id:8; /* Revision of the CT */
1314 u32 in_id:24; /* Initiator Id */
1315 u32 gs_type:8; /* Generic service Type */
1316 u32 gs_sub_type:8; /* Generic service sub type */
1317 u32 options:8; /* options */
1318 u32 rsvrd:8; /* reserved */
1319 u32 cmd_rsp_code:16;/* ct command/response code */
1320 u32 max_res_size:16;/* maximum/residual size */
1321 u32 frag_id:8; /* fragment ID */
1322 u32 reason_code:8; /* reason code */
1323 u32 exp_code:8; /* explanation code */
1324 u32 vendor_unq:8; /* vendor unique */
1325};
1326
1327/*
1328 * defines for the Revision
1329 */
1330enum {
1331 CT_GS3_REVISION = 0x01,
1332};
1333
1334/*
1335 * defines for gs_type
1336 */
1337enum {
1338 CT_GSTYPE_KEYSERVICE = 0xF7,
1339 CT_GSTYPE_ALIASSERVICE = 0xF8,
1340 CT_GSTYPE_MGMTSERVICE = 0xFA,
1341 CT_GSTYPE_TIMESERVICE = 0xFB,
1342 CT_GSTYPE_DIRSERVICE = 0xFC,
1343};
1344
1345/*
1346 * defines for gs_sub_type for gs type directory service
1347 */
1348enum {
1349 CT_GSSUBTYPE_NAMESERVER = 0x02,
1350};
1351
1352/*
1353 * defines for gs_sub_type for gs type management service
1354 */
1355enum {
1356 CT_GSSUBTYPE_CFGSERVER = 0x01,
1357 CT_GSSUBTYPE_UNZONED_NS = 0x02,
1358 CT_GSSUBTYPE_ZONESERVER = 0x03,
1359 CT_GSSUBTYPE_LOCKSERVER = 0x04,
1360 CT_GSSUBTYPE_HBA_MGMTSERVER = 0x10, /* for FDMI */
1361};
1362
1363/*
1364 * defines for CT response code field
1365 */
1366enum {
1367 CT_RSP_REJECT = 0x8001,
1368 CT_RSP_ACCEPT = 0x8002,
1369};
1370
1371/*
1372 * defintions for CT reason code
1373 */
1374enum {
1375 CT_RSN_INV_CMD = 0x01,
1376 CT_RSN_INV_VER = 0x02,
1377 CT_RSN_LOGIC_ERR = 0x03,
1378 CT_RSN_INV_SIZE = 0x04,
1379 CT_RSN_LOGICAL_BUSY = 0x05,
1380 CT_RSN_PROTO_ERR = 0x07,
1381 CT_RSN_UNABLE_TO_PERF = 0x09,
1382 CT_RSN_NOT_SUPP = 0x0B,
1383 CT_RSN_SERVER_NOT_AVBL = 0x0D,
1384 CT_RSN_SESSION_COULD_NOT_BE_ESTBD = 0x0E,
1385 CT_RSN_VENDOR_SPECIFIC = 0xFF,
1386
1387};
1388
1389/*
1390 * definitions for explanations code for Name server
1391 */
1392enum {
1393 CT_NS_EXP_NOADDITIONAL = 0x00,
1394 CT_NS_EXP_ID_NOT_REG = 0x01,
1395 CT_NS_EXP_PN_NOT_REG = 0x02,
1396 CT_NS_EXP_NN_NOT_REG = 0x03,
1397 CT_NS_EXP_CS_NOT_REG = 0x04,
1398 CT_NS_EXP_IPN_NOT_REG = 0x05,
1399 CT_NS_EXP_IPA_NOT_REG = 0x06,
1400 CT_NS_EXP_FT_NOT_REG = 0x07,
1401 CT_NS_EXP_SPN_NOT_REG = 0x08,
1402 CT_NS_EXP_SNN_NOT_REG = 0x09,
1403 CT_NS_EXP_PT_NOT_REG = 0x0A,
1404 CT_NS_EXP_IPP_NOT_REG = 0x0B,
1405 CT_NS_EXP_FPN_NOT_REG = 0x0C,
1406 CT_NS_EXP_HA_NOT_REG = 0x0D,
1407 CT_NS_EXP_FD_NOT_REG = 0x0E,
1408 CT_NS_EXP_FF_NOT_REG = 0x0F,
1409 CT_NS_EXP_ACCESSDENIED = 0x10,
1410 CT_NS_EXP_UNACCEPTABLE_ID = 0x11,
1411 CT_NS_EXP_DATABASEEMPTY = 0x12,
1412 CT_NS_EXP_NOT_REG_IN_SCOPE = 0x13,
1413 CT_NS_EXP_DOM_ID_NOT_PRESENT = 0x14,
1414 CT_NS_EXP_PORT_NUM_NOT_PRESENT = 0x15,
1415 CT_NS_EXP_NO_DEVICE_ATTACHED = 0x16
1416};
1417
1418/*
1419 * defintions for the explanation code for all servers
1420 */
1421enum {
1422 CT_EXP_AUTH_EXCEPTION = 0xF1,
1423 CT_EXP_DB_FULL = 0xF2,
1424 CT_EXP_DB_EMPTY = 0xF3,
1425 CT_EXP_PROCESSING_REQ = 0xF4,
1426 CT_EXP_UNABLE_TO_VERIFY_CONN = 0xF5,
1427 CT_EXP_DEVICES_NOT_IN_CMN_ZONE = 0xF6
1428};
1429
1430/*
1431 * Command codes for Name server
1432 */
1433enum {
1434 GS_GID_PN = 0x0121, /* Get Id on port name */
1435 GS_GPN_ID = 0x0112, /* Get port name on ID */
1436 GS_GNN_ID = 0x0113, /* Get node name on ID */
1437 GS_GID_FT = 0x0171, /* Get Id on FC4 type */
1438 GS_GSPN_ID = 0x0118, /* Get symbolic PN on ID */
1439 GS_RFT_ID = 0x0217, /* Register fc4type on ID */
1440 GS_RSPN_ID = 0x0218, /* Register symbolic PN on ID */
1441 GS_RPN_ID = 0x0212, /* Register port name */
1442 GS_RNN_ID = 0x0213, /* Register node name */
1443 GS_RCS_ID = 0x0214, /* Register class of service */
1444 GS_RPT_ID = 0x021A, /* Register port type */
1445 GS_GA_NXT = 0x0100, /* Get all next */
1446 GS_RFF_ID = 0x021F, /* Register FC4 Feature */
1447};
1448
1449struct fcgs_id_req_s{
1450 u32 rsvd:8;
1451 u32 dap:24; /* port identifier */
1452};
1453#define fcgs_gpnid_req_t struct fcgs_id_req_s
1454#define fcgs_gnnid_req_t struct fcgs_id_req_s
1455#define fcgs_gspnid_req_t struct fcgs_id_req_s
1456
1457struct fcgs_gidpn_req_s {
1458 wwn_t port_name; /* port wwn */
1459};
1460
1461struct fcgs_gidpn_resp_s {
1462 u32 rsvd:8;
1463 u32 dap:24; /* port identifier */
1464};
1465
Jing Huangacdc79a2010-10-18 17:15:55 -07001466/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001467 * RFT_ID
1468 */
1469struct fcgs_rftid_req_s {
1470 u32 rsvd:8;
1471 u32 dap:24; /* port identifier */
Maggie50444a32010-11-29 18:26:32 -08001472 __be32 fc4_type[8]; /* fc4 types */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001473};
1474
Jing Huangacdc79a2010-10-18 17:15:55 -07001475/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001476 * RFF_ID : Register FC4 features.
1477 */
1478
1479#define FC_GS_FCP_FC4_FEATURE_INITIATOR 0x02
1480#define FC_GS_FCP_FC4_FEATURE_TARGET 0x01
1481
1482struct fcgs_rffid_req_s {
1483 u32 rsvd:8;
1484 u32 dap:24; /* port identifier */
1485 u32 rsvd1:16;
1486 u32 fc4ftr_bits:8; /* fc4 feature bits */
1487 u32 fc4_type:8; /* corresponding FC4 Type */
1488};
1489
Jing Huangacdc79a2010-10-18 17:15:55 -07001490/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001491 * GID_FT Request
1492 */
1493struct fcgs_gidft_req_s {
1494 u8 reserved;
1495 u8 domain_id; /* domain, 0 - all fabric */
1496 u8 area_id; /* area, 0 - whole domain */
1497 u8 fc4_type; /* FC_TYPE_FCP for SCSI devices */
1498}; /* GID_FT Request */
1499
Jing Huangacdc79a2010-10-18 17:15:55 -07001500/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001501 * GID_FT Response
1502 */
1503struct fcgs_gidft_resp_s {
1504 u8 last:1; /* last port identifier flag */
1505 u8 reserved:7;
1506 u32 pid:24; /* port identifier */
1507}; /* GID_FT Response */
1508
Jing Huangacdc79a2010-10-18 17:15:55 -07001509/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001510 * RSPN_ID
1511 */
1512struct fcgs_rspnid_req_s {
1513 u32 rsvd:8;
1514 u32 dap:24; /* port identifier */
1515 u8 spn_len; /* symbolic port name length */
1516 u8 spn[256]; /* symbolic port name */
1517};
1518
Jing Huangacdc79a2010-10-18 17:15:55 -07001519/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001520 * RPN_ID
1521 */
1522struct fcgs_rpnid_req_s {
1523 u32 rsvd:8;
1524 u32 port_id:24;
1525 wwn_t port_name;
1526};
1527
Jing Huangacdc79a2010-10-18 17:15:55 -07001528/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001529 * RNN_ID
1530 */
1531struct fcgs_rnnid_req_s {
1532 u32 rsvd:8;
1533 u32 port_id:24;
1534 wwn_t node_name;
1535};
1536
Jing Huangacdc79a2010-10-18 17:15:55 -07001537/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001538 * RCS_ID
1539 */
1540struct fcgs_rcsid_req_s {
1541 u32 rsvd:8;
1542 u32 port_id:24;
1543 u32 cos;
1544};
1545
Jing Huangacdc79a2010-10-18 17:15:55 -07001546/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001547 * RPT_ID
1548 */
1549struct fcgs_rptid_req_s {
1550 u32 rsvd:8;
1551 u32 port_id:24;
1552 u32 port_type:8;
1553 u32 rsvd1:24;
1554};
1555
Jing Huangacdc79a2010-10-18 17:15:55 -07001556/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001557 * GA_NXT Request
1558 */
1559struct fcgs_ganxt_req_s {
1560 u32 rsvd:8;
1561 u32 port_id:24;
1562};
1563
Jing Huangacdc79a2010-10-18 17:15:55 -07001564/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001565 * GA_NXT Response
1566 */
1567struct fcgs_ganxt_rsp_s {
1568 u32 port_type:8; /* Port Type */
1569 u32 port_id:24; /* Port Identifier */
1570 wwn_t port_name; /* Port Name */
1571 u8 spn_len; /* Length of Symbolic Port Name */
1572 char spn[255]; /* Symbolic Port Name */
1573 wwn_t node_name; /* Node Name */
1574 u8 snn_len; /* Length of Symbolic Node Name */
1575 char snn[255]; /* Symbolic Node Name */
1576 u8 ipa[8]; /* Initial Process Associator */
1577 u8 ip[16]; /* IP Address */
1578 u32 cos; /* Class of Service */
1579 u32 fc4types[8]; /* FC-4 TYPEs */
1580 wwn_t fabric_port_name;
1581 /* Fabric Port Name */
1582 u32 rsvd:8; /* Reserved */
1583 u32 hard_addr:24; /* Hard Address */
1584};
1585
1586/*
1587 * Fabric Config Server
1588 */
1589
1590/*
1591 * Command codes for Fabric Configuration Server
1592 */
1593enum {
1594 GS_FC_GFN_CMD = 0x0114, /* GS FC Get Fabric Name */
1595 GS_FC_GMAL_CMD = 0x0116, /* GS FC GMAL */
1596 GS_FC_TRACE_CMD = 0x0400, /* GS FC Trace Route */
1597 GS_FC_PING_CMD = 0x0401, /* GS FC Ping */
1598};
1599
1600/*
1601 * Source or Destination Port Tags.
1602 */
1603enum {
1604 GS_FTRACE_TAG_NPORT_ID = 1,
1605 GS_FTRACE_TAG_NPORT_NAME = 2,
1606};
1607
1608/*
1609* Port Value : Could be a Port id or wwn
1610 */
1611union fcgs_port_val_u {
1612 u32 nport_id;
1613 wwn_t nport_wwn;
1614};
1615
1616#define GS_FTRACE_MAX_HOP_COUNT 20
1617#define GS_FTRACE_REVISION 1
1618
1619/*
1620 * Ftrace Related Structures.
1621 */
1622
1623/*
1624 * STR (Switch Trace) Reject Reason Codes. From FC-SW.
1625 */
1626enum {
1627 GS_FTRACE_STR_CMD_COMPLETED_SUCC = 0,
1628 GS_FTRACE_STR_CMD_NOT_SUPP_IN_NEXT_SWITCH,
1629 GS_FTRACE_STR_NO_RESP_FROM_NEXT_SWITCH,
1630 GS_FTRACE_STR_MAX_HOP_CNT_REACHED,
1631 GS_FTRACE_STR_SRC_PORT_NOT_FOUND,
1632 GS_FTRACE_STR_DST_PORT_NOT_FOUND,
1633 GS_FTRACE_STR_DEVICES_NOT_IN_COMMON_ZONE,
1634 GS_FTRACE_STR_NO_ROUTE_BW_PORTS,
1635 GS_FTRACE_STR_NO_ADDL_EXPLN,
1636 GS_FTRACE_STR_FABRIC_BUSY,
1637 GS_FTRACE_STR_FABRIC_BUILD_IN_PROGRESS,
1638 GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_START = 0xf0,
1639 GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_END = 0xff,
1640};
1641
1642/*
1643 * Ftrace Request
1644 */
1645struct fcgs_ftrace_req_s {
1646 u32 revision;
1647 u16 src_port_tag; /* Source Port tag */
1648 u16 src_port_len; /* Source Port len */
1649 union fcgs_port_val_u src_port_val; /* Source Port value */
1650 u16 dst_port_tag; /* Destination Port tag */
1651 u16 dst_port_len; /* Destination Port len */
1652 union fcgs_port_val_u dst_port_val; /* Destination Port value */
1653 u32 token;
1654 u8 vendor_id[8]; /* T10 Vendor Identifier */
1655 u8 vendor_info[8]; /* Vendor specific Info */
1656 u32 max_hop_cnt; /* Max Hop Count */
1657};
1658
1659/*
1660 * Path info structure
1661 */
1662struct fcgs_ftrace_path_info_s {
1663 wwn_t switch_name; /* Switch WWN */
1664 u32 domain_id;
1665 wwn_t ingress_port_name; /* Ingress ports wwn */
1666 u32 ingress_phys_port_num; /* Ingress ports physical port
1667 * number
1668 */
1669 wwn_t egress_port_name; /* Ingress ports wwn */
1670 u32 egress_phys_port_num; /* Ingress ports physical port
1671 * number
1672 */
1673};
1674
1675/*
1676 * Ftrace Acc Response
1677 */
1678struct fcgs_ftrace_resp_s {
1679 u32 revision;
1680 u32 token;
1681 u8 vendor_id[8]; /* T10 Vendor Identifier */
1682 u8 vendor_info[8]; /* Vendor specific Info */
1683 u32 str_rej_reason_code; /* STR Reject Reason Code */
1684 u32 num_path_info_entries; /* No. of path info entries */
1685 /*
1686 * path info entry/entries.
1687 */
1688 struct fcgs_ftrace_path_info_s path_info[1];
1689
1690};
1691
1692/*
1693* Fabric Config Server : FCPing
1694 */
1695
1696/*
1697 * FC Ping Request
1698 */
1699struct fcgs_fcping_req_s {
1700 u32 revision;
1701 u16 port_tag;
1702 u16 port_len; /* Port len */
1703 union fcgs_port_val_u port_val; /* Port value */
1704 u32 token;
1705};
1706
1707/*
1708 * FC Ping Response
1709 */
1710struct fcgs_fcping_resp_s {
1711 u32 token;
1712};
1713
1714/*
1715 * Command codes for zone server query.
1716 */
1717enum {
1718 ZS_GZME = 0x0124, /* Get zone member extended */
1719};
1720
1721/*
1722 * ZS GZME request
1723 */
1724#define ZS_GZME_ZNAMELEN 32
1725struct zs_gzme_req_s {
1726 u8 znamelen;
1727 u8 rsvd[3];
1728 u8 zname[ZS_GZME_ZNAMELEN];
1729};
1730
1731enum zs_mbr_type {
1732 ZS_MBR_TYPE_PWWN = 1,
1733 ZS_MBR_TYPE_DOMPORT = 2,
1734 ZS_MBR_TYPE_PORTID = 3,
1735 ZS_MBR_TYPE_NWWN = 4,
1736};
1737
1738struct zs_mbr_wwn_s {
1739 u8 mbr_type;
1740 u8 rsvd[3];
1741 wwn_t wwn;
1742};
1743
1744struct zs_query_resp_s {
1745 u32 nmbrs; /* number of zone members */
1746 struct zs_mbr_wwn_s mbr[1];
1747};
1748
1749/*
1750 * GMAL Command ( Get ( interconnect Element) Management Address List)
1751 * To retrieve the IP Address of a Switch.
1752 */
1753
1754#define CT_GMAL_RESP_PREFIX_TELNET "telnet://"
1755#define CT_GMAL_RESP_PREFIX_HTTP "http://"
1756
1757/* GMAL/GFN request */
1758struct fcgs_req_s {
1759 wwn_t wwn; /* PWWN/NWWN */
1760};
1761
1762#define fcgs_gmal_req_t struct fcgs_req_s
1763#define fcgs_gfn_req_t struct fcgs_req_s
1764
1765/* Accept Response to GMAL */
1766struct fcgs_gmal_resp_s {
Maggie50444a32010-11-29 18:26:32 -08001767 __be32 ms_len; /* Num of entries */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001768 u8 ms_ma[256];
1769};
1770
1771struct fcgs_gmal_entry_s {
1772 u8 len;
1773 u8 prefix[7]; /* like "http://" */
1774 u8 ip_addr[248];
1775};
1776
1777/*
1778 * FDMI
1779 */
1780/*
1781 * FDMI Command Codes
1782 */
1783#define FDMI_GRHL 0x0100
1784#define FDMI_GHAT 0x0101
1785#define FDMI_GRPL 0x0102
1786#define FDMI_GPAT 0x0110
1787#define FDMI_RHBA 0x0200
1788#define FDMI_RHAT 0x0201
1789#define FDMI_RPRT 0x0210
1790#define FDMI_RPA 0x0211
1791#define FDMI_DHBA 0x0300
1792#define FDMI_DPRT 0x0310
1793
1794/*
1795 * FDMI reason codes
1796 */
1797#define FDMI_NO_ADDITIONAL_EXP 0x00
1798#define FDMI_HBA_ALREADY_REG 0x10
1799#define FDMI_HBA_ATTRIB_NOT_REG 0x11
1800#define FDMI_HBA_ATTRIB_MULTIPLE 0x12
1801#define FDMI_HBA_ATTRIB_LENGTH_INVALID 0x13
1802#define FDMI_HBA_ATTRIB_NOT_PRESENT 0x14
1803#define FDMI_PORT_ORIG_NOT_IN_LIST 0x15
1804#define FDMI_PORT_HBA_NOT_IN_LIST 0x16
1805#define FDMI_PORT_ATTRIB_NOT_REG 0x20
1806#define FDMI_PORT_NOT_REG 0x21
1807#define FDMI_PORT_ATTRIB_MULTIPLE 0x22
1808#define FDMI_PORT_ATTRIB_LENGTH_INVALID 0x23
1809#define FDMI_PORT_ALREADY_REGISTEREED 0x24
1810
1811/*
1812 * FDMI Transmission Speed Mask values
1813 */
1814#define FDMI_TRANS_SPEED_1G 0x00000001
1815#define FDMI_TRANS_SPEED_2G 0x00000002
1816#define FDMI_TRANS_SPEED_10G 0x00000004
1817#define FDMI_TRANS_SPEED_4G 0x00000008
1818#define FDMI_TRANS_SPEED_8G 0x00000010
1819#define FDMI_TRANS_SPEED_16G 0x00000020
1820#define FDMI_TRANS_SPEED_UNKNOWN 0x00008000
1821
1822/*
1823 * FDMI HBA attribute types
1824 */
1825enum fdmi_hba_attribute_type {
1826 FDMI_HBA_ATTRIB_NODENAME = 1, /* 0x0001 */
1827 FDMI_HBA_ATTRIB_MANUFACTURER, /* 0x0002 */
1828 FDMI_HBA_ATTRIB_SERIALNUM, /* 0x0003 */
1829 FDMI_HBA_ATTRIB_MODEL, /* 0x0004 */
1830 FDMI_HBA_ATTRIB_MODEL_DESC, /* 0x0005 */
1831 FDMI_HBA_ATTRIB_HW_VERSION, /* 0x0006 */
1832 FDMI_HBA_ATTRIB_DRIVER_VERSION, /* 0x0007 */
1833 FDMI_HBA_ATTRIB_ROM_VERSION, /* 0x0008 */
1834 FDMI_HBA_ATTRIB_FW_VERSION, /* 0x0009 */
1835 FDMI_HBA_ATTRIB_OS_NAME, /* 0x000A */
1836 FDMI_HBA_ATTRIB_MAX_CT, /* 0x000B */
1837
1838 FDMI_HBA_ATTRIB_MAX_TYPE
1839};
1840
1841/*
1842 * FDMI Port attribute types
1843 */
1844enum fdmi_port_attribute_type {
1845 FDMI_PORT_ATTRIB_FC4_TYPES = 1, /* 0x0001 */
1846 FDMI_PORT_ATTRIB_SUPP_SPEED, /* 0x0002 */
1847 FDMI_PORT_ATTRIB_PORT_SPEED, /* 0x0003 */
1848 FDMI_PORT_ATTRIB_FRAME_SIZE, /* 0x0004 */
1849 FDMI_PORT_ATTRIB_DEV_NAME, /* 0x0005 */
1850 FDMI_PORT_ATTRIB_HOST_NAME, /* 0x0006 */
1851
1852 FDMI_PORT_ATTR_MAX_TYPE
1853};
1854
1855/*
1856 * FDMI attribute
1857 */
1858struct fdmi_attr_s {
Maggie50444a32010-11-29 18:26:32 -08001859 __be16 type;
1860 __be16 len;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001861 u8 value[1];
1862};
1863
1864/*
1865 * HBA Attribute Block
1866 */
1867struct fdmi_hba_attr_s {
Maggie50444a32010-11-29 18:26:32 -08001868 __be32 attr_count; /* # of attributes */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001869 struct fdmi_attr_s hba_attr; /* n attributes */
1870};
1871
1872/*
1873 * Registered Port List
1874 */
1875struct fdmi_port_list_s {
Maggie50444a32010-11-29 18:26:32 -08001876 __be32 num_ports; /* number Of Port Entries */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001877 wwn_t port_entry; /* one or more */
1878};
1879
1880/*
1881 * Port Attribute Block
1882 */
1883struct fdmi_port_attr_s {
Maggie50444a32010-11-29 18:26:32 -08001884 __be32 attr_count; /* # of attributes */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001885 struct fdmi_attr_s port_attr; /* n attributes */
1886};
1887
1888/*
1889 * FDMI Register HBA Attributes
1890 */
1891struct fdmi_rhba_s {
1892 wwn_t hba_id; /* HBA Identifier */
1893 struct fdmi_port_list_s port_list; /* Registered Port List */
1894 struct fdmi_hba_attr_s hba_attr_blk; /* HBA attribute block */
1895};
1896
1897/*
1898 * FDMI Register Port
1899 */
1900struct fdmi_rprt_s {
1901 wwn_t hba_id; /* HBA Identifier */
1902 wwn_t port_name; /* Port wwn */
1903 struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
1904};
1905
1906/*
1907 * FDMI Register Port Attributes
1908 */
1909struct fdmi_rpa_s {
1910 wwn_t port_name; /* port wwn */
1911 struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
1912};
1913
1914#pragma pack()
1915
1916#endif /* __BFA_FC_H__ */