summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/include/defs/bfa_defs_port.h
blob: de0696c81bc4cb4267d3a41e9032d4036e7273fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
/*
 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
 * All rights reserved
 * www.brocade.com
 *
 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License (GPL) Version 2 as
 * published by the Free Software Foundation
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 */

#ifndef __BFA_DEFS_PORT_H__
#define __BFA_DEFS_PORT_H__

#include <bfa_os_inc.h>
#include <protocol/types.h>
#include <defs/bfa_defs_pport.h>
#include <defs/bfa_defs_ioc.h>

#define BFA_FCS_FABRIC_IPADDR_SZ  16

/**
 * symbolic names for base port/virtual port
 */
#define BFA_SYMNAME_MAXLEN	128	/* vmware/windows uses 128 bytes */
struct bfa_port_symname_s {
	char            symname[BFA_SYMNAME_MAXLEN];
};

/**
* Roles of FCS port:
 *     - FCP IM and FCP TM roles cannot be enabled together for a FCS port
 *     - Create multiple ports if both IM and TM functions required.
 *     - Atleast one role must be specified.
 */
enum bfa_port_role {
	BFA_PORT_ROLE_FCP_IM 	= 0x01,	/*  FCP initiator role */
	BFA_PORT_ROLE_FCP_TM 	= 0x02,	/*  FCP target role */
	BFA_PORT_ROLE_FCP_IPFC 	= 0x04,	/*  IP over FC role */
	BFA_PORT_ROLE_FCP_MAX 	= BFA_PORT_ROLE_FCP_IPFC | BFA_PORT_ROLE_FCP_IM
};

/**
 * FCS port configuration.
 */
struct bfa_port_cfg_s {
    wwn_t               pwwn;       /*  port wwn */
    wwn_t               nwwn;       /*  node wwn */
    struct bfa_port_symname_s  sym_name;   /*  vm port symbolic name */
    enum bfa_port_role     roles;      /*  FCS port roles */
	u32			rsvd;
    u8             tag[16];	/*  opaque tag from application */
};

/**
 * FCS port states
 */
enum bfa_port_state {
	BFA_PORT_UNINIT  = 0,	/*  PORT is not yet initialized */
	BFA_PORT_FDISC   = 1,	/*  FDISC is in progress */
	BFA_PORT_ONLINE  = 2,	/*  login to fabric is complete */
	BFA_PORT_OFFLINE = 3,	/*  No login to fabric */
};

/**
 * FCS port type. Required for VmWare.
 */
enum bfa_port_type {
	BFA_PORT_TYPE_PHYSICAL = 0,
	BFA_PORT_TYPE_VIRTUAL,
};

/**
 * FCS port offline reason. Required for VmWare.
 */
enum bfa_port_offline_reason {
	BFA_PORT_OFFLINE_UNKNOWN = 0,
	BFA_PORT_OFFLINE_LINKDOWN,
	BFA_PORT_OFFLINE_FAB_UNSUPPORTED,	/*  NPIV not supported by the
						 *    fabric */
	BFA_PORT_OFFLINE_FAB_NORESOURCES,
	BFA_PORT_OFFLINE_FAB_LOGOUT,
};

/**
 * FCS lport info. Required for VmWare.
 */
struct bfa_port_info_s {
	u8         port_type;	/* bfa_port_type_t : physical or
					 * virtual */
	u8         port_state;	/* one of bfa_port_state values */
	u8         offline_reason;	/* one of bfa_port_offline_reason_t
					 * values */
	wwn_t           port_wwn;
	wwn_t           node_wwn;

	/*
	 * following 4 feilds are valid for Physical Ports only
	 */
	u32        max_vports_supp;	/* Max supported vports */
	u32        num_vports_inuse;	/* Num of in use vports */
	u32        max_rports_supp;	/* Max supported rports */
	u32        num_rports_inuse;	/* Num of doscovered rports */

};

/**
 * FCS port statistics
 */
struct bfa_port_stats_s {
	u32        ns_plogi_sent;
	u32        ns_plogi_rsp_err;
	u32        ns_plogi_acc_err;
	u32        ns_plogi_accepts;
	u32        ns_rejects;	/* NS command rejects */
	u32        ns_plogi_unknown_rsp;
	u32        ns_plogi_alloc_wait;

	u32        ns_retries;	/* NS command retries */
	u32        ns_timeouts;	/* NS command timeouts */

	u32        ns_rspnid_sent;
	u32        ns_rspnid_accepts;
	u32        ns_rspnid_rsp_err;
	u32        ns_rspnid_rejects;
	u32        ns_rspnid_alloc_wait;

	u32        ns_rftid_sent;
	u32        ns_rftid_accepts;
	u32        ns_rftid_rsp_err;
	u32        ns_rftid_rejects;
	u32        ns_rftid_alloc_wait;

	u32	ns_rffid_sent;
	u32	ns_rffid_accepts;
	u32	ns_rffid_rsp_err;
	u32	ns_rffid_rejects;
	u32	ns_rffid_alloc_wait;

	u32        ns_gidft_sent;
	u32        ns_gidft_accepts;
	u32        ns_gidft_rsp_err;
	u32        ns_gidft_rejects;
	u32        ns_gidft_unknown_rsp;
	u32        ns_gidft_alloc_wait;

