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