2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
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
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.
18 #ifndef __BFA_DEFS_FCS_H__
19 #define __BFA_DEFS_FCS_H__
22 #include "bfa_defs_svc.h"
28 BFA_VF_UNINIT
= 0, /* fabric is not yet initialized */
29 BFA_VF_LINK_DOWN
= 1, /* link is down */
30 BFA_VF_FLOGI
= 2, /* flogi is in progress */
31 BFA_VF_AUTH
= 3, /* authentication in progress */
32 BFA_VF_NOFABRIC
= 4, /* fabric is not present */
33 BFA_VF_ONLINE
= 5, /* login to fabric is complete */
34 BFA_VF_EVFP
= 6, /* EVFP is in progress */
35 BFA_VF_ISOLATED
= 7, /* port isolated due to vf_id mismatch */
41 struct bfa_vf_stats_s
{
42 u32 flogi_sent
; /* Num FLOGIs sent */
43 u32 flogi_rsp_err
; /* FLOGI response errors */
44 u32 flogi_acc_err
; /* FLOGI accept errors */
45 u32 flogi_accepts
; /* FLOGI accepts received */
46 u32 flogi_rejects
; /* FLOGI rejects received */
47 u32 flogi_unknown_rsp
; /* Unknown responses for FLOGI */
48 u32 flogi_alloc_wait
; /* Allocation waits prior to sending FLOGI */
49 u32 flogi_rcvd
; /* FLOGIs received */
50 u32 flogi_rejected
; /* Incoming FLOGIs rejected */
51 u32 fabric_onlines
; /* Internal fabric online notification sent
53 u32 fabric_offlines
; /* Internal fabric offline notification sent
55 u32 resvd
; /* padding for 64 bit alignment */
59 * VF attributes returned in queries
61 struct bfa_vf_attr_s
{
62 enum bfa_vf_state state
; /* VF state */
64 wwn_t fabric_name
; /* fabric name */
67 #define BFA_FCS_MAX_LPORTS 256
68 #define BFA_FCS_FABRIC_IPADDR_SZ 16
71 * symbolic names for base port/virtual port
73 #define BFA_SYMNAME_MAXLEN 128 /* 128 bytes */
74 struct bfa_lport_symname_s
{
75 char symname
[BFA_SYMNAME_MAXLEN
];
80 * - FCP IM and FCP TM roles cannot be enabled together for a FCS port
81 * - Create multiple ports if both IM and TM functions required.
82 * - Atleast one role must be specified.
85 BFA_LPORT_ROLE_FCP_IM
= 0x01, /* FCP initiator role */
86 BFA_LPORT_ROLE_FCP_MAX
= BFA_LPORT_ROLE_FCP_IM
,
90 * FCS port configuration.
92 struct bfa_lport_cfg_s
{
93 wwn_t pwwn
; /* port wwn */
94 wwn_t nwwn
; /* node wwn */
95 struct bfa_lport_symname_s sym_name
; /* vm port symbolic name */
96 bfa_boolean_t preboot_vp
; /* vport created from PBC */
97 enum bfa_lport_role roles
; /* FCS port roles */
98 u8 tag
[16]; /* opaque tag from application */
104 enum bfa_lport_state
{
105 BFA_LPORT_UNINIT
= 0, /* PORT is not yet initialized */
106 BFA_LPORT_FDISC
= 1, /* FDISC is in progress */
107 BFA_LPORT_ONLINE
= 2, /* login to fabric is complete */
108 BFA_LPORT_OFFLINE
= 3, /* No login to fabric */
114 enum bfa_lport_type
{
115 BFA_LPORT_TYPE_PHYSICAL
= 0,
116 BFA_LPORT_TYPE_VIRTUAL
,
120 * FCS port offline reason.
122 enum bfa_lport_offline_reason
{
123 BFA_LPORT_OFFLINE_UNKNOWN
= 0,
124 BFA_LPORT_OFFLINE_LINKDOWN
,
125 BFA_LPORT_OFFLINE_FAB_UNSUPPORTED
, /* NPIV not supported by the
127 BFA_LPORT_OFFLINE_FAB_NORESOURCES
,
128 BFA_LPORT_OFFLINE_FAB_LOGOUT
,
134 struct bfa_lport_info_s
{
135 u8 port_type
; /* bfa_lport_type_t : physical or
137 u8 port_state
; /* one of bfa_lport_state values */
138 u8 offline_reason
; /* one of bfa_lport_offline_reason_t
144 * following 4 feilds are valid for Physical Ports only
146 u32 max_vports_supp
; /* Max supported vports */
147 u32 num_vports_inuse
; /* Num of in use vports */
148 u32 max_rports_supp
; /* Max supported rports */
149 u32 num_rports_inuse
; /* Num of doscovered rports */
154 * FCS port statistics
156 struct bfa_lport_stats_s
{
158 u32 ns_plogi_rsp_err
;
159 u32 ns_plogi_acc_err
;
160 u32 ns_plogi_accepts
;
161 u32 ns_rejects
; /* NS command rejects */
162 u32 ns_plogi_unknown_rsp
;
163 u32 ns_plogi_alloc_wait
;
165 u32 ns_retries
; /* NS command retries */
166 u32 ns_timeouts
; /* NS command timeouts */
169 u32 ns_rspnid_accepts
;
170 u32 ns_rspnid_rsp_err
;
171 u32 ns_rspnid_rejects
;
172 u32 ns_rspnid_alloc_wait
;
175 u32 ns_rftid_accepts
;
176 u32 ns_rftid_rsp_err
;
177 u32 ns_rftid_rejects
;
178 u32 ns_rftid_alloc_wait
;
181 u32 ns_rffid_accepts
;
182 u32 ns_rffid_rsp_err
;
183 u32 ns_rffid_rejects
;
184 u32 ns_rffid_alloc_wait
;
187 u32 ns_gidft_accepts
;
188 u32 ns_gidft_rsp_err
;
189 u32 ns_gidft_rejects
;
190 u32 ns_gidft_unknown_rsp
;
191 u32 ns_gidft_alloc_wait
;
196 u32 ms_retries
; /* MS command retries */
197 u32 ms_timeouts
; /* MS command timeouts */
199 u32 ms_plogi_rsp_err
;
200 u32 ms_plogi_acc_err
;
201 u32 ms_plogi_accepts
;
202 u32 ms_rejects
; /* MS command rejects */
203 u32 ms_plogi_unknown_rsp
;
204 u32 ms_plogi_alloc_wait
;
206 u32 num_rscn
; /* Num of RSCN received */
207 u32 num_portid_rscn
;/* Num portid format RSCN
210 u32 uf_recvs
; /* Unsolicited recv frames */
211 u32 uf_recv_drops
; /* Dropped received frames */
213 u32 plogi_rcvd
; /* Received plogi */
214 u32 prli_rcvd
; /* Received prli */
215 u32 adisc_rcvd
; /* Received adisc */
216 u32 prlo_rcvd
; /* Received prlo */
217 u32 logo_rcvd
; /* Received logo */
218 u32 rpsc_rcvd
; /* Received rpsc */
219 u32 un_handled_els_rcvd
; /* Received unhandled ELS */
220 u32 rport_plogi_timeouts
; /* Rport plogi retry timeout count */
221 u32 rport_del_max_plogi_retry
; /* Deleted rport
222 * (max retry of plogi) */
226 * BFA port attribute returned in queries
228 struct bfa_lport_attr_s
{
229 enum bfa_lport_state state
; /* port state */
230 u32 pid
; /* port ID */
231 struct bfa_lport_cfg_s port_cfg
; /* port configuration */
232 enum bfa_port_type port_type
; /* current topology */
233 u32 loopback
; /* cable is externally looped back */
234 wwn_t fabric_name
; /* attached switch's nwwn */
235 u8 fabric_ip_addr
[BFA_FCS_FABRIC_IPADDR_SZ
]; /* attached
236 * fabric's ip addr */
237 mac_t fpma_mac
; /* Lport's FPMA Mac address */
238 u16 authfail
; /* auth failed state */
245 enum bfa_vport_state
{
246 BFA_FCS_VPORT_UNINIT
= 0,
247 BFA_FCS_VPORT_CREATED
= 1,
248 BFA_FCS_VPORT_OFFLINE
= 1,
249 BFA_FCS_VPORT_FDISC_SEND
= 2,
250 BFA_FCS_VPORT_FDISC
= 3,
251 BFA_FCS_VPORT_FDISC_RETRY
= 4,
252 BFA_FCS_VPORT_ONLINE
= 5,
253 BFA_FCS_VPORT_DELETING
= 6,
254 BFA_FCS_VPORT_CLEANUP
= 6,
255 BFA_FCS_VPORT_LOGO_SEND
= 7,
256 BFA_FCS_VPORT_LOGO
= 8,
257 BFA_FCS_VPORT_ERROR
= 9,
258 BFA_FCS_VPORT_MAX_STATE
,
264 struct bfa_vport_stats_s
{
265 struct bfa_lport_stats_s port_stats
; /* base class (port) stats */
270 u32 fdisc_sent
; /* num fdisc sent */
271 u32 fdisc_accepts
; /* fdisc accepts */
272 u32 fdisc_retries
; /* fdisc retries */
273 u32 fdisc_timeouts
; /* fdisc timeouts */
274 u32 fdisc_rsp_err
; /* fdisc response error */
275 u32 fdisc_acc_bad
; /* bad fdisc accepts */
276 u32 fdisc_rejects
; /* fdisc rejects */
277 u32 fdisc_unknown_rsp
;
279 *!< fdisc rsp unknown error
281 u32 fdisc_alloc_wait
;/* fdisc req (fcxp)alloc wait */
283 u32 logo_alloc_wait
;/* logo req (fcxp) alloc wait */
284 u32 logo_sent
; /* logo sent */
285 u32 logo_accepts
; /* logo accepts */
286 u32 logo_rejects
; /* logo rejects */
287 u32 logo_rsp_err
; /* logo rsp errors */
288 u32 logo_unknown_rsp
;
289 /* logo rsp unknown errors */
291 u32 fab_no_npiv
; /* fabric does not support npiv */
293 u32 fab_offline
; /* offline events from fab SM */
294 u32 fab_online
; /* online events from fab SM */
295 u32 fab_cleanup
; /* cleanup request from fab SM */
300 * BFA vport attribute returned in queries
302 struct bfa_vport_attr_s
{
303 struct bfa_lport_attr_s port_attr
; /* base class (port) attributes */
304 enum bfa_vport_state vport_state
; /* vport state */
309 * FCS remote port states
311 enum bfa_rport_state
{
312 BFA_RPORT_UNINIT
= 0, /* PORT is not yet initialized */
313 BFA_RPORT_OFFLINE
= 1, /* rport is offline */
314 BFA_RPORT_PLOGI
= 2, /* PLOGI to rport is in progress */
315 BFA_RPORT_ONLINE
= 3, /* login to rport is complete */
316 BFA_RPORT_PLOGI_RETRY
= 4, /* retrying login to rport */
317 BFA_RPORT_NSQUERY
= 5, /* nameserver query */
318 BFA_RPORT_ADISC
= 6, /* ADISC authentication */
319 BFA_RPORT_LOGO
= 7, /* logging out with rport */
320 BFA_RPORT_LOGORCV
= 8, /* handling LOGO from rport */
321 BFA_RPORT_NSDISC
= 9, /* re-discover rport */
325 * Rport Scsi Function : Initiator/Target.
327 enum bfa_rport_function
{
328 BFA_RPORT_INITIATOR
= 0x01, /* SCSI Initiator */
329 BFA_RPORT_TARGET
= 0x02, /* SCSI Target */
333 * port/node symbolic names for rport
335 #define BFA_RPORT_SYMNAME_MAXLEN 255
336 struct bfa_rport_symname_s
{
337 char symname
[BFA_RPORT_SYMNAME_MAXLEN
];
341 * FCS remote port statistics
343 struct bfa_rport_stats_s
{
344 u32 offlines
; /* remote port offline count */
345 u32 onlines
; /* remote port online count */
346 u32 rscns
; /* RSCN affecting rport */
347 u32 plogis
; /* plogis sent */
348 u32 plogi_accs
; /* plogi accepts */
349 u32 plogi_timeouts
; /* plogi timeouts */
350 u32 plogi_rejects
; /* rcvd plogi rejects */
351 u32 plogi_failed
; /* local failure */
352 u32 plogi_rcvd
; /* plogis rcvd */
353 u32 prli_rcvd
; /* inbound PRLIs */
354 u32 adisc_rcvd
; /* ADISCs received */
355 u32 adisc_rejects
; /* recvd ADISC rejects */
356 u32 adisc_sent
; /* ADISC requests sent */
357 u32 adisc_accs
; /* ADISC accepted by rport */
358 u32 adisc_failed
; /* ADISC failed (no response) */
359 u32 adisc_rejected
; /* ADISC rejected by us */
360 u32 logos
; /* logos sent */
361 u32 logo_accs
; /* LOGO accepts from rport */
362 u32 logo_failed
; /* LOGO failures */
363 u32 logo_rejected
; /* LOGO rejects from rport */
364 u32 logo_rcvd
; /* LOGO from remote port */
366 u32 rpsc_rcvd
; /* RPSC received */
367 u32 rpsc_rejects
; /* recvd RPSC rejects */
368 u32 rpsc_sent
; /* RPSC requests sent */
369 u32 rpsc_accs
; /* RPSC accepted by rport */
370 u32 rpsc_failed
; /* RPSC failed (no response) */
371 u32 rpsc_rejected
; /* RPSC rejected by us */
373 u32 rjt_insuff_res
; /* LS RJT with insuff resources */
374 struct bfa_rport_hal_stats_s hal_stats
; /* BFA rport stats */
378 * FCS remote port attributes returned in queries
380 struct bfa_rport_attr_s
{
381 wwn_t nwwn
; /* node wwn */
382 wwn_t pwwn
; /* port wwn */
383 enum fc_cos cos_supported
; /* supported class of services */
384 u32 pid
; /* port ID */
385 u32 df_sz
; /* Max payload size */
386 enum bfa_rport_state state
; /* Rport State machine state */
387 enum fc_cos fc_cos
; /* FC classes of services */
388 bfa_boolean_t cisc
; /* CISC capable device */
389 struct bfa_rport_symname_s symname
; /* Symbolic Name */
390 enum bfa_rport_function scsi_function
; /* Initiator/Target */
391 struct bfa_rport_qos_attr_s qos_attr
; /* qos attributes */
392 enum bfa_port_speed curr_speed
; /* operating speed got from
393 * RPSC ELS. UNKNOWN, if RPSC
394 * is not supported */
395 bfa_boolean_t trl_enforced
; /* TRL enforced ? TRUE/FALSE */
396 enum bfa_port_speed assigned_speed
; /* Speed assigned by the user.
397 * will be used if RPSC is not
398 * supported by the rport */
401 struct bfa_rport_remote_link_stats_s
{
402 u32 lfc
; /* Link Failure Count */
403 u32 lsyc
; /* Loss of Synchronization Count */
404 u32 lsic
; /* Loss of Signal Count */
405 u32 pspec
; /* Primitive Sequence Protocol Error Count */
406 u32 itwc
; /* Invalid Transmission Word Count */
407 u32 icc
; /* Invalid CRC Count */
411 #define BFA_MAX_IO_INDEX 7
412 #define BFA_NO_IO_INDEX 9
417 enum bfa_itnim_state
{
418 BFA_ITNIM_OFFLINE
= 0, /* offline */
419 BFA_ITNIM_PRLI_SEND
= 1, /* prli send */
420 BFA_ITNIM_PRLI_SENT
= 2, /* prli sent */
421 BFA_ITNIM_PRLI_RETRY
= 3, /* prli retry */
422 BFA_ITNIM_HCB_ONLINE
= 4, /* online callback */
423 BFA_ITNIM_ONLINE
= 5, /* online */
424 BFA_ITNIM_HCB_OFFLINE
= 6, /* offline callback */
425 BFA_ITNIM_INITIATIOR
= 7, /* initiator */
429 * FCS remote port statistics
431 struct bfa_itnim_stats_s
{
432 u32 onlines
; /* num rport online */
433 u32 offlines
; /* num rport offline */
434 u32 prli_sent
; /* num prli sent out */
435 u32 fcxp_alloc_wait
;/* num fcxp alloc waits */
436 u32 prli_rsp_err
; /* num prli rsp errors */
437 u32 prli_rsp_acc
; /* num prli rsp accepts */
438 u32 initiator
; /* rport is an initiator */
439 u32 prli_rsp_parse_err
; /* prli rsp parsing errors */
440 u32 prli_rsp_rjt
; /* num prli rsp rejects */
441 u32 timeout
; /* num timeouts detected */
442 u32 sler
; /* num sler notification from BFA */
443 u32 rsvd
; /* padding for 64 bit alignment */
447 * FCS itnim attributes returned in queries
449 struct bfa_itnim_attr_s
{
450 enum bfa_itnim_state state
; /* FCS itnim state */
451 u8 retry
; /* data retransmision support */
452 u8 task_retry_id
; /* task retry ident support */
453 u8 rec_support
; /* REC supported */
454 u8 conf_comp
; /* confirmed completion supp */
457 #endif /* __BFA_DEFS_FCS_H__ */