• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/scsi/bfa/include/fcs/
1/*
2 * Copyright (c) 2005-2009 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/**
19 *  bfa_fcs_port.h BFA fcs port module public interface
20 */
21
22#ifndef __BFA_FCS_PORT_H__
23#define __BFA_FCS_PORT_H__
24
25#include <defs/bfa_defs_status.h>
26#include <defs/bfa_defs_port.h>
27#include <defs/bfa_defs_pport.h>
28#include <defs/bfa_defs_rport.h>
29#include <cs/bfa_q.h>
30#include <bfa_svc.h>
31#include <cs/bfa_wc.h>
32
33struct bfa_fcs_s;
34struct bfa_fcs_fabric_s;
35
36/*
37 * Maximum Rports supported per port (physical/logical).
38 */
39#define BFA_FCS_MAX_RPORTS_SUPP  256	/* @todo : tentative value */
40
41
42struct bfa_fcs_port_ns_s {
43	bfa_sm_t        sm;		/*  state machine */
44	struct bfa_timer_s timer;
45	struct bfa_fcs_port_s *port;	/*  parent port */
46	struct bfa_fcxp_s *fcxp;
47	struct bfa_fcxp_wqe_s fcxp_wqe;
48};
49
50
51struct bfa_fcs_port_scn_s {
52	bfa_sm_t        sm;		/*  state machine */
53	struct bfa_timer_s timer;
54	struct bfa_fcs_port_s *port;	/*  parent port */
55	struct bfa_fcxp_s *fcxp;
56	struct bfa_fcxp_wqe_s fcxp_wqe;
57};
58
59
60struct bfa_fcs_port_fdmi_s {
61	bfa_sm_t        sm;		/*  state machine */
62	struct bfa_timer_s timer;
63	struct bfa_fcs_port_ms_s *ms;	/*  parent ms */
64	struct bfa_fcxp_s *fcxp;
65	struct bfa_fcxp_wqe_s fcxp_wqe;
66	u8         retry_cnt;	/*  retry count */
67	u8	 	   rsvd[3];
68};
69
70
71struct bfa_fcs_port_ms_s {
72	bfa_sm_t        sm;		/*  state machine */
73	struct bfa_timer_s timer;
74	struct bfa_fcs_port_s *port;	/*  parent port */
75	struct bfa_fcxp_s *fcxp;
76	struct bfa_fcxp_wqe_s fcxp_wqe;
77	struct bfa_fcs_port_fdmi_s fdmi;	/*  FDMI component of MS */
78	u8         retry_cnt;	/*  retry count */
79	u8	 	   rsvd[3];
80};
81
82
83struct bfa_fcs_port_fab_s {
84	struct bfa_fcs_port_ns_s ns;	/*  NS component of port */
85	struct bfa_fcs_port_scn_s scn;	/*  scn component of port */
86	struct bfa_fcs_port_ms_s ms;	/*  MS component of port */
87};
88
89
90
91#define 	MAX_ALPA_COUNT 		127
92
93struct bfa_fcs_port_loop_s {
94	u8         num_alpa;	/*  Num of ALPA entries in the map */
95	u8         alpa_pos_map[MAX_ALPA_COUNT];	/*  ALPA Positional
96							 *Map */
97	struct bfa_fcs_port_s *port;	/*  parent port */
98};
99
100
101
102struct bfa_fcs_port_n2n_s {
103	u32        rsvd;
104	u16        reply_oxid;	/*  ox_id from the req flogi to be
105					 *used in flogi acc */
106	wwn_t           rem_port_wwn;	/*  Attached port's wwn */
107};
108
109
110union bfa_fcs_port_topo_u {
111	struct bfa_fcs_port_fab_s pfab;
112	struct bfa_fcs_port_loop_s ploop;
113	struct bfa_fcs_port_n2n_s pn2n;
114};
115
116
117struct bfa_fcs_port_s {
118	struct list_head         qe;	/*  used by port/vport */
119	bfa_sm_t               sm;	/*  state machine */
120	struct bfa_fcs_fabric_s *fabric;/*  parent fabric */
121	struct bfa_port_cfg_s  port_cfg;/*  port configuration */
122	struct bfa_timer_s link_timer;	/*  timer for link offline */
123	u32 pid:24;	/*  FC address */
124	u8  lp_tag;	/*  lport tag */
125	u16 num_rports;	/*  Num of r-ports */
126	struct list_head rport_q;	/*  queue of discovered r-ports */
127	struct bfa_fcs_s *fcs;	/*  FCS instance */
128	union bfa_fcs_port_topo_u port_topo;	/*  fabric/loop/n2n details */
129	struct bfad_port_s *bfad_port;	/*  driver peer instance */
130	struct bfa_fcs_vport_s *vport;	/*  NULL for base ports */
131	struct bfa_fcxp_s *fcxp;
132	struct bfa_fcxp_wqe_s fcxp_wqe;
133	struct bfa_port_stats_s stats;
134	struct bfa_wc_s        wc;	/*  waiting counter for events */
135};
136
137#define bfa_fcs_lport_t struct bfa_fcs_port_s
138
139/**
140 * Symbolic Name related defines
141 *  Total bytes 255.
142 *  Physical Port's symbolic name 128 bytes.
143 *  For Vports, Vport's symbolic name is appended to the Physical port's
144 *  Symbolic Name.
145 *
146 *  Physical Port's symbolic name Format : (Total 128 bytes)
147 *  Adapter Model number/name : 12 bytes
148 *  Driver Version     : 10 bytes
149 *  Host Machine Name  : 30 bytes
150 * 	Host OS Info	   : 48 bytes
151 * 	Host OS PATCH Info : 16 bytes
152 *  ( remaining 12 bytes reserved to be used for separator)
153 */
154#define BFA_FCS_PORT_SYMBNAME_SEPARATOR 		" | "
155
156#define BFA_FCS_PORT_SYMBNAME_MODEL_SZ			12
157#define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 		10
158#define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 	30
159#define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ			48
160#define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ		16
161
162/**
163 * Get FC port ID for a logical port.
164 */
165#define bfa_fcs_port_get_fcid(_lport)	((_lport)->pid)
166#define bfa_fcs_port_get_pwwn(_lport)	((_lport)->port_cfg.pwwn)
167#define bfa_fcs_port_get_nwwn(_lport)	((_lport)->port_cfg.nwwn)
168#define bfa_fcs_port_get_psym_name(_lport)	((_lport)->port_cfg.sym_name)
169#define bfa_fcs_port_is_initiator(_lport)	\
170			((_lport)->port_cfg.roles & BFA_PORT_ROLE_FCP_IM)
171#define bfa_fcs_port_is_target(_lport)	\
172			((_lport)->port_cfg.roles & BFA_PORT_ROLE_FCP_TM)
173#define bfa_fcs_port_get_nrports(_lport)	\
174			((_lport) ? (_lport)->num_rports : 0)
175
176static inline struct bfad_port_s *
177bfa_fcs_port_get_drvport(struct bfa_fcs_port_s *port)
178{
179	return port->bfad_port;
180}
181
182
183#define bfa_fcs_port_get_opertype(_lport)	((_lport)->fabric->oper_type)
184
185
186#define bfa_fcs_port_get_fabric_name(_lport)	((_lport)->fabric->fabric_name)
187
188
189#define bfa_fcs_port_get_fabric_ipaddr(_lport) \
190		((_lport)->fabric->fabric_ip_addr)
191
192/**
193 * bfa fcs port public functions
194 */
195void bfa_fcs_cfg_base_port(struct bfa_fcs_s *fcs,
196			struct bfa_port_cfg_s *port_cfg);
197struct bfa_fcs_port_s *bfa_fcs_get_base_port(struct bfa_fcs_s *fcs);
198void bfa_fcs_port_get_rports(struct bfa_fcs_port_s *port,
199			wwn_t rport_wwns[], int *nrports);
200
201wwn_t bfa_fcs_port_get_rport(struct bfa_fcs_port_s *port, wwn_t wwn,
202			int index, int nrports, bfa_boolean_t bwwn);
203
204struct bfa_fcs_port_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs,
205			u16 vf_id, wwn_t lpwwn);
206
207void bfa_fcs_port_get_info(struct bfa_fcs_port_s *port,
208			struct bfa_port_info_s *port_info);
209void bfa_fcs_port_get_attr(struct bfa_fcs_port_s *port,
210			struct bfa_port_attr_s *port_attr);
211void bfa_fcs_port_get_stats(struct bfa_fcs_port_s *fcs_port,
212			struct bfa_port_stats_s *port_stats);
213void bfa_fcs_port_clear_stats(struct bfa_fcs_port_s *fcs_port);
214enum bfa_pport_speed bfa_fcs_port_get_rport_max_speed(
215			struct bfa_fcs_port_s *port);
216void bfa_fcs_port_enable_ipfc_roles(struct bfa_fcs_port_s *fcs_port);
217void bfa_fcs_port_disable_ipfc_roles(struct bfa_fcs_port_s *fcs_port);
218
219#endif /* __BFA_FCS_PORT_H__ */
220