blob: 8d0b88f67a382e3582c40382d7dfe3892a19f3c8 [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 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070027
28#pragma pack(1)
29
30#define MAC_ADDRLEN (6)
31struct mac_s { u8 mac[MAC_ADDRLEN]; };
32#define mac_t struct mac_s
33
34/*
35 * generic SCSI cdb definition
36 */
37#define SCSI_MAX_CDBLEN 16
38struct scsi_cdb_s {
39 u8 scsi_cdb[SCSI_MAX_CDBLEN];
40};
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070041
42/* ------------------------------------------------------------
43 * SCSI status byte values
44 * ------------------------------------------------------------
45 */
46#define SCSI_STATUS_GOOD 0x00
47#define SCSI_STATUS_CHECK_CONDITION 0x02
48#define SCSI_STATUS_CONDITION_MET 0x04
49#define SCSI_STATUS_BUSY 0x08
50#define SCSI_STATUS_INTERMEDIATE 0x10
51#define SCSI_STATUS_ICM 0x14 /* intermediate condition met */
52#define SCSI_STATUS_RESERVATION_CONFLICT 0x18
53#define SCSI_STATUS_COMMAND_TERMINATED 0x22
54#define SCSI_STATUS_QUEUE_FULL 0x28
55#define SCSI_STATUS_ACA_ACTIVE 0x30
56
57#define SCSI_MAX_ALLOC_LEN 0xFF /* maximum allocarion length */
58
59/*
60 * Fibre Channel Header Structure (FCHS) definition
61 */
62struct fchs_s {
Maggie Zhangf16a1752010-12-09 19:12:32 -080063#ifdef __BIG_ENDIAN
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070064 u32 routing:4; /* routing bits */
65 u32 cat_info:4; /* category info */
66#else
67 u32 cat_info:4; /* category info */
68 u32 routing:4; /* routing bits */
69#endif
70 u32 d_id:24; /* destination identifier */
71
72 u32 cs_ctl:8; /* class specific control */
73 u32 s_id:24; /* source identifier */
74
Jing Huang8f4bfad2010-12-26 21:50:10 -080075 u32 type:8; /* data structure type */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070076 u32 f_ctl:24; /* initial frame control */
77
Jing Huang8f4bfad2010-12-26 21:50:10 -080078 u8 seq_id; /* sequence identifier */
79 u8 df_ctl; /* data field control */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070080 u16 seq_cnt; /* sequence count */
81
Jing Huang8f4bfad2010-12-26 21:50:10 -080082 __be16 ox_id; /* originator exchange ID */
83 u16 rx_id; /* responder exchange ID */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070084
85 u32 ro; /* relative offset */
86};
87
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070088/*
89 * routing bit definitions
90 */
91enum {
92 FC_RTG_FC4_DEV_DATA = 0x0, /* FC-4 Device Data */
93 FC_RTG_EXT_LINK = 0x2, /* Extended Link Data */
94 FC_RTG_FC4_LINK_DATA = 0x3, /* FC-4 Link Data */
95 FC_RTG_VIDEO_DATA = 0x4, /* Video Data */
96 FC_RTG_EXT_HDR = 0x5, /* VFT, IFR or Encapsuled */
97 FC_RTG_BASIC_LINK = 0x8, /* Basic Link data */
98 FC_RTG_LINK_CTRL = 0xC, /* Link Control */
99};
100
101/*
102 * information category for extended link data and FC-4 Link Data
103 */
104enum {
105 FC_CAT_LD_REQUEST = 0x2, /* Request */
106 FC_CAT_LD_REPLY = 0x3, /* Reply */
107 FC_CAT_LD_DIAG = 0xF, /* for DIAG use only */
108};
109
110/*
111 * information category for extended headers (VFT, IFR or encapsulation)
112 */
113enum {
114 FC_CAT_VFT_HDR = 0x0, /* Virtual fabric tagging header */
115 FC_CAT_IFR_HDR = 0x1, /* Inter-Fabric routing header */
116 FC_CAT_ENC_HDR = 0x2, /* Encapsulation header */
117};
118
119/*
120 * information category for FC-4 device data
121 */
122enum {
123 FC_CAT_UNCATEG_INFO = 0x0, /* Uncategorized information */
124 FC_CAT_SOLICIT_DATA = 0x1, /* Solicited Data */
125 FC_CAT_UNSOLICIT_CTRL = 0x2, /* Unsolicited Control */
126 FC_CAT_SOLICIT_CTRL = 0x3, /* Solicited Control */
127 FC_CAT_UNSOLICIT_DATA = 0x4, /* Unsolicited Data */
128 FC_CAT_DATA_DESC = 0x5, /* Data Descriptor */
129 FC_CAT_UNSOLICIT_CMD = 0x6, /* Unsolicited Command */
130 FC_CAT_CMD_STATUS = 0x7, /* Command Status */
131};
132
133/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700134 * Type Field Definitions. FC-PH Section 18.5 pg. 165
135 */
136enum {
137 FC_TYPE_BLS = 0x0, /* Basic Link Service */
138 FC_TYPE_ELS = 0x1, /* Extended Link Service */
139 FC_TYPE_IP = 0x5, /* IP */
140 FC_TYPE_FCP = 0x8, /* SCSI-FCP */
141 FC_TYPE_GPP = 0x9, /* SCSI_GPP */
142 FC_TYPE_SERVICES = 0x20, /* Fibre Channel Services */
143 FC_TYPE_FC_FSS = 0x22, /* Fabric Switch Services */
144 FC_TYPE_FC_AL = 0x23, /* FC-AL */
145 FC_TYPE_FC_SNMP = 0x24, /* FC-SNMP */
146 FC_TYPE_FC_SPINFAB = 0xEE, /* SPINFAB */
147 FC_TYPE_FC_DIAG = 0xEF, /* DIAG */
148 FC_TYPE_MAX = 256, /* 256 FC-4 types */
149};
150
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700151/*
152 * Frame Control Definitions. FC-PH Table-45. pg. 168
153 */
154enum {
155 FCTL_EC_ORIG = 0x000000, /* exchange originator */
156 FCTL_EC_RESP = 0x800000, /* exchange responder */
157 FCTL_SEQ_INI = 0x000000, /* sequence initiator */
158 FCTL_SEQ_REC = 0x400000, /* sequence recipient */
159 FCTL_FS_EXCH = 0x200000, /* first sequence of xchg */
160 FCTL_LS_EXCH = 0x100000, /* last sequence of xchg */
161 FCTL_END_SEQ = 0x080000, /* last frame of sequence */
162 FCTL_SI_XFER = 0x010000, /* seq initiative transfer */
163 FCTL_RO_PRESENT = 0x000008, /* relative offset present */
164 FCTL_FILLBYTE_MASK = 0x000003 /* , fill byte mask */
165};
166
167/*
168 * Fabric Well Known Addresses
169 */
170enum {
171 FC_MIN_WELL_KNOWN_ADDR = 0xFFFFF0,
172 FC_DOMAIN_CONTROLLER_MASK = 0xFFFC00,
173 FC_ALIAS_SERVER = 0xFFFFF8,
174 FC_MGMT_SERVER = 0xFFFFFA,
175 FC_TIME_SERVER = 0xFFFFFB,
176 FC_NAME_SERVER = 0xFFFFFC,
177 FC_FABRIC_CONTROLLER = 0xFFFFFD,
178 FC_FABRIC_PORT = 0xFFFFFE,
179 FC_BROADCAST_SERVER = 0xFFFFFF
180};
181
182/*
183 * domain/area/port defines
184 */
185#define FC_DOMAIN_MASK 0xFF0000
186#define FC_DOMAIN_SHIFT 16
187#define FC_AREA_MASK 0x00FF00
188#define FC_AREA_SHIFT 8
189#define FC_PORT_MASK 0x0000FF
190#define FC_PORT_SHIFT 0
191
192#define FC_GET_DOMAIN(p) (((p) & FC_DOMAIN_MASK) >> FC_DOMAIN_SHIFT)
193#define FC_GET_AREA(p) (((p) & FC_AREA_MASK) >> FC_AREA_SHIFT)
194#define FC_GET_PORT(p) (((p) & FC_PORT_MASK) >> FC_PORT_SHIFT)
195
196#define FC_DOMAIN_CTRLR(p) (FC_DOMAIN_CONTROLLER_MASK | (FC_GET_DOMAIN(p)))
197
198enum {
199 FC_RXID_ANY = 0xFFFFU,
200};
201
202/*
203 * generic ELS command
204 */
205struct fc_els_cmd_s {
206 u32 els_code:8; /* ELS Command Code */
207 u32 reserved:24;
208};
209
210/*
211 * ELS Command Codes. FC-PH Table-75. pg. 223
212 */
213enum {
214 FC_ELS_LS_RJT = 0x1, /* Link Service Reject. */
215 FC_ELS_ACC = 0x02, /* Accept */
216 FC_ELS_PLOGI = 0x03, /* N_Port Login. */
217 FC_ELS_FLOGI = 0x04, /* F_Port Login. */
218 FC_ELS_LOGO = 0x05, /* Logout. */
219 FC_ELS_ABTX = 0x06, /* Abort Exchange */
220 FC_ELS_RES = 0x08, /* Read Exchange status */
221 FC_ELS_RSS = 0x09, /* Read sequence status block */
222 FC_ELS_RSI = 0x0A, /* Request Sequence Initiative */
223 FC_ELS_ESTC = 0x0C, /* Estimate Credit. */
224 FC_ELS_RTV = 0x0E, /* Read Timeout Value. */
225 FC_ELS_RLS = 0x0F, /* Read Link Status. */
226 FC_ELS_ECHO = 0x10, /* Echo */
227 FC_ELS_TEST = 0x11, /* Test */
228 FC_ELS_RRQ = 0x12, /* Reinstate Recovery Qualifier. */
229 FC_ELS_REC = 0x13, /* Add this for TAPE support in FCR */
230 FC_ELS_PRLI = 0x20, /* Process Login */
231 FC_ELS_PRLO = 0x21, /* Process Logout. */
232 FC_ELS_SCN = 0x22, /* State Change Notification. */
233 FC_ELS_TPRLO = 0x24, /* Third Party Process Logout. */
234 FC_ELS_PDISC = 0x50, /* Discover N_Port Parameters. */
235 FC_ELS_FDISC = 0x51, /* Discover F_Port Parameters. */
236 FC_ELS_ADISC = 0x52, /* Discover Address. */
237 FC_ELS_FARP_REQ = 0x54, /* FARP Request. */
238 FC_ELS_FARP_REP = 0x55, /* FARP Reply. */
239 FC_ELS_FAN = 0x60, /* Fabric Address Notification */
240 FC_ELS_RSCN = 0x61, /* Reg State Change Notification */
241 FC_ELS_SCR = 0x62, /* State Change Registration. */
242 FC_ELS_RTIN = 0x77, /* Mangement server request */
243 FC_ELS_RNID = 0x78, /* Mangement server request */
244 FC_ELS_RLIR = 0x79, /* Registered Link Incident Record */
245
246 FC_ELS_RPSC = 0x7D, /* Report Port Speed Capabilities */
247 FC_ELS_QSA = 0x7E, /* Query Security Attributes. Ref FC-SP */
248 FC_ELS_E2E_LBEACON = 0x81,
249 /* End-to-End Link Beacon */
250 FC_ELS_AUTH = 0x90, /* Authentication. Ref FC-SP */
251 FC_ELS_RFCN = 0x97, /* Request Fabric Change Notification. Ref
252 *FC-SP */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700253};
254
255/*
256 * Version numbers for FC-PH standards,
257 * used in login to indicate what port
258 * supports. See FC-PH-X table 158.
259 */
260enum {
261 FC_PH_VER_4_3 = 0x09,
262 FC_PH_VER_PH_3 = 0x20,
263};
264
265/*
266 * PDU size defines
267 */
268enum {
269 FC_MIN_PDUSZ = 512,
270 FC_MAX_PDUSZ = 2112,
271};
272
273/*
274 * N_Port PLOGI Common Service Parameters.
275 * FC-PH-x. Figure-76. pg. 308.
276 */
277struct fc_plogi_csp_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -0800278 u8 verhi; /* FC-PH high version */
279 u8 verlo; /* FC-PH low version */
280 __be16 bbcred; /* BB_Credit */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700281
Maggie Zhangf16a1752010-12-09 19:12:32 -0800282#ifdef __BIG_ENDIAN
Jing Huang8f4bfad2010-12-26 21:50:10 -0800283 u8 ciro:1, /* continuously increasing RO */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700284 rro:1, /* random relative offset */
285 npiv_supp:1, /* NPIV supported */
286 port_type:1, /* N_Port/F_port */
287 altbbcred:1, /* alternate BB_Credit */
288 resolution:1, /* ms/ns ED_TOV resolution */
289 vvl_info:1, /* VVL Info included */
290 reserved1:1;
291
Jing Huang8f4bfad2010-12-26 21:50:10 -0800292 u8 hg_supp:1,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700293 query_dbc:1,
294 security:1,
295 sync_cap:1,
296 r_t_tov:1,
297 dh_dup_supp:1,
298 cisc:1, /* continuously increasing seq count */
299 payload:1;
300#else
Jing Huang8f4bfad2010-12-26 21:50:10 -0800301 u8 reserved2:2,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700302 resolution:1, /* ms/ns ED_TOV resolution */
303 altbbcred:1, /* alternate BB_Credit */
304 port_type:1, /* N_Port/F_port */
305 npiv_supp:1, /* NPIV supported */
306 rro:1, /* random relative offset */
307 ciro:1; /* continuously increasing RO */
308
Jing Huang8f4bfad2010-12-26 21:50:10 -0800309 u8 payload:1,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700310 cisc:1, /* continuously increasing seq count */
311 dh_dup_supp:1,
312 r_t_tov:1,
313 sync_cap:1,
314 security:1,
315 query_dbc:1,
316 hg_supp:1;
317#endif
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300318 __be16 rxsz; /* receive data_field size */
Jing Huang8f4bfad2010-12-26 21:50:10 -0800319 __be16 conseq;
320 __be16 ro_bitmap;
321 __be32 e_d_tov;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700322};
323
324/*
325 * N_Port PLOGI Class Specific Parameters.
326 * FC-PH-x. Figure 78. pg. 318.
327 */
328struct fc_plogi_clp_s {
Maggie Zhangf16a1752010-12-09 19:12:32 -0800329#ifdef __BIG_ENDIAN
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700330 u32 class_valid:1;
331 u32 intermix:1; /* class intermix supported if set =1.
Jing Huang8f4bfad2010-12-26 21:50:10 -0800332 * valid only for class1. Reserved for
333 * class2 & class3 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700334 u32 reserved1:2;
335 u32 sequential:1;
336 u32 reserved2:3;
337#else
338 u32 reserved2:3;
339 u32 sequential:1;
340 u32 reserved1:2;
341 u32 intermix:1; /* class intermix supported if set =1.
Jing Huang8f4bfad2010-12-26 21:50:10 -0800342 * valid only for class1. Reserved for
343 * class2 & class3 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700344 u32 class_valid:1;
345#endif
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700346 u32 reserved3:24;
347
348 u32 reserved4:16;
349 u32 rxsz:16; /* Receive data_field size */
350
351 u32 reserved5:8;
352 u32 conseq:8;
Jing Huang8f4bfad2010-12-26 21:50:10 -0800353 u32 e2e_credit:16; /* end to end credit */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700354
355 u32 reserved7:8;
356 u32 ospx:8;
357 u32 reserved8:16;
358};
359
360/* ASCII value for each character in string "BRCD" */
361#define FLOGI_VVL_BRCD 0x42524344
362
363/*
364 * PLOGI els command and reply payload
365 */
366struct fc_logi_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -0800367 struct fc_els_cmd_s els_cmd; /* ELS command code */
368 struct fc_plogi_csp_s csp; /* common service params */
369 wwn_t port_name;
370 wwn_t node_name;
371 struct fc_plogi_clp_s class1; /* class 1 service parameters */
372 struct fc_plogi_clp_s class2; /* class 2 service parameters */
373 struct fc_plogi_clp_s class3; /* class 3 service parameters */
374 struct fc_plogi_clp_s class4; /* class 4 service parameters */
375 u8 vvl[16]; /* vendor version level */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700376};
377
378/*
379 * LOGO els command payload
380 */
381struct fc_logo_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -0800382 struct fc_els_cmd_s els_cmd; /* ELS command code */
383 u32 res1:8;
384 u32 nport_id:24; /* N_Port identifier of source */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700385 wwn_t orig_port_name; /* Port name of the LOGO originator */
386};
387
388/*
389 * ADISC els command payload
390 */
391struct fc_adisc_s {
392 struct fc_els_cmd_s els_cmd; /* ELS command code */
Jing Huang8f4bfad2010-12-26 21:50:10 -0800393 u32 res1:8;
394 u32 orig_HA:24; /* originator hard address */
395 wwn_t orig_port_name; /* originator port name */
396 wwn_t orig_node_name; /* originator node name */
397 u32 res2:8;
398 u32 nport_id:24; /* originator NPortID */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700399};
400
401/*
402 * Exchange status block
403 */
404struct fc_exch_status_blk_s {
405 u32 oxid:16;
406 u32 rxid:16;
407 u32 res1:8;
408 u32 orig_np:24; /* originator NPortID */
409 u32 res2:8;
410 u32 resp_np:24; /* responder NPortID */
411 u32 es_bits;
412 u32 res3;
413 /*
414 * un modified section of the fields
415 */
416};
417
418/*
419 * RES els command payload
420 */
421struct fc_res_s {
422 struct fc_els_cmd_s els_cmd; /* ELS command code */
423 u32 res1:8;
Jing Huang8f4bfad2010-12-26 21:50:10 -0800424 u32 nport_id:24; /* N_Port identifier of source */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700425 u32 oxid:16;
426 u32 rxid:16;
427 u8 assoc_hdr[32];
428};
429
430/*
431 * RES els accept payload
432 */
433struct fc_res_acc_s {
434 struct fc_els_cmd_s els_cmd; /* ELS command code */
435 struct fc_exch_status_blk_s fc_exch_blk; /* Exchange status block */
436};
437
438/*
439 * REC els command payload
440 */
441struct fc_rec_s {
442 struct fc_els_cmd_s els_cmd; /* ELS command code */
443 u32 res1:8;
444 u32 nport_id:24; /* N_Port identifier of source */
445 u32 oxid:16;
446 u32 rxid:16;
447};
448
449#define FC_REC_ESB_OWN_RSP 0x80000000 /* responder owns */
450#define FC_REC_ESB_SI 0x40000000 /* SI is owned */
451#define FC_REC_ESB_COMP 0x20000000 /* exchange is complete */
452#define FC_REC_ESB_ENDCOND_ABN 0x10000000 /* abnormal ending */
453#define FC_REC_ESB_RQACT 0x04000000 /* recovery qual active */
454#define FC_REC_ESB_ERRP_MSK 0x03000000
455#define FC_REC_ESB_OXID_INV 0x00800000 /* invalid OXID */
456#define FC_REC_ESB_RXID_INV 0x00400000 /* invalid RXID */
457#define FC_REC_ESB_PRIO_INUSE 0x00200000
458
459/*
460 * REC els accept payload
461 */
462struct fc_rec_acc_s {
463 struct fc_els_cmd_s els_cmd; /* ELS command code */
464 u32 oxid:16;
465 u32 rxid:16;
466 u32 res1:8;
467 u32 orig_id:24; /* N_Port id of exchange originator */
468 u32 res2:8;
469 u32 resp_id:24; /* N_Port id of exchange responder */
Jing Huang8f4bfad2010-12-26 21:50:10 -0800470 u32 count; /* data transfer count */
471 u32 e_stat; /* exchange status */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700472};
473
474/*
475 * RSI els payload
476 */
477struct fc_rsi_s {
478 struct fc_els_cmd_s els_cmd;
479 u32 res1:8;
480 u32 orig_sid:24;
481 u32 oxid:16;
482 u32 rxid:16;
483};
484
485/*
486 * structure for PRLI paramater pages, both request & response
487 * see FC-PH-X table 113 & 115 for explanation also FCP table 8
488 */
489struct fc_prli_params_s {
490 u32 reserved:16;
Maggie Zhangf16a1752010-12-09 19:12:32 -0800491#ifdef __BIG_ENDIAN
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700492 u32 reserved1:5;
493 u32 rec_support:1;
494 u32 task_retry_id:1;
495 u32 retry:1;
496
497 u32 confirm:1;
498 u32 doverlay:1;
499 u32 initiator:1;
500 u32 target:1;
501 u32 cdmix:1;
502 u32 drmix:1;
503 u32 rxrdisab:1;
504 u32 wxrdisab:1;
505#else
506 u32 retry:1;
507 u32 task_retry_id:1;
508 u32 rec_support:1;
509 u32 reserved1:5;
510
511 u32 wxrdisab:1;
512 u32 rxrdisab:1;
513 u32 drmix:1;
514 u32 cdmix:1;
515 u32 target:1;
516 u32 initiator:1;
517 u32 doverlay:1;
518 u32 confirm:1;
519#endif
520};
521
522/*
523 * valid values for rspcode in PRLI ACC payload
524 */
525enum {
526 FC_PRLI_ACC_XQTD = 0x1, /* request executed */
527 FC_PRLI_ACC_PREDEF_IMG = 0x5, /* predefined image - no prli needed */
528};
529
530struct fc_prli_params_page_s {
531 u32 type:8;
532 u32 codext:8;
Maggie Zhangf16a1752010-12-09 19:12:32 -0800533#ifdef __BIG_ENDIAN
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700534 u32 origprocasv:1;
535 u32 rsppav:1;
536 u32 imagepair:1;
537 u32 reserved1:1;
538 u32 rspcode:4;
539#else
540 u32 rspcode:4;
541 u32 reserved1:1;
542 u32 imagepair:1;
543 u32 rsppav:1;
544 u32 origprocasv:1;
545#endif
546 u32 reserved2:8;
547
548 u32 origprocas;
549 u32 rspprocas;
550 struct fc_prli_params_s servparams;
551};
552
553/*
554 * PRLI request and accept payload, FC-PH-X tables 112 & 114
555 */
556struct fc_prli_s {
557 u32 command:8;
558 u32 pglen:8;
559 u32 pagebytes:16;
560 struct fc_prli_params_page_s parampage;
561};
562
563/*
564 * PRLO logout params page
565 */
566struct fc_prlo_params_page_s {
567 u32 type:8;
568 u32 type_ext:8;
Maggie Zhangf16a1752010-12-09 19:12:32 -0800569#ifdef __BIG_ENDIAN
Jing Huang8f4bfad2010-12-26 21:50:10 -0800570 u32 opa_valid:1; /* originator process associator valid */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700571 u32 rpa_valid:1; /* responder process associator valid */
572 u32 res1:14;
573#else
574 u32 res1:14;
575 u32 rpa_valid:1; /* responder process associator valid */
Jing Huang8f4bfad2010-12-26 21:50:10 -0800576 u32 opa_valid:1; /* originator process associator valid */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700577#endif
578 u32 orig_process_assc;
579 u32 resp_process_assc;
580
581 u32 res2;
582};
583
584/*
585 * PRLO els command payload
586 */
587struct fc_prlo_s {
588 u32 command:8;
589 u32 page_len:8;
590 u32 payload_len:16;
591 struct fc_prlo_params_page_s prlo_params[1];
592};
593
594/*
595 * PRLO Logout response parameter page
596 */
597struct fc_prlo_acc_params_page_s {
598 u32 type:8;
599 u32 type_ext:8;
600
Maggie Zhangf16a1752010-12-09 19:12:32 -0800601#ifdef __BIG_ENDIAN
Jing Huang8f4bfad2010-12-26 21:50:10 -0800602 u32 opa_valid:1; /* originator process associator valid */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700603 u32 rpa_valid:1; /* responder process associator valid */
604 u32 res1:14;
605#else
606 u32 res1:14;
607 u32 rpa_valid:1; /* responder process associator valid */
Jing Huang8f4bfad2010-12-26 21:50:10 -0800608 u32 opa_valid:1; /* originator process associator valid */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700609#endif
610 u32 orig_process_assc;
611 u32 resp_process_assc;
612
613 u32 fc4type_csp;
614};
615
616/*
617 * PRLO els command ACC payload
618 */
619struct fc_prlo_acc_s {
620 u32 command:8;
621 u32 page_len:8;
622 u32 payload_len:16;
623 struct fc_prlo_acc_params_page_s prlo_acc_params[1];
624};
625
626/*
627 * SCR els command payload
628 */
629enum {
630 FC_SCR_REG_FUNC_FABRIC_DETECTED = 0x01,
631 FC_SCR_REG_FUNC_N_PORT_DETECTED = 0x02,
632 FC_SCR_REG_FUNC_FULL = 0x03,
633 FC_SCR_REG_FUNC_CLEAR_REG = 0xFF,
634};
635
636/* SCR VU registrations */
637enum {
638 FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE = 0x01
639};
640
641struct fc_scr_s {
642 u32 command:8;
643 u32 res:24;
644 u32 vu_reg_func:8; /* Vendor Unique Registrations */
645 u32 res1:16;
646 u32 reg_func:8;
647};
648
649/*
650 * Information category for Basic link data
651 */
652enum {
653 FC_CAT_NOP = 0x0,
654 FC_CAT_ABTS = 0x1,
655 FC_CAT_RMC = 0x2,
656 FC_CAT_BA_ACC = 0x4,
657 FC_CAT_BA_RJT = 0x5,
658 FC_CAT_PRMT = 0x6,
659};
660
661/*
662 * LS_RJT els reply payload
663 */
664struct fc_ls_rjt_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -0800665 struct fc_els_cmd_s els_cmd; /* ELS command code */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700666 u32 res1:8;
Jing Huang8f4bfad2010-12-26 21:50:10 -0800667 u32 reason_code:8; /* Reason code for reject */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700668 u32 reason_code_expl:8; /* Reason code explanation */
669 u32 vendor_unique:8; /* Vendor specific */
670};
671
672/*
673 * LS_RJT reason codes
674 */
675enum {
676 FC_LS_RJT_RSN_INV_CMD_CODE = 0x01,
677 FC_LS_RJT_RSN_LOGICAL_ERROR = 0x03,
678 FC_LS_RJT_RSN_LOGICAL_BUSY = 0x05,
679 FC_LS_RJT_RSN_PROTOCOL_ERROR = 0x07,
680 FC_LS_RJT_RSN_UNABLE_TO_PERF_CMD = 0x09,
681 FC_LS_RJT_RSN_CMD_NOT_SUPP = 0x0B,
682};
683
684/*
685 * LS_RJT reason code explanation
686 */
687enum {
688 FC_LS_RJT_EXP_NO_ADDL_INFO = 0x00,
689 FC_LS_RJT_EXP_SPARMS_ERR_OPTIONS = 0x01,
690 FC_LS_RJT_EXP_SPARMS_ERR_INI_CTL = 0x03,
691 FC_LS_RJT_EXP_SPARMS_ERR_REC_CTL = 0x05,
692 FC_LS_RJT_EXP_SPARMS_ERR_RXSZ = 0x07,
693 FC_LS_RJT_EXP_SPARMS_ERR_CONSEQ = 0x09,
694 FC_LS_RJT_EXP_SPARMS_ERR_CREDIT = 0x0B,
695 FC_LS_RJT_EXP_INV_PORT_NAME = 0x0D,
696 FC_LS_RJT_EXP_INV_NODE_FABRIC_NAME = 0x0E,
697 FC_LS_RJT_EXP_INV_CSP = 0x0F,
698 FC_LS_RJT_EXP_INV_ASSOC_HDR = 0x11,
699 FC_LS_RJT_EXP_ASSOC_HDR_REQD = 0x13,
700 FC_LS_RJT_EXP_INV_ORIG_S_ID = 0x15,
701 FC_LS_RJT_EXP_INV_OXID_RXID_COMB = 0x17,
702 FC_LS_RJT_EXP_CMD_ALREADY_IN_PROG = 0x19,
703 FC_LS_RJT_EXP_LOGIN_REQUIRED = 0x1E,
704 FC_LS_RJT_EXP_INVALID_NPORT_ID = 0x1F,
705 FC_LS_RJT_EXP_INSUFF_RES = 0x29,
706 FC_LS_RJT_EXP_CMD_NOT_SUPP = 0x2C,
707 FC_LS_RJT_EXP_INV_PAYLOAD_LEN = 0x2D,
708};
709
710/*
711 * RRQ els command payload
712 */
713struct fc_rrq_s {
714 struct fc_els_cmd_s els_cmd; /* ELS command code */
715 u32 res1:8;
716 u32 s_id:24; /* exchange originator S_ID */
717
718 u32 ox_id:16; /* originator exchange ID */
719 u32 rx_id:16; /* responder exchange ID */
720
721 u32 res2[8]; /* optional association header */
722};
723
724/*
725 * ABTS BA_ACC reply payload
726 */
727struct fc_ba_acc_s {
728 u32 seq_id_valid:8; /* set to 0x00 for Abort Exchange */
Jing Huang8f4bfad2010-12-26 21:50:10 -0800729 u32 seq_id:8; /* invalid for Abort Exchange */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700730 u32 res2:16;
Jing Huang8f4bfad2010-12-26 21:50:10 -0800731 u32 ox_id:16; /* OX_ID from ABTS frame */
732 u32 rx_id:16; /* RX_ID from ABTS frame */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700733 u32 low_seq_cnt:16; /* set to 0x0000 for Abort Exchange */
Jing Huang8f4bfad2010-12-26 21:50:10 -0800734 u32 high_seq_cnt:16; /* set to 0xFFFF for Abort Exchange */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700735};
736
737/*
738 * ABTS BA_RJT reject payload
739 */
740struct fc_ba_rjt_s {
741 u32 res1:8; /* Reserved */
742 u32 reason_code:8; /* reason code for reject */
743 u32 reason_expl:8; /* reason code explanation */
Jing Huang8f4bfad2010-12-26 21:50:10 -0800744 u32 vendor_unique:8; /* vendor unique reason code,set to 0 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700745};
746
747/*
748 * TPRLO logout parameter page
749 */
750struct fc_tprlo_params_page_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -0800751 u32 type:8;
752 u32 type_ext:8;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700753
Maggie Zhangf16a1752010-12-09 19:12:32 -0800754#ifdef __BIG_ENDIAN
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700755 u32 opa_valid:1;
756 u32 rpa_valid:1;
757 u32 tpo_nport_valid:1;
758 u32 global_process_logout:1;
759 u32 res1:12;
760#else
761 u32 res1:12;
762 u32 global_process_logout:1;
763 u32 tpo_nport_valid:1;
764 u32 rpa_valid:1;
765 u32 opa_valid:1;
766#endif
767
768 u32 orig_process_assc;
769 u32 resp_process_assc;
770
771 u32 res2:8;
772 u32 tpo_nport_id;
773};
774
775/*
776 * TPRLO ELS command payload
777 */
778struct fc_tprlo_s {
779 u32 command:8;
780 u32 page_len:8;
781 u32 payload_len:16;
782
783 struct fc_tprlo_params_page_s tprlo_params[1];
784};
785
786enum fc_tprlo_type {
787 FC_GLOBAL_LOGO = 1,
788 FC_TPR_LOGO
789};
790
791/*
792 * TPRLO els command ACC payload
793 */
794struct fc_tprlo_acc_s {
795 u32 command:8;
796 u32 page_len:8;
797 u32 payload_len:16;
798 struct fc_prlo_acc_params_page_s tprlo_acc_params[1];
799};
800
801/*
802 * RSCN els command req payload
803 */
804#define FC_RSCN_PGLEN 0x4
805
806enum fc_rscn_format {
807 FC_RSCN_FORMAT_PORTID = 0x0,
808 FC_RSCN_FORMAT_AREA = 0x1,
809 FC_RSCN_FORMAT_DOMAIN = 0x2,
810 FC_RSCN_FORMAT_FABRIC = 0x3,
811};
812
813struct fc_rscn_event_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -0800814 u32 format:2;
815 u32 qualifier:4;
816 u32 resvd:2;
817 u32 portid:24;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700818};
819
820struct fc_rscn_pl_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -0800821 u8 command;
822 u8 pagelen;
823 __be16 payldlen;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700824 struct fc_rscn_event_s event[1];
825};
826
827/*
828 * ECHO els command req payload
829 */
830struct fc_echo_s {
831 struct fc_els_cmd_s els_cmd;
832};
833
834/*
835 * RNID els command
836 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700837#define RNID_NODEID_DATA_FORMAT_COMMON 0x00
838#define RNID_NODEID_DATA_FORMAT_FCP3 0x08
839#define RNID_NODEID_DATA_FORMAT_DISCOVERY 0xDF
840
841#define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
842#define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
843#define RNID_ASSOCIATED_TYPE_HUB 0x00000003
844#define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
845#define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
846#define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
847#define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
848#define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
849#define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
850#define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
851#define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
852#define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
853#define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
854
855/*
856 * RNID els command payload
857 */
858struct fc_rnid_cmd_s {
859 struct fc_els_cmd_s els_cmd;
860 u32 node_id_data_format:8;
861 u32 reserved:24;
862};
863
864/*
865 * RNID els response payload
866 */
867
868struct fc_rnid_common_id_data_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -0800869 wwn_t port_name;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700870 wwn_t node_name;
871};
872
873struct fc_rnid_general_topology_data_s {
874 u32 vendor_unique[4];
Jing Huang8f4bfad2010-12-26 21:50:10 -0800875 __be32 asso_type;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700876 u32 phy_port_num;
Jing Huang8f4bfad2010-12-26 21:50:10 -0800877 __be32 num_attached_nodes;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700878 u32 node_mgmt:8;
879 u32 ip_version:8;
880 u32 udp_tcp_port_num:16;
881 u32 ip_address[4];
882 u32 reserved:16;
883 u32 vendor_specific:16;
884};
885
886struct fc_rnid_acc_s {
887 struct fc_els_cmd_s els_cmd;
888 u32 node_id_data_format:8;
889 u32 common_id_data_length:8;
890 u32 reserved:8;
891 u32 specific_id_data_length:8;
892 struct fc_rnid_common_id_data_s common_id_data;
893 struct fc_rnid_general_topology_data_s gen_topology_data;
894};
895
896#define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
897#define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
898#define RNID_ASSOCIATED_TYPE_HUB 0x00000003
899#define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
900#define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
901#define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
902#define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
903#define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
904#define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
905#define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
906#define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
907#define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
908#define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
909
910enum fc_rpsc_speed_cap {
911 RPSC_SPEED_CAP_1G = 0x8000,
912 RPSC_SPEED_CAP_2G = 0x4000,
913 RPSC_SPEED_CAP_4G = 0x2000,
914 RPSC_SPEED_CAP_10G = 0x1000,
915 RPSC_SPEED_CAP_8G = 0x0800,
916 RPSC_SPEED_CAP_16G = 0x0400,
917
918 RPSC_SPEED_CAP_UNKNOWN = 0x0001,
919};
920
921enum fc_rpsc_op_speed {
922 RPSC_OP_SPEED_1G = 0x8000,
923 RPSC_OP_SPEED_2G = 0x4000,
924 RPSC_OP_SPEED_4G = 0x2000,
925 RPSC_OP_SPEED_10G = 0x1000,
926 RPSC_OP_SPEED_8G = 0x0800,
927 RPSC_OP_SPEED_16G = 0x0400,
928
Jing Huang8f4bfad2010-12-26 21:50:10 -0800929 RPSC_OP_SPEED_NOT_EST = 0x0001, /* speed not established */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700930};
931
932struct fc_rpsc_speed_info_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -0800933 __be16 port_speed_cap; /* see enum fc_rpsc_speed_cap */
934 __be16 port_op_speed; /* see enum fc_rpsc_op_speed */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700935};
936
Jing Huangacdc79a2010-10-18 17:15:55 -0700937/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700938 * If RPSC request is sent to the Domain Controller, the request is for
Jing Huang8f4bfad2010-12-26 21:50:10 -0800939 * all the ports within that domain.
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700940 */
941struct fc_rpsc_cmd_s {
942 struct fc_els_cmd_s els_cmd;
943};
944
945/*
946 * RPSC Acc
947 */
948struct fc_rpsc_acc_s {
949 u32 command:8;
950 u32 rsvd:8;
951 u32 num_entries:16;
952
953 struct fc_rpsc_speed_info_s speed_info[1];
954};
955
Jing Huangacdc79a2010-10-18 17:15:55 -0700956/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700957 * If RPSC2 request is sent to the Domain Controller,
958 */
959#define FC_BRCD_TOKEN 0x42524344
960
961struct fc_rpsc2_cmd_s {
962 struct fc_els_cmd_s els_cmd;
Maggie50444a32010-11-29 18:26:32 -0800963 __be32 token;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700964 u16 resvd;
Jing Huang8f4bfad2010-12-26 21:50:10 -0800965 __be16 num_pids; /* Number of pids in the request */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700966 struct {
967 u32 rsvd1:8;
968 u32 pid:24; /* port identifier */
969 } pid_list[1];
970};
971
972enum fc_rpsc2_port_type {
973 RPSC2_PORT_TYPE_UNKNOWN = 0,
974 RPSC2_PORT_TYPE_NPORT = 1,
975 RPSC2_PORT_TYPE_NLPORT = 2,
976 RPSC2_PORT_TYPE_NPIV_PORT = 0x5f,
977 RPSC2_PORT_TYPE_NPORT_TRUNK = 0x6f,
978};
Jing Huang8f4bfad2010-12-26 21:50:10 -0800979
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700980/*
981 * RPSC2 portInfo entry structure
982 */
983struct fc_rpsc2_port_info_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -0800984 __be32 pid; /* PID */
Maggie50444a32010-11-29 18:26:32 -0800985 u16 resvd1;
Jing Huang8f4bfad2010-12-26 21:50:10 -0800986 __be16 index; /* port number / index */
Maggie50444a32010-11-29 18:26:32 -0800987 u8 resvd2;
Jing Huang8f4bfad2010-12-26 21:50:10 -0800988 u8 type; /* port type N/NL/... */
989 __be16 speed; /* port Operating Speed */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700990};
991
992/*
993 * RPSC2 Accept payload
994 */
995struct fc_rpsc2_acc_s {
996 u8 els_cmd;
997 u8 resvd;
Jing Huang8f4bfad2010-12-26 21:50:10 -0800998 __be16 num_pids; /* Number of pids in the request */
999 struct fc_rpsc2_port_info_s port_info[1]; /* port information */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001000};
1001
Jing Huangacdc79a2010-10-18 17:15:55 -07001002/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001003 * bit fields so that multiple classes can be specified
1004 */
1005enum fc_cos {
1006 FC_CLASS_2 = 0x04,
1007 FC_CLASS_3 = 0x08,
1008 FC_CLASS_2_3 = 0x0C,
1009};
1010
1011/*
1012 * symbolic name
1013 */
1014struct fc_symname_s {
1015 u8 symname[FC_SYMNAME_MAX];
1016};
1017
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001018/*
1019 * protocol default timeout values
1020 */
Jing Huang8f4bfad2010-12-26 21:50:10 -08001021#define FC_ED_TOV 2
1022#define FC_REC_TOV (FC_ED_TOV + 1)
1023#define FC_RA_TOV 10
Krishna Gudipatibe540a92011-06-13 15:53:04 -07001024#define FC_ELS_TOV ((2 * FC_RA_TOV) + 1)
Jing Huang8f4bfad2010-12-26 21:50:10 -08001025#define FC_FCCT_TOV (3 * FC_RA_TOV)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001026
1027/*
1028 * virtual fabric related defines
1029 */
1030#define FC_VF_ID_NULL 0 /* must not be used as VF_ID */
1031#define FC_VF_ID_MIN 1
1032#define FC_VF_ID_MAX 0xEFF
1033#define FC_VF_ID_CTL 0xFEF /* control VF_ID */
1034
Jing Huangacdc79a2010-10-18 17:15:55 -07001035/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001036 * Virtual Fabric Tagging header format
1037 * @caution This is defined only in BIG ENDIAN format.
1038 */
1039struct fc_vft_s {
1040 u32 r_ctl:8;
1041 u32 ver:2;
1042 u32 type:4;
1043 u32 res_a:2;
1044 u32 priority:3;
1045 u32 vf_id:12;
1046 u32 res_b:1;
1047 u32 hopct:8;
1048 u32 res_c:24;
1049};
1050
1051/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001052 * FCP_CMND definitions
1053 */
1054#define FCP_CMND_CDB_LEN 16
1055#define FCP_CMND_LUN_LEN 8
1056
1057struct fcp_cmnd_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001058 struct scsi_lun lun; /* 64-bit LU number */
1059 u8 crn; /* command reference number */
Maggie Zhangf16a1752010-12-09 19:12:32 -08001060#ifdef __BIG_ENDIAN
Jing Huang8f4bfad2010-12-26 21:50:10 -08001061 u8 resvd:1,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001062 priority:4, /* FCP-3: SAM-3 priority */
1063 taskattr:3; /* scsi task attribute */
1064#else
Jing Huang8f4bfad2010-12-26 21:50:10 -08001065 u8 taskattr:3, /* scsi task attribute */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001066 priority:4, /* FCP-3: SAM-3 priority */
1067 resvd:1;
1068#endif
Jing Huang8f4bfad2010-12-26 21:50:10 -08001069 u8 tm_flags; /* task management flags */
Maggie Zhangf16a1752010-12-09 19:12:32 -08001070#ifdef __BIG_ENDIAN
Jing Huang8f4bfad2010-12-26 21:50:10 -08001071 u8 addl_cdb_len:6, /* additional CDB length words */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001072 iodir:2; /* read/write FCP_DATA IUs */
1073#else
Jing Huang8f4bfad2010-12-26 21:50:10 -08001074 u8 iodir:2, /* read/write FCP_DATA IUs */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001075 addl_cdb_len:6; /* additional CDB length */
1076#endif
Jing Huang8f4bfad2010-12-26 21:50:10 -08001077 struct scsi_cdb_s cdb;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001078
Maggie50444a32010-11-29 18:26:32 -08001079 __be32 fcp_dl; /* bytes to be transferred */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001080};
1081
1082#define fcp_cmnd_cdb_len(_cmnd) ((_cmnd)->addl_cdb_len * 4 + FCP_CMND_CDB_LEN)
1083#define fcp_cmnd_fcpdl(_cmnd) ((&(_cmnd)->fcp_dl)[(_cmnd)->addl_cdb_len])
1084
1085/*
1086 * struct fcp_cmnd_s .iodir field values
1087 */
1088enum fcp_iodir {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001089 FCP_IODIR_NONE = 0,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001090 FCP_IODIR_WRITE = 1,
Jing Huang8f4bfad2010-12-26 21:50:10 -08001091 FCP_IODIR_READ = 2,
1092 FCP_IODIR_RW = 3,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001093};
1094
1095/*
1096 * Task management flags field - only one bit shall be set
1097 */
1098enum fcp_tm_cmnd {
1099 FCP_TM_ABORT_TASK_SET = BIT(1),
1100 FCP_TM_CLEAR_TASK_SET = BIT(2),
1101 FCP_TM_LUN_RESET = BIT(4),
1102 FCP_TM_TARGET_RESET = BIT(5), /* obsolete in FCP-3 */
1103 FCP_TM_CLEAR_ACA = BIT(6),
1104};
1105
1106/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001107 * FCP_RSP residue flags
1108 */
1109enum fcp_residue {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001110 FCP_NO_RESIDUE = 0, /* no residue */
1111 FCP_RESID_OVER = 1, /* more data left that was not sent */
1112 FCP_RESID_UNDER = 2, /* less data than requested */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001113};
1114
1115struct fcp_rspinfo_s {
1116 u32 res0:24;
Jing Huang8f4bfad2010-12-26 21:50:10 -08001117 u32 rsp_code:8; /* response code (as above) */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001118 u32 res1;
1119};
1120
1121struct fcp_resp_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001122 u32 reserved[2]; /* 2 words reserved */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001123 u16 reserved2;
Maggie Zhangf16a1752010-12-09 19:12:32 -08001124#ifdef __BIG_ENDIAN
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001125 u8 reserved3:3;
1126 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1127 u8 resid_flags:2; /* underflow/overflow */
Jing Huang8f4bfad2010-12-26 21:50:10 -08001128 u8 sns_len_valid:1; /* sense len is valid */
1129 u8 rsp_len_valid:1; /* response len is valid */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001130#else
Jing Huang8f4bfad2010-12-26 21:50:10 -08001131 u8 rsp_len_valid:1; /* response len is valid */
1132 u8 sns_len_valid:1; /* sense len is valid */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001133 u8 resid_flags:2; /* underflow/overflow */
1134 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1135 u8 reserved3:3;
1136#endif
Jing Huang8f4bfad2010-12-26 21:50:10 -08001137 u8 scsi_status; /* one byte SCSI status */
1138 u32 residue; /* residual data bytes */
1139 u32 sns_len; /* length od sense info */
1140 u32 rsp_len; /* length of response info */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001141};
1142
1143#define fcp_snslen(__fcprsp) ((__fcprsp)->sns_len_valid ? \
1144 (__fcprsp)->sns_len : 0)
1145#define fcp_rsplen(__fcprsp) ((__fcprsp)->rsp_len_valid ? \
1146 (__fcprsp)->rsp_len : 0)
1147#define fcp_rspinfo(__fcprsp) ((struct fcp_rspinfo_s *)((__fcprsp) + 1))
1148#define fcp_snsinfo(__fcprsp) (((u8 *)fcp_rspinfo(__fcprsp)) + \
1149 fcp_rsplen(__fcprsp))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001150/*
1151 * CT
1152 */
1153struct ct_hdr_s {
1154 u32 rev_id:8; /* Revision of the CT */
1155 u32 in_id:24; /* Initiator Id */
1156 u32 gs_type:8; /* Generic service Type */
1157 u32 gs_sub_type:8; /* Generic service sub type */
1158 u32 options:8; /* options */
1159 u32 rsvrd:8; /* reserved */
1160 u32 cmd_rsp_code:16;/* ct command/response code */
1161 u32 max_res_size:16;/* maximum/residual size */
1162 u32 frag_id:8; /* fragment ID */
1163 u32 reason_code:8; /* reason code */
1164 u32 exp_code:8; /* explanation code */
1165 u32 vendor_unq:8; /* vendor unique */
1166};
1167
1168/*
1169 * defines for the Revision
1170 */
1171enum {
1172 CT_GS3_REVISION = 0x01,
1173};
1174
1175/*
1176 * defines for gs_type
1177 */
1178enum {
1179 CT_GSTYPE_KEYSERVICE = 0xF7,
1180 CT_GSTYPE_ALIASSERVICE = 0xF8,
1181 CT_GSTYPE_MGMTSERVICE = 0xFA,
1182 CT_GSTYPE_TIMESERVICE = 0xFB,
1183 CT_GSTYPE_DIRSERVICE = 0xFC,
1184};
1185
1186/*
1187 * defines for gs_sub_type for gs type directory service
1188 */
1189enum {
1190 CT_GSSUBTYPE_NAMESERVER = 0x02,
1191};
1192
1193/*
1194 * defines for gs_sub_type for gs type management service
1195 */
1196enum {
1197 CT_GSSUBTYPE_CFGSERVER = 0x01,
1198 CT_GSSUBTYPE_UNZONED_NS = 0x02,
1199 CT_GSSUBTYPE_ZONESERVER = 0x03,
1200 CT_GSSUBTYPE_LOCKSERVER = 0x04,
1201 CT_GSSUBTYPE_HBA_MGMTSERVER = 0x10, /* for FDMI */
1202};
1203
1204/*
1205 * defines for CT response code field
1206 */
1207enum {
1208 CT_RSP_REJECT = 0x8001,
1209 CT_RSP_ACCEPT = 0x8002,
1210};
1211
1212/*
1213 * defintions for CT reason code
1214 */
1215enum {
1216 CT_RSN_INV_CMD = 0x01,
1217 CT_RSN_INV_VER = 0x02,
1218 CT_RSN_LOGIC_ERR = 0x03,
1219 CT_RSN_INV_SIZE = 0x04,
1220 CT_RSN_LOGICAL_BUSY = 0x05,
1221 CT_RSN_PROTO_ERR = 0x07,
1222 CT_RSN_UNABLE_TO_PERF = 0x09,
Jing Huang8f4bfad2010-12-26 21:50:10 -08001223 CT_RSN_NOT_SUPP = 0x0B,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001224 CT_RSN_SERVER_NOT_AVBL = 0x0D,
1225 CT_RSN_SESSION_COULD_NOT_BE_ESTBD = 0x0E,
1226 CT_RSN_VENDOR_SPECIFIC = 0xFF,
1227
1228};
1229
1230/*
1231 * definitions for explanations code for Name server
1232 */
1233enum {
1234 CT_NS_EXP_NOADDITIONAL = 0x00,
1235 CT_NS_EXP_ID_NOT_REG = 0x01,
1236 CT_NS_EXP_PN_NOT_REG = 0x02,
1237 CT_NS_EXP_NN_NOT_REG = 0x03,
1238 CT_NS_EXP_CS_NOT_REG = 0x04,
1239 CT_NS_EXP_IPN_NOT_REG = 0x05,
1240 CT_NS_EXP_IPA_NOT_REG = 0x06,
1241 CT_NS_EXP_FT_NOT_REG = 0x07,
1242 CT_NS_EXP_SPN_NOT_REG = 0x08,
1243 CT_NS_EXP_SNN_NOT_REG = 0x09,
1244 CT_NS_EXP_PT_NOT_REG = 0x0A,
1245 CT_NS_EXP_IPP_NOT_REG = 0x0B,
1246 CT_NS_EXP_FPN_NOT_REG = 0x0C,
1247 CT_NS_EXP_HA_NOT_REG = 0x0D,
1248 CT_NS_EXP_FD_NOT_REG = 0x0E,
1249 CT_NS_EXP_FF_NOT_REG = 0x0F,
1250 CT_NS_EXP_ACCESSDENIED = 0x10,
1251 CT_NS_EXP_UNACCEPTABLE_ID = 0x11,
1252 CT_NS_EXP_DATABASEEMPTY = 0x12,
1253 CT_NS_EXP_NOT_REG_IN_SCOPE = 0x13,
1254 CT_NS_EXP_DOM_ID_NOT_PRESENT = 0x14,
1255 CT_NS_EXP_PORT_NUM_NOT_PRESENT = 0x15,
1256 CT_NS_EXP_NO_DEVICE_ATTACHED = 0x16
1257};
1258
1259/*
1260 * defintions for the explanation code for all servers
1261 */
1262enum {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001263 CT_EXP_AUTH_EXCEPTION = 0xF1,
1264 CT_EXP_DB_FULL = 0xF2,
1265 CT_EXP_DB_EMPTY = 0xF3,
1266 CT_EXP_PROCESSING_REQ = 0xF4,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001267 CT_EXP_UNABLE_TO_VERIFY_CONN = 0xF5,
1268 CT_EXP_DEVICES_NOT_IN_CMN_ZONE = 0xF6
1269};
1270
1271/*
1272 * Command codes for Name server
1273 */
1274enum {
1275 GS_GID_PN = 0x0121, /* Get Id on port name */
1276 GS_GPN_ID = 0x0112, /* Get port name on ID */
1277 GS_GNN_ID = 0x0113, /* Get node name on ID */
1278 GS_GID_FT = 0x0171, /* Get Id on FC4 type */
1279 GS_GSPN_ID = 0x0118, /* Get symbolic PN on ID */
1280 GS_RFT_ID = 0x0217, /* Register fc4type on ID */
1281 GS_RSPN_ID = 0x0218, /* Register symbolic PN on ID */
1282 GS_RPN_ID = 0x0212, /* Register port name */
1283 GS_RNN_ID = 0x0213, /* Register node name */
1284 GS_RCS_ID = 0x0214, /* Register class of service */
1285 GS_RPT_ID = 0x021A, /* Register port type */
1286 GS_GA_NXT = 0x0100, /* Get all next */
1287 GS_RFF_ID = 0x021F, /* Register FC4 Feature */
1288};
1289
Jing Huang8f4bfad2010-12-26 21:50:10 -08001290struct fcgs_id_req_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001291 u32 rsvd:8;
1292 u32 dap:24; /* port identifier */
1293};
1294#define fcgs_gpnid_req_t struct fcgs_id_req_s
1295#define fcgs_gnnid_req_t struct fcgs_id_req_s
1296#define fcgs_gspnid_req_t struct fcgs_id_req_s
1297
1298struct fcgs_gidpn_req_s {
1299 wwn_t port_name; /* port wwn */
1300};
1301
1302struct fcgs_gidpn_resp_s {
1303 u32 rsvd:8;
Jing Huang8f4bfad2010-12-26 21:50:10 -08001304 u32 dap:24; /* port identifier */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001305};
1306
Jing Huangacdc79a2010-10-18 17:15:55 -07001307/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001308 * RFT_ID
1309 */
1310struct fcgs_rftid_req_s {
1311 u32 rsvd:8;
1312 u32 dap:24; /* port identifier */
Maggie50444a32010-11-29 18:26:32 -08001313 __be32 fc4_type[8]; /* fc4 types */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001314};
1315
Jing Huangacdc79a2010-10-18 17:15:55 -07001316/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001317 * RFF_ID : Register FC4 features.
1318 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001319#define FC_GS_FCP_FC4_FEATURE_INITIATOR 0x02
1320#define FC_GS_FCP_FC4_FEATURE_TARGET 0x01
1321
1322struct fcgs_rffid_req_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001323 u32 rsvd:8;
1324 u32 dap:24; /* port identifier */
1325 u32 rsvd1:16;
1326 u32 fc4ftr_bits:8; /* fc4 feature bits */
1327 u32 fc4_type:8; /* corresponding FC4 Type */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001328};
1329
Jing Huangacdc79a2010-10-18 17:15:55 -07001330/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001331 * GID_FT Request
1332 */
1333struct fcgs_gidft_req_s {
1334 u8 reserved;
1335 u8 domain_id; /* domain, 0 - all fabric */
1336 u8 area_id; /* area, 0 - whole domain */
1337 u8 fc4_type; /* FC_TYPE_FCP for SCSI devices */
Jing Huang8f4bfad2010-12-26 21:50:10 -08001338};
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001339
Jing Huangacdc79a2010-10-18 17:15:55 -07001340/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001341 * GID_FT Response
1342 */
1343struct fcgs_gidft_resp_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001344 u8 last:1; /* last port identifier flag */
1345 u8 reserved:7;
1346 u32 pid:24; /* port identifier */
1347};
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001348
Jing Huangacdc79a2010-10-18 17:15:55 -07001349/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001350 * RSPN_ID
1351 */
1352struct fcgs_rspnid_req_s {
1353 u32 rsvd:8;
1354 u32 dap:24; /* port identifier */
Jing Huang8f4bfad2010-12-26 21:50:10 -08001355 u8 spn_len; /* symbolic port name length */
1356 u8 spn[256]; /* symbolic port name */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001357};
1358
Jing Huangacdc79a2010-10-18 17:15:55 -07001359/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001360 * RPN_ID
1361 */
1362struct fcgs_rpnid_req_s {
1363 u32 rsvd:8;
1364 u32 port_id:24;
Jing Huang8f4bfad2010-12-26 21:50:10 -08001365 wwn_t port_name;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001366};
1367
Jing Huangacdc79a2010-10-18 17:15:55 -07001368/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001369 * RNN_ID
1370 */
1371struct fcgs_rnnid_req_s {
1372 u32 rsvd:8;
1373 u32 port_id:24;
Jing Huang8f4bfad2010-12-26 21:50:10 -08001374 wwn_t node_name;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001375};
1376
Jing Huangacdc79a2010-10-18 17:15:55 -07001377/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001378 * RCS_ID
1379 */
1380struct fcgs_rcsid_req_s {
1381 u32 rsvd:8;
1382 u32 port_id:24;
1383 u32 cos;
1384};
1385
Jing Huangacdc79a2010-10-18 17:15:55 -07001386/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001387 * RPT_ID
1388 */
1389struct fcgs_rptid_req_s {
1390 u32 rsvd:8;
1391 u32 port_id:24;
1392 u32 port_type:8;
1393 u32 rsvd1:24;
1394};
1395
Jing Huangacdc79a2010-10-18 17:15:55 -07001396/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001397 * GA_NXT Request
1398 */
1399struct fcgs_ganxt_req_s {
1400 u32 rsvd:8;
1401 u32 port_id:24;
1402};
1403
Jing Huangacdc79a2010-10-18 17:15:55 -07001404/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001405 * GA_NXT Response
1406 */
1407struct fcgs_ganxt_rsp_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001408 u32 port_type:8; /* Port Type */
1409 u32 port_id:24; /* Port Identifier */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001410 wwn_t port_name; /* Port Name */
1411 u8 spn_len; /* Length of Symbolic Port Name */
1412 char spn[255]; /* Symbolic Port Name */
1413 wwn_t node_name; /* Node Name */
1414 u8 snn_len; /* Length of Symbolic Node Name */
1415 char snn[255]; /* Symbolic Node Name */
1416 u8 ipa[8]; /* Initial Process Associator */
1417 u8 ip[16]; /* IP Address */
Jing Huang8f4bfad2010-12-26 21:50:10 -08001418 u32 cos; /* Class of Service */
1419 u32 fc4types[8]; /* FC-4 TYPEs */
1420 wwn_t fabric_port_name; /* Fabric Port Name */
1421 u32 rsvd:8; /* Reserved */
1422 u32 hard_addr:24; /* Hard Address */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001423};
1424
1425/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001426 * Command codes for Fabric Configuration Server
1427 */
1428enum {
1429 GS_FC_GFN_CMD = 0x0114, /* GS FC Get Fabric Name */
1430 GS_FC_GMAL_CMD = 0x0116, /* GS FC GMAL */
1431 GS_FC_TRACE_CMD = 0x0400, /* GS FC Trace Route */
1432 GS_FC_PING_CMD = 0x0401, /* GS FC Ping */
1433};
1434
1435/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001436 * GMAL Command ( Get ( interconnect Element) Management Address List)
1437 * To retrieve the IP Address of a Switch.
1438 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001439#define CT_GMAL_RESP_PREFIX_TELNET "telnet://"
1440#define CT_GMAL_RESP_PREFIX_HTTP "http://"
1441
1442/* GMAL/GFN request */
1443struct fcgs_req_s {
1444 wwn_t wwn; /* PWWN/NWWN */
1445};
1446
1447#define fcgs_gmal_req_t struct fcgs_req_s
1448#define fcgs_gfn_req_t struct fcgs_req_s
1449
1450/* Accept Response to GMAL */
1451struct fcgs_gmal_resp_s {
Maggie50444a32010-11-29 18:26:32 -08001452 __be32 ms_len; /* Num of entries */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001453 u8 ms_ma[256];
1454};
1455
1456struct fcgs_gmal_entry_s {
1457 u8 len;
1458 u8 prefix[7]; /* like "http://" */
1459 u8 ip_addr[248];
1460};
1461
1462/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001463 * FDMI Command Codes
1464 */
1465#define FDMI_GRHL 0x0100
1466#define FDMI_GHAT 0x0101
1467#define FDMI_GRPL 0x0102
1468#define FDMI_GPAT 0x0110
1469#define FDMI_RHBA 0x0200
1470#define FDMI_RHAT 0x0201
1471#define FDMI_RPRT 0x0210
1472#define FDMI_RPA 0x0211
1473#define FDMI_DHBA 0x0300
1474#define FDMI_DPRT 0x0310
1475
1476/*
1477 * FDMI reason codes
1478 */
1479#define FDMI_NO_ADDITIONAL_EXP 0x00
1480#define FDMI_HBA_ALREADY_REG 0x10
1481#define FDMI_HBA_ATTRIB_NOT_REG 0x11
1482#define FDMI_HBA_ATTRIB_MULTIPLE 0x12
1483#define FDMI_HBA_ATTRIB_LENGTH_INVALID 0x13
1484#define FDMI_HBA_ATTRIB_NOT_PRESENT 0x14
1485#define FDMI_PORT_ORIG_NOT_IN_LIST 0x15
1486#define FDMI_PORT_HBA_NOT_IN_LIST 0x16
1487#define FDMI_PORT_ATTRIB_NOT_REG 0x20
1488#define FDMI_PORT_NOT_REG 0x21
1489#define FDMI_PORT_ATTRIB_MULTIPLE 0x22
1490#define FDMI_PORT_ATTRIB_LENGTH_INVALID 0x23
1491#define FDMI_PORT_ALREADY_REGISTEREED 0x24
1492
1493/*
1494 * FDMI Transmission Speed Mask values
1495 */
1496#define FDMI_TRANS_SPEED_1G 0x00000001
1497#define FDMI_TRANS_SPEED_2G 0x00000002
1498#define FDMI_TRANS_SPEED_10G 0x00000004
1499#define FDMI_TRANS_SPEED_4G 0x00000008
1500#define FDMI_TRANS_SPEED_8G 0x00000010
1501#define FDMI_TRANS_SPEED_16G 0x00000020
1502#define FDMI_TRANS_SPEED_UNKNOWN 0x00008000
1503
1504/*
1505 * FDMI HBA attribute types
1506 */
1507enum fdmi_hba_attribute_type {
1508 FDMI_HBA_ATTRIB_NODENAME = 1, /* 0x0001 */
1509 FDMI_HBA_ATTRIB_MANUFACTURER, /* 0x0002 */
1510 FDMI_HBA_ATTRIB_SERIALNUM, /* 0x0003 */
1511 FDMI_HBA_ATTRIB_MODEL, /* 0x0004 */
1512 FDMI_HBA_ATTRIB_MODEL_DESC, /* 0x0005 */
1513 FDMI_HBA_ATTRIB_HW_VERSION, /* 0x0006 */
1514 FDMI_HBA_ATTRIB_DRIVER_VERSION, /* 0x0007 */
1515 FDMI_HBA_ATTRIB_ROM_VERSION, /* 0x0008 */
1516 FDMI_HBA_ATTRIB_FW_VERSION, /* 0x0009 */
1517 FDMI_HBA_ATTRIB_OS_NAME, /* 0x000A */
1518 FDMI_HBA_ATTRIB_MAX_CT, /* 0x000B */
1519
1520 FDMI_HBA_ATTRIB_MAX_TYPE
1521};
1522
1523/*
1524 * FDMI Port attribute types
1525 */
1526enum fdmi_port_attribute_type {
1527 FDMI_PORT_ATTRIB_FC4_TYPES = 1, /* 0x0001 */
1528 FDMI_PORT_ATTRIB_SUPP_SPEED, /* 0x0002 */
1529 FDMI_PORT_ATTRIB_PORT_SPEED, /* 0x0003 */
1530 FDMI_PORT_ATTRIB_FRAME_SIZE, /* 0x0004 */
1531 FDMI_PORT_ATTRIB_DEV_NAME, /* 0x0005 */
1532 FDMI_PORT_ATTRIB_HOST_NAME, /* 0x0006 */
1533
1534 FDMI_PORT_ATTR_MAX_TYPE
1535};
1536
1537/*
1538 * FDMI attribute
1539 */
1540struct fdmi_attr_s {
Maggie50444a32010-11-29 18:26:32 -08001541 __be16 type;
1542 __be16 len;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001543 u8 value[1];
1544};
1545
1546/*
1547 * HBA Attribute Block
1548 */
1549struct fdmi_hba_attr_s {
Maggie50444a32010-11-29 18:26:32 -08001550 __be32 attr_count; /* # of attributes */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001551 struct fdmi_attr_s hba_attr; /* n attributes */
1552};
1553
1554/*
1555 * Registered Port List
1556 */
1557struct fdmi_port_list_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001558 __be32 num_ports; /* number Of Port Entries */
1559 wwn_t port_entry; /* one or more */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001560};
1561
1562/*
1563 * Port Attribute Block
1564 */
1565struct fdmi_port_attr_s {
Maggie50444a32010-11-29 18:26:32 -08001566 __be32 attr_count; /* # of attributes */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001567 struct fdmi_attr_s port_attr; /* n attributes */
1568};
1569
1570/*
1571 * FDMI Register HBA Attributes
1572 */
1573struct fdmi_rhba_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001574 wwn_t hba_id; /* HBA Identifier */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001575 struct fdmi_port_list_s port_list; /* Registered Port List */
1576 struct fdmi_hba_attr_s hba_attr_blk; /* HBA attribute block */
1577};
1578
1579/*
1580 * FDMI Register Port
1581 */
1582struct fdmi_rprt_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001583 wwn_t hba_id; /* HBA Identifier */
1584 wwn_t port_name; /* Port wwn */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001585 struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
1586};
1587
1588/*
1589 * FDMI Register Port Attributes
1590 */
1591struct fdmi_rpa_s {
Jing Huang8f4bfad2010-12-26 21:50:10 -08001592 wwn_t port_name; /* port wwn */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001593 struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
1594};
1595
1596#pragma pack()
1597
1598#endif /* __BFA_FC_H__ */