2 * Copyright (c) 2005-2009 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_PORT_H__
19 #define __BFA_DEFS_PORT_H__
21 #include <bfa_os_inc.h>
22 #include <protocol/types.h>
23 #include <defs/bfa_defs_pport.h>
24 #include <defs/bfa_defs_ioc.h>
26 #define BFA_FCS_FABRIC_IPADDR_SZ 16
29 * symbolic names for base port/virtual port
31 #define BFA_SYMNAME_MAXLEN 128 /* vmware/windows uses 128 bytes */
32 struct bfa_port_symname_s
{
33 char symname
[BFA_SYMNAME_MAXLEN
];
38 * - FCP IM and FCP TM roles cannot be enabled together for a FCS port
39 * - Create multiple ports if both IM and TM functions required.
40 * - Atleast one role must be specified.
43 BFA_PORT_ROLE_FCP_IM
= 0x01, /* FCP initiator role */
44 BFA_PORT_ROLE_FCP_TM
= 0x02, /* FCP target role */
45 BFA_PORT_ROLE_FCP_IPFC
= 0x04, /* IP over FC role */
46 BFA_PORT_ROLE_FCP_MAX
= BFA_PORT_ROLE_FCP_IPFC
| BFA_PORT_ROLE_FCP_IM
50 * FCS port configuration.
52 struct bfa_port_cfg_s
{
53 wwn_t pwwn
; /* port wwn */
54 wwn_t nwwn
; /* node wwn */
55 struct bfa_port_symname_s sym_name
; /* vm port symbolic name */
56 enum bfa_port_role roles
; /* FCS port roles */
58 u8 tag
[16]; /* opaque tag from application */
65 BFA_PORT_UNINIT
= 0, /* PORT is not yet initialized */
66 BFA_PORT_FDISC
= 1, /* FDISC is in progress */
67 BFA_PORT_ONLINE
= 2, /* login to fabric is complete */
68 BFA_PORT_OFFLINE
= 3, /* No login to fabric */
72 * FCS port type. Required for VmWare.
75 BFA_PORT_TYPE_PHYSICAL
= 0,
76 BFA_PORT_TYPE_VIRTUAL
,
80 * FCS port offline reason. Required for VmWare.
82 enum bfa_port_offline_reason
{
83 BFA_PORT_OFFLINE_UNKNOWN
= 0,
84 BFA_PORT_OFFLINE_LINKDOWN
,
85 BFA_PORT_OFFLINE_FAB_UNSUPPORTED
, /* NPIV not supported by the
87 BFA_PORT_OFFLINE_FAB_NORESOURCES
,
88 BFA_PORT_OFFLINE_FAB_LOGOUT
,
92 * FCS lport info. Required for VmWare.
94 struct bfa_port_info_s
{
95 u8 port_type
; /* bfa_port_type_t : physical or
97 u8 port_state
; /* one of bfa_port_state values */
98 u8 offline_reason
; /* one of bfa_port_offline_reason_t
104 * following 4 feilds are valid for Physical Ports only
106 u32 max_vports_supp
; /* Max supported vports */
107 u32 num_vports_inuse
; /* Num of in use vports */
108 u32 max_rports_supp
; /* Max supported rports */
109 u32 num_rports_inuse
; /* Num of doscovered rports */
114 * FCS port statistics
116 struct bfa_port_stats_s
{
118 u32 ns_plogi_rsp_err
;
119 u32 ns_plogi_acc_err
;
120 u32 ns_plogi_accepts
;
121 u32 ns_rejects
; /* NS command rejects */
122 u32 ns_plogi_unknown_rsp
;
123 u32 ns_plogi_alloc_wait
;
125 u32 ns_retries
; /* NS command retries */
126 u32 ns_timeouts
; /* NS command timeouts */
129 u32 ns_rspnid_accepts
;
130 u32 ns_rspnid_rsp_err
;
131 u32 ns_rspnid_rejects
;
132 u32 ns_rspnid_alloc_wait
;
135 u32 ns_rftid_accepts
;
136 u32 ns_rftid_rsp_err
;
137 u32 ns_rftid_rejects
;
138 u32 ns_rftid_alloc_wait
;
141 u32 ns_rffid_accepts
;
142 u32 ns_rffid_rsp_err
;
143 u32 ns_rffid_rejects
;
144 u32 ns_rffid_alloc_wait
;
147 u32 ns_gidft_accepts
;
148 u32 ns_gidft_rsp_err
;
149 u32 ns_gidft_rejects
;
150 u32 ns_gidft_unknown_rsp
;
151 u32 ns_gidft_alloc_wait
;
156 u32 ms_retries
; /* MS command retries */
157 u32 ms_timeouts
; /* MS command timeouts */
159 u32 ms_plogi_rsp_err
;
160 u32 ms_plogi_acc_err
;
161 u32 ms_plogi_accepts
;
162 u32 ms_rejects
; /* NS command rejects */
163 u32 ms_plogi_unknown_rsp
;
164 u32 ms_plogi_alloc_wait
;
166 u32 num_rscn
; /* Num of RSCN received */
167 u32 num_portid_rscn
;/* Num portid format RSCN
170 u32 uf_recvs
; /* unsolicited recv frames */
171 u32 uf_recv_drops
; /* dropped received frames */
173 u32 rsvd
; /* padding for 64 bit alignment */
177 * BFA port attribute returned in queries
179 struct bfa_port_attr_s
{
180 enum bfa_port_state state
; /* port state */
181 u32 pid
; /* port ID */
182 struct bfa_port_cfg_s port_cfg
; /* port configuration */
183 enum bfa_pport_type port_type
; /* current topology */
184 u32 loopback
; /* cable is externally looped back */
185 wwn_t fabric_name
; /* attached switch's nwwn */
186 u8 fabric_ip_addr
[BFA_FCS_FABRIC_IPADDR_SZ
]; /* attached
187 * fabric's ip addr */
188 struct mac_s fpma_mac
; /* Lport's FPMA Mac address */
189 u16 authfail
; /* auth failed state */
193 * BFA physical port Level events
194 * Arguments below are in BFAL context from Mgmt
195 * BFA_PORT_AEN_ONLINE: [in]: pwwn [out]: pwwn
196 * BFA_PORT_AEN_OFFLINE: [in]: pwwn [out]: pwwn
197 * BFA_PORT_AEN_RLIR: [in]: None [out]: pwwn, rlir_data, rlir_len
198 * BFA_PORT_AEN_SFP_INSERT: [in]: pwwn [out]: port_id, pwwn
199 * BFA_PORT_AEN_SFP_REMOVE: [in]: pwwn [out]: port_id, pwwn
200 * BFA_PORT_AEN_SFP_POM: [in]: pwwn [out]: level, port_id, pwwn
201 * BFA_PORT_AEN_ENABLE: [in]: pwwn [out]: pwwn
202 * BFA_PORT_AEN_DISABLE: [in]: pwwn [out]: pwwn
203 * BFA_PORT_AEN_AUTH_ON: [in]: pwwn [out]: pwwn
204 * BFA_PORT_AEN_AUTH_OFF: [in]: pwwn [out]: pwwn
205 * BFA_PORT_AEN_DISCONNECT: [in]: pwwn [out]: pwwn
206 * BFA_PORT_AEN_QOS_NEG: [in]: pwwn [out]: pwwn
207 * BFA_PORT_AEN_FABRIC_NAME_CHANGE: [in]: pwwn, [out]: pwwn, fwwn
210 enum bfa_port_aen_event
{
211 BFA_PORT_AEN_ONLINE
= 1, /* Physical Port online event */
212 BFA_PORT_AEN_OFFLINE
= 2, /* Physical Port offline event */
213 BFA_PORT_AEN_RLIR
= 3, /* RLIR event, not supported */
214 BFA_PORT_AEN_SFP_INSERT
= 4, /* SFP inserted event */
215 BFA_PORT_AEN_SFP_REMOVE
= 5, /* SFP removed event */
216 BFA_PORT_AEN_SFP_POM
= 6, /* SFP POM event */
217 BFA_PORT_AEN_ENABLE
= 7, /* Physical Port enable event */
218 BFA_PORT_AEN_DISABLE
= 8, /* Physical Port disable event */
219 BFA_PORT_AEN_AUTH_ON
= 9, /* Physical Port auth success event */
220 BFA_PORT_AEN_AUTH_OFF
= 10, /* Physical Port auth fail event */
221 BFA_PORT_AEN_DISCONNECT
= 11, /* Physical Port disconnect event */
222 BFA_PORT_AEN_QOS_NEG
= 12, /* Base Port QOS negotiation event */
223 BFA_PORT_AEN_FABRIC_NAME_CHANGE
= 13, /* Fabric Name/WWN change
225 BFA_PORT_AEN_SFP_ACCESS_ERROR
= 14, /* SFP read error event */
226 BFA_PORT_AEN_SFP_UNSUPPORT
= 15, /* Unsupported SFP event */
229 enum bfa_port_aen_sfp_pom
{
230 BFA_PORT_AEN_SFP_POM_GREEN
= 1, /* Normal */
231 BFA_PORT_AEN_SFP_POM_AMBER
= 2, /* Warning */
232 BFA_PORT_AEN_SFP_POM_RED
= 3, /* Critical */
233 BFA_PORT_AEN_SFP_POM_MAX
= BFA_PORT_AEN_SFP_POM_RED
236 struct bfa_port_aen_data_s
{
237 wwn_t pwwn
; /* WWN of the physical port */
238 wwn_t fwwn
; /* WWN of the fabric port */
239 s32 phy_port_num
; /*! For SFP related events */
241 s16 level
; /* Only transitions will
243 struct mac_s mac
; /* MAC address of the ethernet port,
244 * applicable to CNA port only */
248 #endif /* __BFA_DEFS_PORT_H__ */