	/*
	 * Mgmt Server stats
	 */
	u32        ms_retries;	/* MS command retries */
	u32        ms_timeouts;	/* MS command timeouts */
	u32        ms_plogi_sent;
	u32        ms_plogi_rsp_err;
	u32        ms_plogi_acc_err;
	u32        ms_plogi_accepts;
	u32        ms_rejects;	/* NS command rejects */
	u32        ms_plogi_unknown_rsp;
	u32        ms_plogi_alloc_wait;

	u32        num_rscn;	/* Num of RSCN received */
	u32        num_portid_rscn;/* Num portid format RSCN
								* received */

	u32	uf_recvs; 	/* unsolicited recv frames      */
	u32	uf_recv_drops; 	/* dropped received frames	*/

	u32	rsvd; 		/* padding for 64 bit alignment */
};

/**
 * BFA port attribute returned in queries
 */
struct bfa_port_attr_s {
	enum bfa_port_state state;		/*  port state */
	u32         pid;		/*  port ID */
	struct bfa_port_cfg_s   port_cfg;	/*  port configuration */
	enum bfa_pport_type port_type;	/*  current topology */
	u32         loopback;	/*  cable is externally looped back */
	wwn_t		fabric_name; /*  attached switch's nwwn */
	u8		fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ]; /*  attached
							* fabric's ip addr */
};

/**
 * BFA physical port Level events
 * Arguments below are in BFAL context from Mgmt
 * BFA_PORT_AEN_ONLINE:     [in]: pwwn	[out]: pwwn
 * BFA_PORT_AEN_OFFLINE:    [in]: pwwn	[out]: pwwn
 * BFA_PORT_AEN_RLIR:       [in]: None	[out]: pwwn, rlir_data, rlir_len
 * BFA_PORT_AEN_SFP_INSERT: [in]: pwwn	[out]: port_id, pwwn
 * BFA_PORT_AEN_SFP_REMOVE: [in]: pwwn	[out]: port_id, pwwn
 * BFA_PORT_AEN_SFP_POM:    [in]: pwwn	[out]: level, port_id, pwwn
 * BFA_PORT_AEN_ENABLE:     [in]: pwwn	[out]: pwwn
 * BFA_PORT_AEN_DISABLE:    [in]: pwwn	[out]: pwwn
 * BFA_PORT_AEN_AUTH_ON:    [in]: pwwn	[out]: pwwn
 * BFA_PORT_AEN_AUTH_OFF:   [in]: pwwn	[out]: pwwn
 * BFA_PORT_AEN_DISCONNECT: [in]: pwwn	[out]: pwwn
 * BFA_PORT_AEN_QOS_NEG:    [in]: pwwn	[out]: pwwn
 * BFA_PORT_AEN_FABRIC_NAME_CHANGE: [in]: pwwn, [out]: pwwn, fwwn
 *
 */
enum bfa_port_aen_event {
	BFA_PORT_AEN_ONLINE     = 1,	/*  Physical Port online event */
	BFA_PORT_AEN_OFFLINE    = 2,	/*  Physical Port offline event */
	BFA_PORT_AEN_RLIR       = 3,	/*  RLIR event, not supported */
	BFA_PORT_AEN_SFP_INSERT = 4,	/*  SFP inserted event */
	BFA_PORT_AEN_SFP_REMOVE = 5,	/*  SFP removed event */
	BFA_PORT_AEN_SFP_POM    = 6,	/*  SFP POM event */
	BFA_PORT_AEN_ENABLE     = 7,	/*  Physical Port enable event */
	BFA_PORT_AEN_DISABLE    = 8,	/*  Physical Port disable event */
	BFA_PORT_AEN_AUTH_ON    = 9,	/*  Physical Port auth success event */
	BFA_PORT_AEN_AUTH_OFF   = 10,	/*  Physical Port auth fail event */
	BFA_PORT_AEN_DISCONNECT = 11,	/*  Physical Port disconnect event */
	BFA_PORT_AEN_QOS_NEG    = 12,  	/*  Base Port QOS negotiation event */
	BFA_PORT_AEN_FABRIC_NAME_CHANGE = 13, /*  Fabric Name/WWN change
					       * event */
	BFA_PORT_AEN_SFP_ACCESS_ERROR = 14, /*  SFP read error event */
	BFA_PORT_AEN_SFP_UNSUPPORT = 15, /*  Unsupported SFP event */
};

enum bfa_port_aen_sfp_pom {
	BFA_PORT_AEN_SFP_POM_GREEN = 1,	/*  Normal */
	BFA_PORT_AEN_SFP_POM_AMBER = 2,	/*  Warning */
	BFA_PORT_AEN_SFP_POM_RED   = 3,	/*  Critical */
	BFA_PORT_AEN_SFP_POM_MAX   = BFA_PORT_AEN_SFP_POM_RED
};

struct bfa_port_aen_data_s {
	enum bfa_ioc_type_e ioc_type;
	wwn_t           pwwn;	      /*  WWN of the physical port */
	wwn_t           fwwn;	      /*  WWN of the fabric port */
	mac_t           mac;	      /*  MAC addres of the ethernet port,
				       * applicable to CNA port only */
	int             phy_port_num; /*! For SFP related events */
	enum bfa_port_aen_sfp_pom level; /*  Only transitions will
					  * be informed */
};

#endif /* __BFA_DEFS_PORT_H__ */
OpenPOWER on IntegriCloud