aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/bfa/bfa_fcport.c1570
-rw-r--r--drivers/scsi/bfa/bfa_fcs_port.c2
-rw-r--r--drivers/scsi/bfa/bfa_module.c4
-rw-r--r--drivers/scsi/bfa/bfa_modules_priv.h2
-rw-r--r--drivers/scsi/bfa/bfa_port_priv.h19
-rw-r--r--drivers/scsi/bfa/bfa_priv.h2
-rw-r--r--drivers/scsi/bfa/bfa_trcmod_priv.h2
-rw-r--r--drivers/scsi/bfa/bfad.c2
-rw-r--r--drivers/scsi/bfa/bfad_attr.c6
-rw-r--r--drivers/scsi/bfa/bfad_im.c2
-rw-r--r--drivers/scsi/bfa/fabric.c20
-rw-r--r--drivers/scsi/bfa/fdmi.c2
-rw-r--r--drivers/scsi/bfa/include/bfa_svc.h76
-rw-r--r--drivers/scsi/bfa/include/bfi/bfi_pport.h5
-rw-r--r--drivers/scsi/bfa/include/cs/bfa_sm.h8
-rw-r--r--drivers/scsi/bfa/include/defs/bfa_defs_ethport.h1
-rw-r--r--drivers/scsi/bfa/include/defs/bfa_defs_fcport.h94
-rw-r--r--drivers/scsi/bfa/include/defs/bfa_defs_iocfc.h1
-rw-r--r--drivers/scsi/bfa/loop.c2
-rw-r--r--drivers/scsi/bfa/lport_api.c2
-rw-r--r--drivers/scsi/bfa/ms.c2
-rw-r--r--drivers/scsi/bfa/ns.c2
-rw-r--r--drivers/scsi/bfa/rport.c8
-rw-r--r--drivers/scsi/bfa/rport_api.c2
-rw-r--r--drivers/scsi/bfa/vport.c2
25 files changed, 1103 insertions, 735 deletions
diff --git a/drivers/scsi/bfa/bfa_fcport.c b/drivers/scsi/bfa/bfa_fcport.c
index bdea7f0eb6bd..f392a7fa8c7f 100644
--- a/drivers/scsi/bfa/bfa_fcport.c
+++ b/drivers/scsi/bfa/bfa_fcport.c
@@ -23,34 +23,40 @@
23#include <cs/bfa_plog.h> 23#include <cs/bfa_plog.h>
24#include <aen/bfa_aen_port.h> 24#include <aen/bfa_aen_port.h>
25 25
26BFA_TRC_FILE(HAL, PPORT); 26BFA_TRC_FILE(HAL, FCPORT);
27BFA_MODULE(pport); 27BFA_MODULE(fcport);
28 28
29/* 29/*
30 * The port is considered disabled if corresponding physical port or IOC are 30 * The port is considered disabled if corresponding physical port or IOC are
31 * disabled explicitly 31 * disabled explicitly
32 */ 32 */
33#define BFA_PORT_IS_DISABLED(bfa) \ 33#define BFA_PORT_IS_DISABLED(bfa) \
34 ((bfa_pport_is_disabled(bfa) == BFA_TRUE) || \ 34 ((bfa_fcport_is_disabled(bfa) == BFA_TRUE) || \
35 (bfa_ioc_is_disabled(&bfa->ioc) == BFA_TRUE)) 35 (bfa_ioc_is_disabled(&bfa->ioc) == BFA_TRUE))
36 36
37/* 37/*
38 * forward declarations 38 * forward declarations
39 */ 39 */
40static bfa_boolean_t bfa_pport_send_enable(struct bfa_pport_s *port); 40static bfa_boolean_t bfa_fcport_send_enable(struct bfa_fcport_s *fcport);
41static bfa_boolean_t bfa_pport_send_disable(struct bfa_pport_s *port); 41static bfa_boolean_t bfa_fcport_send_disable(struct bfa_fcport_s *fcport);
42static void bfa_pport_update_linkinfo(struct bfa_pport_s *pport); 42static void bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport);
43static void bfa_pport_reset_linkinfo(struct bfa_pport_s *pport); 43static void bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport);
44static void bfa_pport_set_wwns(struct bfa_pport_s *port); 44static void bfa_fcport_set_wwns(struct bfa_fcport_s *fcport);
45static void __bfa_cb_port_event(void *cbarg, bfa_boolean_t complete); 45static void __bfa_cb_fcport_event(void *cbarg, bfa_boolean_t complete);
46static void bfa_fcport_callback(struct bfa_fcport_s *fcport,
47 enum bfa_pport_linkstate event);
48static void bfa_fcport_queue_cb(struct bfa_fcport_ln_s *ln,
49 enum bfa_pport_linkstate event);
50static void __bfa_cb_fcport_stats(void *cbarg, bfa_boolean_t complete);
51static void __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete);
52static void bfa_fcport_stats_timeout(void *cbarg);
53static void bfa_fcport_stats_clr_timeout(void *cbarg);
54
46static void __bfa_cb_port_stats(void *cbarg, bfa_boolean_t complete); 55static void __bfa_cb_port_stats(void *cbarg, bfa_boolean_t complete);
47static void __bfa_cb_port_stats_clr(void *cbarg, bfa_boolean_t complete); 56static void __bfa_cb_port_stats_clr(void *cbarg, bfa_boolean_t complete);
48static void bfa_port_stats_timeout(void *cbarg); 57static void bfa_port_stats_timeout(void *cbarg);
49static void bfa_port_stats_clr_timeout(void *cbarg); 58static void bfa_port_stats_clr_timeout(void *cbarg);
50static void bfa_pport_callback(struct bfa_pport_s *pport, 59
51 enum bfa_pport_linkstate event);
52static void bfa_pport_queue_cb(struct bfa_pport_ln_s *ln,
53 enum bfa_pport_linkstate event);
54/** 60/**
55 * bfa_pport_private 61 * bfa_pport_private
56 */ 62 */
@@ -58,87 +64,86 @@ static void bfa_pport_queue_cb(struct bfa_pport_ln_s *ln,
58/** 64/**
59 * BFA port state machine events 65 * BFA port state machine events
60 */ 66 */
61enum bfa_pport_sm_event { 67enum bfa_fcport_sm_event {
62 BFA_PPORT_SM_START = 1, /* start port state machine */ 68 BFA_FCPORT_SM_START = 1, /* start port state machine */
63 BFA_PPORT_SM_STOP = 2, /* stop port state machine */ 69 BFA_FCPORT_SM_STOP = 2, /* stop port state machine */
64 BFA_PPORT_SM_ENABLE = 3, /* enable port */ 70 BFA_FCPORT_SM_ENABLE = 3, /* enable port */
65 BFA_PPORT_SM_DISABLE = 4, /* disable port state machine */ 71 BFA_FCPORT_SM_DISABLE = 4, /* disable port state machine */
66 BFA_PPORT_SM_FWRSP = 5, /* firmware enable/disable rsp */ 72 BFA_FCPORT_SM_FWRSP = 5, /* firmware enable/disable rsp */
67 BFA_PPORT_SM_LINKUP = 6, /* firmware linkup event */ 73 BFA_FCPORT_SM_LINKUP = 6, /* firmware linkup event */
68 BFA_PPORT_SM_LINKDOWN = 7, /* firmware linkup down */ 74 BFA_FCPORT_SM_LINKDOWN = 7, /* firmware linkup down */
69 BFA_PPORT_SM_QRESUME = 8, /* CQ space available */ 75 BFA_FCPORT_SM_QRESUME = 8, /* CQ space available */
70 BFA_PPORT_SM_HWFAIL = 9, /* IOC h/w failure */ 76 BFA_FCPORT_SM_HWFAIL = 9, /* IOC h/w failure */
71}; 77};
72 78
73/** 79/**
74 * BFA port link notification state machine events 80 * BFA port link notification state machine events
75 */ 81 */
76 82
77enum bfa_pport_ln_sm_event { 83enum bfa_fcport_ln_sm_event {
78 BFA_PPORT_LN_SM_LINKUP = 1, /* linkup event */ 84 BFA_FCPORT_LN_SM_LINKUP = 1, /* linkup event */
79 BFA_PPORT_LN_SM_LINKDOWN = 2, /* linkdown event */ 85 BFA_FCPORT_LN_SM_LINKDOWN = 2, /* linkdown event */
80 BFA_PPORT_LN_SM_NOTIFICATION = 3 /* done notification */ 86 BFA_FCPORT_LN_SM_NOTIFICATION = 3 /* done notification */
81}; 87};
82 88
83static void bfa_pport_sm_uninit(struct bfa_pport_s *pport, 89static void bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
84 enum bfa_pport_sm_event event); 90 enum bfa_fcport_sm_event event);
85static void bfa_pport_sm_enabling_qwait(struct bfa_pport_s *pport, 91static void bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport,
86 enum bfa_pport_sm_event event); 92 enum bfa_fcport_sm_event event);
87static void bfa_pport_sm_enabling(struct bfa_pport_s *pport, 93static void bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport,
88 enum bfa_pport_sm_event event); 94 enum bfa_fcport_sm_event event);
89static void bfa_pport_sm_linkdown(struct bfa_pport_s *pport, 95static void bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
90 enum bfa_pport_sm_event event); 96 enum bfa_fcport_sm_event event);
91static void bfa_pport_sm_linkup(struct bfa_pport_s *pport, 97static void bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
92 enum bfa_pport_sm_event event); 98 enum bfa_fcport_sm_event event);
93static void bfa_pport_sm_disabling(struct bfa_pport_s *pport, 99static void bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport,
94 enum bfa_pport_sm_event event); 100 enum bfa_fcport_sm_event event);
95static void bfa_pport_sm_disabling_qwait(struct bfa_pport_s *pport, 101static void bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport,
96 enum bfa_pport_sm_event event); 102 enum bfa_fcport_sm_event event);
97static void bfa_pport_sm_disabled(struct bfa_pport_s *pport, 103static void bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport,
98 enum bfa_pport_sm_event event); 104 enum bfa_fcport_sm_event event);
99static void bfa_pport_sm_stopped(struct bfa_pport_s *pport, 105static void bfa_fcport_sm_stopped(struct bfa_fcport_s *fcport,
100 enum bfa_pport_sm_event event); 106 enum bfa_fcport_sm_event event);
101static void bfa_pport_sm_iocdown(struct bfa_pport_s *pport, 107static void bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport,
102 enum bfa_pport_sm_event event); 108 enum bfa_fcport_sm_event event);
103static void bfa_pport_sm_iocfail(struct bfa_pport_s *pport, 109static void bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport,
104 enum bfa_pport_sm_event event); 110 enum bfa_fcport_sm_event event);
105 111
106static void bfa_pport_ln_sm_dn(struct bfa_pport_ln_s *ln, 112static void bfa_fcport_ln_sm_dn(struct bfa_fcport_ln_s *ln,
107 enum bfa_pport_ln_sm_event event); 113 enum bfa_fcport_ln_sm_event event);
108static void bfa_pport_ln_sm_dn_nf(struct bfa_pport_ln_s *ln, 114static void bfa_fcport_ln_sm_dn_nf(struct bfa_fcport_ln_s *ln,
109 enum bfa_pport_ln_sm_event event); 115 enum bfa_fcport_ln_sm_event event);
110static void bfa_pport_ln_sm_dn_up_nf(struct bfa_pport_ln_s *ln, 116static void bfa_fcport_ln_sm_dn_up_nf(struct bfa_fcport_ln_s *ln,
111 enum bfa_pport_ln_sm_event event); 117 enum bfa_fcport_ln_sm_event event);
112static void bfa_pport_ln_sm_up(struct bfa_pport_ln_s *ln, 118static void bfa_fcport_ln_sm_up(struct bfa_fcport_ln_s *ln,
113 enum bfa_pport_ln_sm_event event); 119 enum bfa_fcport_ln_sm_event event);
114static void bfa_pport_ln_sm_up_nf(struct bfa_pport_ln_s *ln, 120static void bfa_fcport_ln_sm_up_nf(struct bfa_fcport_ln_s *ln,
115 enum bfa_pport_ln_sm_event event); 121 enum bfa_fcport_ln_sm_event event);
116static void bfa_pport_ln_sm_up_dn_nf(struct bfa_pport_ln_s *ln, 122static void bfa_fcport_ln_sm_up_dn_nf(struct bfa_fcport_ln_s *ln,
117 enum bfa_pport_ln_sm_event event); 123 enum bfa_fcport_ln_sm_event event);
118static void bfa_pport_ln_sm_up_dn_up_nf(struct bfa_pport_ln_s *ln, 124static void bfa_fcport_ln_sm_up_dn_up_nf(struct bfa_fcport_ln_s *ln,
119 enum bfa_pport_ln_sm_event event); 125 enum bfa_fcport_ln_sm_event event);
120 126
121static struct bfa_sm_table_s hal_pport_sm_table[] = { 127static struct bfa_sm_table_s hal_pport_sm_table[] = {
122 {BFA_SM(bfa_pport_sm_uninit), BFA_PPORT_ST_UNINIT}, 128 {BFA_SM(bfa_fcport_sm_uninit), BFA_PPORT_ST_UNINIT},
123 {BFA_SM(bfa_pport_sm_enabling_qwait), BFA_PPORT_ST_ENABLING_QWAIT}, 129 {BFA_SM(bfa_fcport_sm_enabling_qwait), BFA_PPORT_ST_ENABLING_QWAIT},
124 {BFA_SM(bfa_pport_sm_enabling), BFA_PPORT_ST_ENABLING}, 130 {BFA_SM(bfa_fcport_sm_enabling), BFA_PPORT_ST_ENABLING},
125 {BFA_SM(bfa_pport_sm_linkdown), BFA_PPORT_ST_LINKDOWN}, 131 {BFA_SM(bfa_fcport_sm_linkdown), BFA_PPORT_ST_LINKDOWN},
126 {BFA_SM(bfa_pport_sm_linkup), BFA_PPORT_ST_LINKUP}, 132 {BFA_SM(bfa_fcport_sm_linkup), BFA_PPORT_ST_LINKUP},
127 {BFA_SM(bfa_pport_sm_disabling_qwait), 133 {BFA_SM(bfa_fcport_sm_disabling_qwait), BFA_PPORT_ST_DISABLING_QWAIT},
128 BFA_PPORT_ST_DISABLING_QWAIT}, 134 {BFA_SM(bfa_fcport_sm_disabling), BFA_PPORT_ST_DISABLING},
129 {BFA_SM(bfa_pport_sm_disabling), BFA_PPORT_ST_DISABLING}, 135 {BFA_SM(bfa_fcport_sm_disabled), BFA_PPORT_ST_DISABLED},
130 {BFA_SM(bfa_pport_sm_disabled), BFA_PPORT_ST_DISABLED}, 136 {BFA_SM(bfa_fcport_sm_stopped), BFA_PPORT_ST_STOPPED},
131 {BFA_SM(bfa_pport_sm_stopped), BFA_PPORT_ST_STOPPED}, 137 {BFA_SM(bfa_fcport_sm_iocdown), BFA_PPORT_ST_IOCDOWN},
132 {BFA_SM(bfa_pport_sm_iocdown), BFA_PPORT_ST_IOCDOWN}, 138 {BFA_SM(bfa_fcport_sm_iocfail), BFA_PPORT_ST_IOCDOWN},
133 {BFA_SM(bfa_pport_sm_iocfail), BFA_PPORT_ST_IOCDOWN},
134}; 139};
135 140
136static void 141static void
137bfa_pport_aen_post(struct bfa_pport_s *pport, enum bfa_port_aen_event event) 142bfa_fcport_aen_post(struct bfa_fcport_s *fcport, enum bfa_port_aen_event event)
138{ 143{
139 union bfa_aen_data_u aen_data; 144 union bfa_aen_data_u aen_data;
140 struct bfa_log_mod_s *logmod = pport->bfa->logm; 145 struct bfa_log_mod_s *logmod = fcport->bfa->logm;
141 wwn_t pwwn = pport->pwwn; 146 wwn_t pwwn = fcport->pwwn;
142 char pwwn_ptr[BFA_STRING_32]; 147 char pwwn_ptr[BFA_STRING_32];
143 struct bfa_ioc_attr_s ioc_attr; 148 struct bfa_ioc_attr_s ioc_attr;
144 149
@@ -167,28 +172,29 @@ bfa_pport_aen_post(struct bfa_pport_s *pport, enum bfa_port_aen_event event)
167 break; 172 break;
168 } 173 }
169 174
170 bfa_ioc_get_attr(&pport->bfa->ioc, &ioc_attr); 175 bfa_ioc_get_attr(&fcport->bfa->ioc, &ioc_attr);
171 aen_data.port.ioc_type = ioc_attr.ioc_type; 176 aen_data.port.ioc_type = ioc_attr.ioc_type;
172 aen_data.port.pwwn = pwwn; 177 aen_data.port.pwwn = pwwn;
173} 178}
174 179
175static void 180static void
176bfa_pport_sm_uninit(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) 181bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
182 enum bfa_fcport_sm_event event)
177{ 183{
178 bfa_trc(pport->bfa, event); 184 bfa_trc(fcport->bfa, event);
179 185
180 switch (event) { 186 switch (event) {
181 case BFA_PPORT_SM_START: 187 case BFA_FCPORT_SM_START:
182 /** 188 /**
183 * Start event after IOC is configured and BFA is started. 189 * Start event after IOC is configured and BFA is started.
184 */ 190 */
185 if (bfa_pport_send_enable(pport)) 191 if (bfa_fcport_send_enable(fcport))
186 bfa_sm_set_state(pport, bfa_pport_sm_enabling); 192 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
187 else 193 else
188 bfa_sm_set_state(pport, bfa_pport_sm_enabling_qwait); 194 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling_qwait);
189 break; 195 break;
190 196
191 case BFA_PPORT_SM_ENABLE: 197 case BFA_FCPORT_SM_ENABLE:
192 /** 198 /**
193 * Port is persistently configured to be in enabled state. Do 199 * Port is persistently configured to be in enabled state. Do
194 * not change state. Port enabling is done when START event is 200 * not change state. Port enabling is done when START event is
@@ -196,389 +202,395 @@ bfa_pport_sm_uninit(struct bfa_pport_s *pport, enum bfa_pport_sm_event event)
196 */ 202 */
197 break; 203 break;
198 204
199 case BFA_PPORT_SM_DISABLE: 205 case BFA_FCPORT_SM_DISABLE:
200 /** 206 /**
201 * If a port is persistently configured to be disabled, the 207 * If a port is persistently configured to be disabled, the
202 * first event will a port disable request. 208 * first event will a port disable request.
203 */ 209 */
204 bfa_sm_set_state(pport, bfa_pport_sm_disabled); 210 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
205 break; 211 break;
206 212
207 case BFA_PPORT_SM_HWFAIL: 213 case BFA_FCPORT_SM_HWFAIL:
208 bfa_sm_set_state(pport, bfa_pport_sm_iocdown); 214 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
209 break; 215 break;
210 216
211 default: 217 default:
212 bfa_sm_fault(pport->bfa, event); 218 bfa_sm_fault(fcport->bfa, event);
213 } 219 }
214} 220}
215 221
216static void 222static void
217bfa_pport_sm_enabling_qwait(struct bfa_pport_s *pport, 223bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport,
218 enum bfa_pport_sm_event event) 224 enum bfa_fcport_sm_event event)
219{ 225{
220 bfa_trc(pport->bfa, event); 226 bfa_trc(fcport->bfa, event);
221 227
222 switch (event) { 228 switch (event) {
223 case BFA_PPORT_SM_QRESUME: 229 case BFA_FCPORT_SM_QRESUME:
224 bfa_sm_set_state(pport, bfa_pport_sm_enabling); 230 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
225 bfa_pport_send_enable(pport); 231 bfa_fcport_send_enable(fcport);
226 break; 232 break;
227 233
228 case BFA_PPORT_SM_STOP: 234 case BFA_FCPORT_SM_STOP:
229 bfa_reqq_wcancel(&pport->reqq_wait); 235 bfa_reqq_wcancel(&fcport->reqq_wait);
230 bfa_sm_set_state(pport, bfa_pport_sm_stopped); 236 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
231 break; 237 break;
232 238
233 case BFA_PPORT_SM_ENABLE: 239 case BFA_FCPORT_SM_ENABLE:
234 /** 240 /**
235 * Already enable is in progress. 241 * Already enable is in progress.
236 */ 242 */
237 break; 243 break;
238 244
239 case BFA_PPORT_SM_DISABLE: 245 case BFA_FCPORT_SM_DISABLE:
240 /** 246 /**
241 * Just send disable request to firmware when room becomes 247 * Just send disable request to firmware when room becomes
242 * available in request queue. 248 * available in request queue.
243 */ 249 */
244 bfa_sm_set_state(pport, bfa_pport_sm_disabled); 250 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
245 bfa_reqq_wcancel(&pport->reqq_wait); 251 bfa_reqq_wcancel(&fcport->reqq_wait);
246 bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, 252 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
247 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); 253 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable");
248 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISABLE); 254 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
249 break; 255 break;
250 256
251 case BFA_PPORT_SM_LINKUP: 257 case BFA_FCPORT_SM_LINKUP:
252 case BFA_PPORT_SM_LINKDOWN: 258 case BFA_FCPORT_SM_LINKDOWN:
253 /** 259 /**
254 * Possible to get link events when doing back-to-back 260 * Possible to get link events when doing back-to-back
255 * enable/disables. 261 * enable/disables.
256 */ 262 */
257 break; 263 break;
258 264
259 case BFA_PPORT_SM_HWFAIL: 265 case BFA_FCPORT_SM_HWFAIL:
260 bfa_reqq_wcancel(&pport->reqq_wait); 266 bfa_reqq_wcancel(&fcport->reqq_wait);
261 bfa_sm_set_state(pport, bfa_pport_sm_iocdown); 267 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
262 break; 268 break;
263 269
264 default: 270 default:
265 bfa_sm_fault(pport->bfa, event); 271 bfa_sm_fault(fcport->bfa, event);
266 } 272 }
267} 273}
268 274
269static void 275static void
270bfa_pport_sm_enabling(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) 276bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport,
277 enum bfa_fcport_sm_event event)
271{ 278{
272 bfa_trc(pport->bfa, event); 279 bfa_trc(fcport->bfa, event);
273 280
274 switch (event) { 281 switch (event) {
275 case BFA_PPORT_SM_FWRSP: 282 case BFA_FCPORT_SM_FWRSP:
276 case BFA_PPORT_SM_LINKDOWN: 283 case BFA_FCPORT_SM_LINKDOWN:
277 bfa_sm_set_state(pport, bfa_pport_sm_linkdown); 284 bfa_sm_set_state(fcport, bfa_fcport_sm_linkdown);
278 break; 285 break;
279 286
280 case BFA_PPORT_SM_LINKUP: 287 case BFA_FCPORT_SM_LINKUP:
281 bfa_pport_update_linkinfo(pport); 288 bfa_fcport_update_linkinfo(fcport);
282 bfa_sm_set_state(pport, bfa_pport_sm_linkup); 289 bfa_sm_set_state(fcport, bfa_fcport_sm_linkup);
283 290
284 bfa_assert(pport->event_cbfn); 291 bfa_assert(fcport->event_cbfn);
285 bfa_pport_callback(pport, BFA_PPORT_LINKUP); 292 bfa_fcport_callback(fcport, BFA_PPORT_LINKUP);
286 break; 293 break;
287 294
288 case BFA_PPORT_SM_ENABLE: 295 case BFA_FCPORT_SM_ENABLE:
289 /** 296 /**
290 * Already being enabled. 297 * Already being enabled.
291 */ 298 */
292 break; 299 break;
293 300
294 case BFA_PPORT_SM_DISABLE: 301 case BFA_FCPORT_SM_DISABLE:
295 if (bfa_pport_send_disable(pport)) 302 if (bfa_fcport_send_disable(fcport))
296 bfa_sm_set_state(pport, bfa_pport_sm_disabling); 303 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
297 else 304 else
298 bfa_sm_set_state(pport, bfa_pport_sm_disabling_qwait); 305 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait);
299 306
300 bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, 307 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
301 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); 308 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable");
302 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISABLE); 309 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
303 break; 310 break;
304 311
305 case BFA_PPORT_SM_STOP: 312 case BFA_FCPORT_SM_STOP:
306 bfa_sm_set_state(pport, bfa_pport_sm_stopped); 313 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
307 break; 314 break;
308 315
309 case BFA_PPORT_SM_HWFAIL: 316 case BFA_FCPORT_SM_HWFAIL:
310 bfa_sm_set_state(pport, bfa_pport_sm_iocdown); 317 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
311 break; 318 break;
312 319
313 default: 320 default:
314 bfa_sm_fault(pport->bfa, event); 321 bfa_sm_fault(fcport->bfa, event);
315 } 322 }
316} 323}
317 324
318static void 325static void
319bfa_pport_sm_linkdown(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) 326bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
327 enum bfa_fcport_sm_event event)
320{ 328{
321 bfa_trc(pport->bfa, event); 329 bfa_trc(fcport->bfa, event);
322 330
323 switch (event) { 331 switch (event) {
324 case BFA_PPORT_SM_LINKUP: 332 case BFA_FCPORT_SM_LINKUP:
325 bfa_pport_update_linkinfo(pport); 333 bfa_fcport_update_linkinfo(fcport);
326 bfa_sm_set_state(pport, bfa_pport_sm_linkup); 334 bfa_sm_set_state(fcport, bfa_fcport_sm_linkup);
327 bfa_assert(pport->event_cbfn); 335 bfa_assert(fcport->event_cbfn);
328 bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, 336 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
329 BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkup"); 337 BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkup");
330 bfa_pport_callback(pport, BFA_PPORT_LINKUP); 338 bfa_fcport_callback(fcport, BFA_PPORT_LINKUP);
331 bfa_pport_aen_post(pport, BFA_PORT_AEN_ONLINE); 339 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ONLINE);
332 /** 340 /**
333 * If QoS is enabled and it is not online, 341 * If QoS is enabled and it is not online,
334 * Send a separate event. 342 * Send a separate event.
335 */ 343 */
336 if ((pport->cfg.qos_enabled) 344 if ((fcport->cfg.qos_enabled)
337 && (bfa_os_ntohl(pport->qos_attr.state) != BFA_QOS_ONLINE)) 345 && (bfa_os_ntohl(fcport->qos_attr.state) != BFA_QOS_ONLINE))
338 bfa_pport_aen_post(pport, BFA_PORT_AEN_QOS_NEG); 346 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_QOS_NEG);
339 347
340 break; 348 break;
341 349
342 case BFA_PPORT_SM_LINKDOWN: 350 case BFA_FCPORT_SM_LINKDOWN:
343 /** 351 /**
344 * Possible to get link down event. 352 * Possible to get link down event.
345 */ 353 */
346 break; 354 break;
347 355
348 case BFA_PPORT_SM_ENABLE: 356 case BFA_FCPORT_SM_ENABLE:
349 /** 357 /**
350 * Already enabled. 358 * Already enabled.
351 */ 359 */
352 break; 360 break;
353 361
354 case BFA_PPORT_SM_DISABLE: 362 case BFA_FCPORT_SM_DISABLE:
355 if (bfa_pport_send_disable(pport)) 363 if (bfa_fcport_send_disable(fcport))
356 bfa_sm_set_state(pport, bfa_pport_sm_disabling); 364 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
357 else 365 else
358 bfa_sm_set_state(pport, bfa_pport_sm_disabling_qwait); 366 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait);
359 367
360 bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, 368 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
361 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); 369 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable");
362 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISABLE); 370 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
363 break; 371 break;
364 372
365 case BFA_PPORT_SM_STOP: 373 case BFA_FCPORT_SM_STOP:
366 bfa_sm_set_state(pport, bfa_pport_sm_stopped); 374 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
367 break; 375 break;
368 376
369 case BFA_PPORT_SM_HWFAIL: 377 case BFA_FCPORT_SM_HWFAIL:
370 bfa_sm_set_state(pport, bfa_pport_sm_iocdown); 378 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
371 break; 379 break;
372 380
373 default: 381 default:
374 bfa_sm_fault(pport->bfa, event); 382 bfa_sm_fault(fcport->bfa, event);
375 } 383 }
376} 384}
377 385
378static void 386static void
379bfa_pport_sm_linkup(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) 387bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
388 enum bfa_fcport_sm_event event)
380{ 389{
381 bfa_trc(pport->bfa, event); 390 bfa_trc(fcport->bfa, event);
382 391
383 switch (event) { 392 switch (event) {
384 case BFA_PPORT_SM_ENABLE: 393 case BFA_FCPORT_SM_ENABLE:
385 /** 394 /**
386 * Already enabled. 395 * Already enabled.
387 */ 396 */
388 break; 397 break;
389 398
390 case BFA_PPORT_SM_DISABLE: 399 case BFA_FCPORT_SM_DISABLE:
391 if (bfa_pport_send_disable(pport)) 400 if (bfa_fcport_send_disable(fcport))
392 bfa_sm_set_state(pport, bfa_pport_sm_disabling); 401 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
393 else 402 else
394 bfa_sm_set_state(pport, bfa_pport_sm_disabling_qwait); 403 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait);
395 404
396 bfa_pport_reset_linkinfo(pport); 405 bfa_fcport_reset_linkinfo(fcport);
397 bfa_pport_callback(pport, BFA_PPORT_LINKDOWN); 406 bfa_fcport_callback(fcport, BFA_PPORT_LINKDOWN);
398 bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, 407 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
399 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); 408 BFA_PL_EID_PORT_DISABLE, 0, "Port Disable");
400 bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); 409 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
401 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISABLE); 410 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
402 break; 411 break;
403 412
404 case BFA_PPORT_SM_LINKDOWN: 413 case BFA_FCPORT_SM_LINKDOWN:
405 bfa_sm_set_state(pport, bfa_pport_sm_linkdown); 414 bfa_sm_set_state(fcport, bfa_fcport_sm_linkdown);
406 bfa_pport_reset_linkinfo(pport); 415 bfa_fcport_reset_linkinfo(fcport);
407 bfa_pport_callback(pport, BFA_PPORT_LINKDOWN); 416 bfa_fcport_callback(fcport, BFA_PPORT_LINKDOWN);
408 bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, 417 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
409 BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown"); 418 BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown");
410 if (BFA_PORT_IS_DISABLED(pport->bfa)) 419 if (BFA_PORT_IS_DISABLED(fcport->bfa))
411 bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); 420 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
412 else 421 else
413 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT); 422 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
414 break; 423 break;
415 424
416 case BFA_PPORT_SM_STOP: 425 case BFA_FCPORT_SM_STOP:
417 bfa_sm_set_state(pport, bfa_pport_sm_stopped); 426 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
418 bfa_pport_reset_linkinfo(pport); 427 bfa_fcport_reset_linkinfo(fcport);
419 if (BFA_PORT_IS_DISABLED(pport->bfa)) 428 if (BFA_PORT_IS_DISABLED(fcport->bfa))
420 bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); 429 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
421 else 430 else
422 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT); 431 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
423 break; 432 break;
424 433
425 case BFA_PPORT_SM_HWFAIL: 434 case BFA_FCPORT_SM_HWFAIL:
426 bfa_sm_set_state(pport, bfa_pport_sm_iocdown); 435 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
427 bfa_pport_reset_linkinfo(pport); 436 bfa_fcport_reset_linkinfo(fcport);
428 bfa_pport_callback(pport, BFA_PPORT_LINKDOWN); 437 bfa_fcport_callback(fcport, BFA_PPORT_LINKDOWN);
429 if (BFA_PORT_IS_DISABLED(pport->bfa)) 438 if (BFA_PORT_IS_DISABLED(fcport->bfa))
430 bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); 439 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
431 else 440 else
432 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT); 441 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
433 break; 442 break;
434 443
435 default: 444 default:
436 bfa_sm_fault(pport->bfa, event); 445 bfa_sm_fault(fcport->bfa, event);
437 } 446 }
438} 447}
439 448
440static void 449static void
441bfa_pport_sm_disabling_qwait(struct bfa_pport_s *pport, 450bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport,
442 enum bfa_pport_sm_event event) 451 enum bfa_fcport_sm_event event)
443{ 452{
444 bfa_trc(pport->bfa, event); 453 bfa_trc(fcport->bfa, event);
445 454
446 switch (event) { 455 switch (event) {
447 case BFA_PPORT_SM_QRESUME: 456 case BFA_FCPORT_SM_QRESUME:
448 bfa_sm_set_state(pport, bfa_pport_sm_disabling); 457 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
449 bfa_pport_send_disable(pport); 458 bfa_fcport_send_disable(fcport);
450 break; 459 break;
451 460
452 case BFA_PPORT_SM_STOP: 461 case BFA_FCPORT_SM_STOP:
453 bfa_sm_set_state(pport, bfa_pport_sm_stopped); 462 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
454 bfa_reqq_wcancel(&pport->reqq_wait); 463 bfa_reqq_wcancel(&fcport->reqq_wait);
455 break; 464 break;
456 465
457 case BFA_PPORT_SM_DISABLE: 466 case BFA_FCPORT_SM_DISABLE:
458 /** 467 /**
459 * Already being disabled. 468 * Already being disabled.
460 */ 469 */
461 break; 470 break;
462 471
463 case BFA_PPORT_SM_LINKUP: 472 case BFA_FCPORT_SM_LINKUP:
464 case BFA_PPORT_SM_LINKDOWN: 473 case BFA_FCPORT_SM_LINKDOWN:
465 /** 474 /**
466 * Possible to get link events when doing back-to-back 475 * Possible to get link events when doing back-to-back
467 * enable/disables. 476 * enable/disables.
468 */ 477 */
469 break; 478 break;
470 479
471 case BFA_PPORT_SM_HWFAIL: 480 case BFA_FCPORT_SM_HWFAIL:
472 bfa_sm_set_state(pport, bfa_pport_sm_iocfail); 481 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
473 bfa_reqq_wcancel(&pport->reqq_wait); 482 bfa_reqq_wcancel(&fcport->reqq_wait);
474 break; 483 break;
475 484
476 default: 485 default:
477 bfa_sm_fault(pport->bfa, event); 486 bfa_sm_fault(fcport->bfa, event);
478 } 487 }
479} 488}
480 489
481static void 490static void
482bfa_pport_sm_disabling(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) 491bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport,
492 enum bfa_fcport_sm_event event)
483{ 493{
484 bfa_trc(pport->bfa, event); 494 bfa_trc(fcport->bfa, event);
485 495
486 switch (event) { 496 switch (event) {
487 case BFA_PPORT_SM_FWRSP: 497 case BFA_FCPORT_SM_FWRSP:
488 bfa_sm_set_state(pport, bfa_pport_sm_disabled); 498 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
489 break; 499 break;
490 500
491 case BFA_PPORT_SM_DISABLE: 501 case BFA_FCPORT_SM_DISABLE:
492 /** 502 /**
493 * Already being disabled. 503 * Already being disabled.
494 */ 504 */
495 break; 505 break;
496 506
497 case BFA_PPORT_SM_ENABLE: 507 case BFA_FCPORT_SM_ENABLE:
498 if (bfa_pport_send_enable(pport)) 508 if (bfa_fcport_send_enable(fcport))
499 bfa_sm_set_state(pport, bfa_pport_sm_enabling); 509 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
500 else 510 else
501 bfa_sm_set_state(pport, bfa_pport_sm_enabling_qwait); 511 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling_qwait);
502 512
503 bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, 513 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
504 BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); 514 BFA_PL_EID_PORT_ENABLE, 0, "Port Enable");
505 bfa_pport_aen_post(pport, BFA_PORT_AEN_ENABLE); 515 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE);
506 break; 516 break;
507 517
508 case BFA_PPORT_SM_STOP: 518 case BFA_FCPORT_SM_STOP:
509 bfa_sm_set_state(pport, bfa_pport_sm_stopped); 519 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
510 break; 520 break;
511 521
512 case BFA_PPORT_SM_LINKUP: 522 case BFA_FCPORT_SM_LINKUP:
513 case BFA_PPORT_SM_LINKDOWN: 523 case BFA_FCPORT_SM_LINKDOWN:
514 /** 524 /**
515 * Possible to get link events when doing back-to-back 525 * Possible to get link events when doing back-to-back
516 * enable/disables. 526 * enable/disables.
517 */ 527 */
518 break; 528 break;
519 529
520 case BFA_PPORT_SM_HWFAIL: 530 case BFA_FCPORT_SM_HWFAIL:
521 bfa_sm_set_state(pport, bfa_pport_sm_iocfail); 531 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
522 break; 532 break;
523 533
524 default: 534 default:
525 bfa_sm_fault(pport->bfa, event); 535 bfa_sm_fault(fcport->bfa, event);
526 } 536 }
527} 537}
528 538
529static void 539static void
530bfa_pport_sm_disabled(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) 540bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport,
541 enum bfa_fcport_sm_event event)
531{ 542{
532 bfa_trc(pport->bfa, event); 543 bfa_trc(fcport->bfa, event);
533 544
534 switch (event) { 545 switch (event) {
535 case BFA_PPORT_SM_START: 546 case BFA_FCPORT_SM_START:
536 /** 547 /**
537 * Ignore start event for a port that is disabled. 548 * Ignore start event for a port that is disabled.
538 */ 549 */
539 break; 550 break;
540 551
541 case BFA_PPORT_SM_STOP: 552 case BFA_FCPORT_SM_STOP:
542 bfa_sm_set_state(pport, bfa_pport_sm_stopped); 553 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
543 break; 554 break;
544 555
545 case BFA_PPORT_SM_ENABLE: 556 case BFA_FCPORT_SM_ENABLE:
546 if (bfa_pport_send_enable(pport)) 557 if (bfa_fcport_send_enable(fcport))
547 bfa_sm_set_state(pport, bfa_pport_sm_enabling); 558 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
548 else 559 else
549 bfa_sm_set_state(pport, bfa_pport_sm_enabling_qwait); 560 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling_qwait);
550 561
551 bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, 562 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
552 BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); 563 BFA_PL_EID_PORT_ENABLE, 0, "Port Enable");
553 bfa_pport_aen_post(pport, BFA_PORT_AEN_ENABLE); 564 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE);
554 break; 565 break;
555 566
556 case BFA_PPORT_SM_DISABLE: 567 case BFA_FCPORT_SM_DISABLE:
557 /** 568 /**
558 * Already disabled. 569 * Already disabled.
559 */ 570 */
560 break; 571 break;
561 572
562 case BFA_PPORT_SM_HWFAIL: 573 case BFA_FCPORT_SM_HWFAIL:
563 bfa_sm_set_state(pport, bfa_pport_sm_iocfail); 574 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
564 break; 575 break;
565 576
566 default: 577 default:
567 bfa_sm_fault(pport->bfa, event); 578 bfa_sm_fault(fcport->bfa, event);
568 } 579 }
569} 580}
570 581
571static void 582static void
572bfa_pport_sm_stopped(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) 583bfa_fcport_sm_stopped(struct bfa_fcport_s *fcport,
584 enum bfa_fcport_sm_event event)
573{ 585{
574 bfa_trc(pport->bfa, event); 586 bfa_trc(fcport->bfa, event);
575 587
576 switch (event) { 588 switch (event) {
577 case BFA_PPORT_SM_START: 589 case BFA_FCPORT_SM_START:
578 if (bfa_pport_send_enable(pport)) 590 if (bfa_fcport_send_enable(fcport))
579 bfa_sm_set_state(pport, bfa_pport_sm_enabling); 591 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
580 else 592 else
581 bfa_sm_set_state(pport, bfa_pport_sm_enabling_qwait); 593 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling_qwait);
582 break; 594 break;
583 595
584 default: 596 default:
@@ -593,16 +605,17 @@ bfa_pport_sm_stopped(struct bfa_pport_s *pport, enum bfa_pport_sm_event event)
593 * Port is enabled. IOC is down/failed. 605 * Port is enabled. IOC is down/failed.
594 */ 606 */
595static void 607static void
596bfa_pport_sm_iocdown(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) 608bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport,
609 enum bfa_fcport_sm_event event)
597{ 610{
598 bfa_trc(pport->bfa, event); 611 bfa_trc(fcport->bfa, event);
599 612
600 switch (event) { 613 switch (event) {
601 case BFA_PPORT_SM_START: 614 case BFA_FCPORT_SM_START:
602 if (bfa_pport_send_enable(pport)) 615 if (bfa_fcport_send_enable(fcport))
603 bfa_sm_set_state(pport, bfa_pport_sm_enabling); 616 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
604 else 617 else
605 bfa_sm_set_state(pport, bfa_pport_sm_enabling_qwait); 618 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling_qwait);
606 break; 619 break;
607 620
608 default: 621 default:
@@ -617,17 +630,18 @@ bfa_pport_sm_iocdown(struct bfa_pport_s *pport, enum bfa_pport_sm_event event)
617 * Port is disabled. IOC is down/failed. 630 * Port is disabled. IOC is down/failed.
618 */ 631 */
619static void 632static void
620bfa_pport_sm_iocfail(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) 633bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport,
634 enum bfa_fcport_sm_event event)
621{ 635{
622 bfa_trc(pport->bfa, event); 636 bfa_trc(fcport->bfa, event);
623 637
624 switch (event) { 638 switch (event) {
625 case BFA_PPORT_SM_START: 639 case BFA_FCPORT_SM_START:
626 bfa_sm_set_state(pport, bfa_pport_sm_disabled); 640 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
627 break; 641 break;
628 642
629 case BFA_PPORT_SM_ENABLE: 643 case BFA_FCPORT_SM_ENABLE:
630 bfa_sm_set_state(pport, bfa_pport_sm_iocdown); 644 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
631 break; 645 break;
632 646
633 default: 647 default:
@@ -642,19 +656,19 @@ bfa_pport_sm_iocfail(struct bfa_pport_s *pport, enum bfa_pport_sm_event event)
642 * Link state is down 656 * Link state is down
643 */ 657 */
644static void 658static void
645bfa_pport_ln_sm_dn(struct bfa_pport_ln_s *ln, 659bfa_fcport_ln_sm_dn(struct bfa_fcport_ln_s *ln,
646 enum bfa_pport_ln_sm_event event) 660 enum bfa_fcport_ln_sm_event event)
647{ 661{
648 bfa_trc(ln->pport->bfa, event); 662 bfa_trc(ln->fcport->bfa, event);
649 663
650 switch (event) { 664 switch (event) {
651 case BFA_PPORT_LN_SM_LINKUP: 665 case BFA_FCPORT_LN_SM_LINKUP:
652 bfa_sm_set_state(ln, bfa_pport_ln_sm_up_nf); 666 bfa_sm_set_state(ln, bfa_fcport_ln_sm_up_nf);
653 bfa_pport_queue_cb(ln, BFA_PPORT_LINKUP); 667 bfa_fcport_queue_cb(ln, BFA_PPORT_LINKUP);
654 break; 668 break;
655 669
656 default: 670 default:
657 bfa_sm_fault(ln->pport->bfa, event); 671 bfa_sm_fault(ln->fcport->bfa, event);
658 } 672 }
659} 673}
660 674
@@ -662,22 +676,22 @@ bfa_pport_ln_sm_dn(struct bfa_pport_ln_s *ln,
662 * Link state is waiting for down notification 676 * Link state is waiting for down notification
663 */ 677 */
664static void 678static void
665bfa_pport_ln_sm_dn_nf(struct bfa_pport_ln_s *ln, 679bfa_fcport_ln_sm_dn_nf(struct bfa_fcport_ln_s *ln,
666 enum bfa_pport_ln_sm_event event) 680 enum bfa_fcport_ln_sm_event event)
667{ 681{
668 bfa_trc(ln->pport->bfa, event); 682 bfa_trc(ln->fcport->bfa, event);
669 683
670 switch (event) { 684 switch (event) {
671 case BFA_PPORT_LN_SM_LINKUP: 685 case BFA_FCPORT_LN_SM_LINKUP:
672 bfa_sm_set_state(ln, bfa_pport_ln_sm_dn_up_nf); 686 bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn_up_nf);
673 break; 687 break;
674 688
675 case BFA_PPORT_LN_SM_NOTIFICATION: 689 case BFA_FCPORT_LN_SM_NOTIFICATION:
676 bfa_sm_set_state(ln, bfa_pport_ln_sm_dn); 690 bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn);
677 break; 691 break;
678 692
679 default: 693 default:
680 bfa_sm_fault(ln->pport->bfa, event); 694 bfa_sm_fault(ln->fcport->bfa, event);
681 } 695 }
682} 696}
683 697
@@ -685,23 +699,23 @@ bfa_pport_ln_sm_dn_nf(struct bfa_pport_ln_s *ln,
685 * Link state is waiting for down notification and there is a pending up 699 * Link state is waiting for down notification and there is a pending up
686 */ 700 */
687static void 701static void
688bfa_pport_ln_sm_dn_up_nf(struct bfa_pport_ln_s *ln, 702bfa_fcport_ln_sm_dn_up_nf(struct bfa_fcport_ln_s *ln,
689 enum bfa_pport_ln_sm_event event) 703 enum bfa_fcport_ln_sm_event event)
690{ 704{
691 bfa_trc(ln->pport->bfa, event); 705 bfa_trc(ln->fcport->bfa, event);
692 706
693 switch (event) { 707 switch (event) {
694 case BFA_PPORT_LN_SM_LINKDOWN: 708 case BFA_FCPORT_LN_SM_LINKDOWN:
695 bfa_sm_set_state(ln, bfa_pport_ln_sm_dn_nf); 709 bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn_nf);
696 break; 710 break;
697 711
698 case BFA_PPORT_LN_SM_NOTIFICATION: 712 case BFA_FCPORT_LN_SM_NOTIFICATION:
699 bfa_sm_set_state(ln, bfa_pport_ln_sm_up_nf); 713 bfa_sm_set_state(ln, bfa_fcport_ln_sm_up_nf);
700 bfa_pport_queue_cb(ln, BFA_PPORT_LINKUP); 714 bfa_fcport_queue_cb(ln, BFA_PPORT_LINKUP);
701 break; 715 break;
702 716
703 default: 717 default:
704 bfa_sm_fault(ln->pport->bfa, event); 718 bfa_sm_fault(ln->fcport->bfa, event);
705 } 719 }
706} 720}
707 721
@@ -709,19 +723,19 @@ bfa_pport_ln_sm_dn_up_nf(struct bfa_pport_ln_s *ln,
709 * Link state is up 723 * Link state is up
710 */ 724 */
711static void 725static void
712bfa_pport_ln_sm_up(struct bfa_pport_ln_s *ln, 726bfa_fcport_ln_sm_up(struct bfa_fcport_ln_s *ln,
713 enum bfa_pport_ln_sm_event event) 727 enum bfa_fcport_ln_sm_event event)
714{ 728{
715 bfa_trc(ln->pport->bfa, event); 729 bfa_trc(ln->fcport->bfa, event);
716 730
717 switch (event) { 731 switch (event) {
718 case BFA_PPORT_LN_SM_LINKDOWN: 732 case BFA_FCPORT_LN_SM_LINKDOWN:
719 bfa_sm_set_state(ln, bfa_pport_ln_sm_dn_nf); 733 bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn_nf);
720 bfa_pport_queue_cb(ln, BFA_PPORT_LINKDOWN); 734 bfa_fcport_queue_cb(ln, BFA_PPORT_LINKDOWN);
721 break; 735 break;
722 736
723 default: 737 default:
724 bfa_sm_fault(ln->pport->bfa, event); 738 bfa_sm_fault(ln->fcport->bfa, event);
725 } 739 }
726} 740}
727 741
@@ -729,22 +743,22 @@ bfa_pport_ln_sm_up(struct bfa_pport_ln_s *ln,
729 * Link state is waiting for up notification 743 * Link state is waiting for up notification
730 */ 744 */
731static void 745static void
732bfa_pport_ln_sm_up_nf(struct bfa_pport_ln_s *ln, 746bfa_fcport_ln_sm_up_nf(struct bfa_fcport_ln_s *ln,
733 enum bfa_pport_ln_sm_event event) 747 enum bfa_fcport_ln_sm_event event)
734{ 748{
735 bfa_trc(ln->pport->bfa, event); 749 bfa_trc(ln->fcport->bfa, event);
736 750
737 switch (event) { 751 switch (event) {
738 case BFA_PPORT_LN_SM_LINKDOWN: 752 case BFA_FCPORT_LN_SM_LINKDOWN:
739 bfa_sm_set_state(ln, bfa_pport_ln_sm_up_dn_nf); 753 bfa_sm_set_state(ln, bfa_fcport_ln_sm_up_dn_nf);
740 break; 754 break;
741 755
742 case BFA_PPORT_LN_SM_NOTIFICATION: 756 case BFA_FCPORT_LN_SM_NOTIFICATION:
743 bfa_sm_set_state(ln, bfa_pport_ln_sm_up); 757 bfa_sm_set_state(ln, bfa_fcport_ln_sm_up);
744 break; 758 break;
745 759
746 default: 760 default:
747 bfa_sm_fault(ln->pport->bfa, event); 761 bfa_sm_fault(ln->fcport->bfa, event);
748 } 762 }
749} 763}
750 764
@@ -752,23 +766,23 @@ bfa_pport_ln_sm_up_nf(struct bfa_pport_ln_s *ln,
752 * Link state is waiting for up notification and there is a pending down 766 * Link state is waiting for up notification and there is a pending down
753 */ 767 */
754static void 768static void
755bfa_pport_ln_sm_up_dn_nf(struct bfa_pport_ln_s *ln, 769bfa_fcport_ln_sm_up_dn_nf(struct bfa_fcport_ln_s *ln,
756 enum bfa_pport_ln_sm_event event) 770 enum bfa_fcport_ln_sm_event event)
757{ 771{
758 bfa_trc(ln->pport->bfa, event); 772 bfa_trc(ln->fcport->bfa, event);
759 773
760 switch (event) { 774 switch (event) {
761 case BFA_PPORT_LN_SM_LINKUP: 775 case BFA_FCPORT_LN_SM_LINKUP:
762 bfa_sm_set_state(ln, bfa_pport_ln_sm_up_dn_up_nf); 776 bfa_sm_set_state(ln, bfa_fcport_ln_sm_up_dn_up_nf);
763 break; 777 break;
764 778
765 case BFA_PPORT_LN_SM_NOTIFICATION: 779 case BFA_FCPORT_LN_SM_NOTIFICATION:
766 bfa_sm_set_state(ln, bfa_pport_ln_sm_dn_nf); 780 bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn_nf);
767 bfa_pport_queue_cb(ln, BFA_PPORT_LINKDOWN); 781 bfa_fcport_queue_cb(ln, BFA_PPORT_LINKDOWN);
768 break; 782 break;
769 783
770 default: 784 default:
771 bfa_sm_fault(ln->pport->bfa, event); 785 bfa_sm_fault(ln->fcport->bfa, event);
772 } 786 }
773} 787}
774 788
@@ -776,23 +790,23 @@ bfa_pport_ln_sm_up_dn_nf(struct bfa_pport_ln_s *ln,
776 * Link state is waiting for up notification and there are pending down and up 790 * Link state is waiting for up notification and there are pending down and up
777 */ 791 */
778static void 792static void
779bfa_pport_ln_sm_up_dn_up_nf(struct bfa_pport_ln_s *ln, 793bfa_fcport_ln_sm_up_dn_up_nf(struct bfa_fcport_ln_s *ln,
780 enum bfa_pport_ln_sm_event event) 794 enum bfa_fcport_ln_sm_event event)
781{ 795{
782 bfa_trc(ln->pport->bfa, event); 796 bfa_trc(ln->fcport->bfa, event);
783 797
784 switch (event) { 798 switch (event) {
785 case BFA_PPORT_LN_SM_LINKDOWN: 799 case BFA_FCPORT_LN_SM_LINKDOWN:
786 bfa_sm_set_state(ln, bfa_pport_ln_sm_up_dn_nf); 800 bfa_sm_set_state(ln, bfa_fcport_ln_sm_up_dn_nf);
787 break; 801 break;
788 802
789 case BFA_PPORT_LN_SM_NOTIFICATION: 803 case BFA_FCPORT_LN_SM_NOTIFICATION:
790 bfa_sm_set_state(ln, bfa_pport_ln_sm_dn_up_nf); 804 bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn_up_nf);
791 bfa_pport_queue_cb(ln, BFA_PPORT_LINKDOWN); 805 bfa_fcport_queue_cb(ln, BFA_PPORT_LINKDOWN);
792 break; 806 break;
793 807
794 default: 808 default:
795 bfa_sm_fault(ln->pport->bfa, event); 809 bfa_sm_fault(ln->fcport->bfa, event);
796 } 810 }
797} 811}
798 812
@@ -801,36 +815,40 @@ bfa_pport_ln_sm_up_dn_up_nf(struct bfa_pport_ln_s *ln,
801 */ 815 */
802 816
803static void 817static void
804__bfa_cb_port_event(void *cbarg, bfa_boolean_t complete) 818__bfa_cb_fcport_event(void *cbarg, bfa_boolean_t complete)
805{ 819{
806 struct bfa_pport_ln_s *ln = cbarg; 820 struct bfa_fcport_ln_s *ln = cbarg;
807 821
808 if (complete) 822 if (complete)
809 ln->pport->event_cbfn(ln->pport->event_cbarg, ln->ln_event); 823 ln->fcport->event_cbfn(ln->fcport->event_cbarg, ln->ln_event);
810 else 824 else
811 bfa_sm_send_event(ln, BFA_PPORT_LN_SM_NOTIFICATION); 825 bfa_sm_send_event(ln, BFA_FCPORT_LN_SM_NOTIFICATION);
812} 826}
813 827
814#define PPORT_STATS_DMA_SZ (BFA_ROUNDUP(sizeof(union bfa_pport_stats_u), \ 828#define PPORT_STATS_DMA_SZ (BFA_ROUNDUP(sizeof(union bfa_fcport_stats_u), \
829 BFA_CACHELINE_SZ))
830
831#define FCPORT_STATS_DMA_SZ (BFA_ROUNDUP(sizeof(union bfa_fcport_stats_u), \
815 BFA_CACHELINE_SZ)) 832 BFA_CACHELINE_SZ))
816 833
817static void 834static void
818bfa_pport_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len, 835bfa_fcport_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len,
819 u32 *dm_len) 836 u32 *dm_len)
820{ 837{
821 *dm_len += PPORT_STATS_DMA_SZ; 838 *dm_len += PPORT_STATS_DMA_SZ;
839 *dm_len += PPORT_STATS_DMA_SZ;
822} 840}
823 841
824static void 842static void
825bfa_pport_qresume(void *cbarg) 843bfa_fcport_qresume(void *cbarg)
826{ 844{
827 struct bfa_pport_s *port = cbarg; 845 struct bfa_fcport_s *port = cbarg;
828 846
829 bfa_sm_send_event(port, BFA_PPORT_SM_QRESUME); 847 bfa_sm_send_event(port, BFA_FCPORT_SM_QRESUME);
830} 848}
831 849
832static void 850static void
833bfa_pport_mem_claim(struct bfa_pport_s *pport, struct bfa_meminfo_s *meminfo) 851bfa_fcport_mem_claim(struct bfa_fcport_s *fcport, struct bfa_meminfo_s *meminfo)
834{ 852{
835 u8 *dm_kva; 853 u8 *dm_kva;
836 u64 dm_pa; 854 u64 dm_pa;
@@ -838,13 +856,22 @@ bfa_pport_mem_claim(struct bfa_pport_s *pport, struct bfa_meminfo_s *meminfo)
838 dm_kva = bfa_meminfo_dma_virt(meminfo); 856 dm_kva = bfa_meminfo_dma_virt(meminfo);
839 dm_pa = bfa_meminfo_dma_phys(meminfo); 857 dm_pa = bfa_meminfo_dma_phys(meminfo);
840 858
841 pport->stats_kva = dm_kva; 859 fcport->stats_kva = dm_kva;
842 pport->stats_pa = dm_pa; 860 fcport->stats_pa = dm_pa;
843 pport->stats = (union bfa_pport_stats_u *)dm_kva; 861 fcport->stats = (union bfa_pport_stats_u *)dm_kva;
844 862
845 dm_kva += PPORT_STATS_DMA_SZ; 863 dm_kva += PPORT_STATS_DMA_SZ;
846 dm_pa += PPORT_STATS_DMA_SZ; 864 dm_pa += PPORT_STATS_DMA_SZ;
847 865
866 /* FC port stats */
867
868 fcport->fcport_stats_kva = dm_kva;
869 fcport->fcport_stats_pa = dm_pa;
870 fcport->fcport_stats = (union bfa_fcport_stats_u *) dm_kva;
871
872 dm_kva += FCPORT_STATS_DMA_SZ;
873 dm_pa += FCPORT_STATS_DMA_SZ;
874
848 bfa_meminfo_dma_virt(meminfo) = dm_kva; 875 bfa_meminfo_dma_virt(meminfo) = dm_kva;
849 bfa_meminfo_dma_phys(meminfo) = dm_pa; 876 bfa_meminfo_dma_phys(meminfo) = dm_pa;
850} 877}
@@ -853,21 +880,21 @@ bfa_pport_mem_claim(struct bfa_pport_s *pport, struct bfa_meminfo_s *meminfo)
853 * Memory initialization. 880 * Memory initialization.
854 */ 881 */
855static void 882static void
856bfa_pport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, 883bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
857 struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev) 884 struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev)
858{ 885{
859 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 886 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
860 struct bfa_pport_cfg_s *port_cfg = &pport->cfg; 887 struct bfa_pport_cfg_s *port_cfg = &fcport->cfg;
861 struct bfa_pport_ln_s *ln = &pport->ln; 888 struct bfa_fcport_ln_s *ln = &fcport->ln;
862 889
863 bfa_os_memset(pport, 0, sizeof(struct bfa_pport_s)); 890 bfa_os_memset(fcport, 0, sizeof(struct bfa_fcport_s));
864 pport->bfa = bfa; 891 fcport->bfa = bfa;
865 ln->pport = pport; 892 ln->fcport = fcport;
866 893
867 bfa_pport_mem_claim(pport, meminfo); 894 bfa_fcport_mem_claim(fcport, meminfo);
868 895
869 bfa_sm_set_state(pport, bfa_pport_sm_uninit); 896 bfa_sm_set_state(fcport, bfa_fcport_sm_uninit);
870 bfa_sm_set_state(ln, bfa_pport_ln_sm_dn); 897 bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn);
871 898
872 /** 899 /**
873 * initialize and set default configuration 900 * initialize and set default configuration
@@ -879,30 +906,30 @@ bfa_pport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
879 906
880 port_cfg->trl_def_speed = BFA_PPORT_SPEED_1GBPS; 907 port_cfg->trl_def_speed = BFA_PPORT_SPEED_1GBPS;
881 908
882 bfa_reqq_winit(&pport->reqq_wait, bfa_pport_qresume, pport); 909 bfa_reqq_winit(&fcport->reqq_wait, bfa_fcport_qresume, fcport);
883} 910}
884 911
885static void 912static void
886bfa_pport_initdone(struct bfa_s *bfa) 913bfa_fcport_initdone(struct bfa_s *bfa)
887{ 914{
888 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 915 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
889 916
890 /** 917 /**
891 * Initialize port attributes from IOC hardware data. 918 * Initialize port attributes from IOC hardware data.
892 */ 919 */
893 bfa_pport_set_wwns(pport); 920 bfa_fcport_set_wwns(fcport);
894 if (pport->cfg.maxfrsize == 0) 921 if (fcport->cfg.maxfrsize == 0)
895 pport->cfg.maxfrsize = bfa_ioc_maxfrsize(&bfa->ioc); 922 fcport->cfg.maxfrsize = bfa_ioc_maxfrsize(&bfa->ioc);
896 pport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc); 923 fcport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc);
897 pport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc); 924 fcport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc);
898 925
899 bfa_assert(pport->cfg.maxfrsize); 926 bfa_assert(fcport->cfg.maxfrsize);
900 bfa_assert(pport->cfg.rx_bbcredit); 927 bfa_assert(fcport->cfg.rx_bbcredit);
901 bfa_assert(pport->speed_sup); 928 bfa_assert(fcport->speed_sup);
902} 929}
903 930
904static void 931static void
905bfa_pport_detach(struct bfa_s *bfa) 932bfa_fcport_detach(struct bfa_s *bfa)
906{ 933{
907} 934}
908 935
@@ -910,62 +937,63 @@ bfa_pport_detach(struct bfa_s *bfa)
910 * Called when IOC is ready. 937 * Called when IOC is ready.
911 */ 938 */
912static void 939static void
913bfa_pport_start(struct bfa_s *bfa) 940bfa_fcport_start(struct bfa_s *bfa)
914{ 941{
915 bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_START); 942 bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_START);
916} 943}
917 944
918/** 945/**
919 * Called before IOC is stopped. 946 * Called before IOC is stopped.
920 */ 947 */
921static void 948static void
922bfa_pport_stop(struct bfa_s *bfa) 949bfa_fcport_stop(struct bfa_s *bfa)
923{ 950{
924 bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_STOP); 951 bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_STOP);
925} 952}
926 953
927/** 954/**
928 * Called when IOC failure is detected. 955 * Called when IOC failure is detected.
929 */ 956 */
930static void 957static void
931bfa_pport_iocdisable(struct bfa_s *bfa) 958bfa_fcport_iocdisable(struct bfa_s *bfa)
932{ 959{
933 bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_HWFAIL); 960 bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_HWFAIL);
934} 961}
935 962
936static void 963static void
937bfa_pport_update_linkinfo(struct bfa_pport_s *pport) 964bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport)
938{ 965{
939 struct bfi_pport_event_s *pevent = pport->event_arg.i2hmsg.event; 966 struct bfi_pport_event_s *pevent = fcport->event_arg.i2hmsg.event;
940 967
941 pport->speed = pevent->link_state.speed; 968 fcport->speed = pevent->link_state.speed;
942 pport->topology = pevent->link_state.topology; 969 fcport->topology = pevent->link_state.topology;
943 970
944 if (pport->topology == BFA_PPORT_TOPOLOGY_LOOP) 971 if (fcport->topology == BFA_PPORT_TOPOLOGY_LOOP)
945 pport->myalpa = pevent->link_state.tl.loop_info.myalpa; 972 fcport->myalpa =
973 pevent->link_state.tl.loop_info.myalpa;
946 974
947 /* 975 /*
948 * QoS Details 976 * QoS Details
949 */ 977 */
950 bfa_os_assign(pport->qos_attr, pevent->link_state.qos_attr); 978 bfa_os_assign(fcport->qos_attr, pevent->link_state.qos_attr);
951 bfa_os_assign(pport->qos_vc_attr, pevent->link_state.qos_vc_attr); 979 bfa_os_assign(fcport->qos_vc_attr, pevent->link_state.qos_vc_attr);
952 980
953 bfa_trc(pport->bfa, pport->speed); 981 bfa_trc(fcport->bfa, fcport->speed);
954 bfa_trc(pport->bfa, pport->topology); 982 bfa_trc(fcport->bfa, fcport->topology);
955} 983}
956 984
957static void 985static void
958bfa_pport_reset_linkinfo(struct bfa_pport_s *pport) 986bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport)
959{ 987{
960 pport->speed = BFA_PPORT_SPEED_UNKNOWN; 988 fcport->speed = BFA_PPORT_SPEED_UNKNOWN;
961 pport->topology = BFA_PPORT_TOPOLOGY_NONE; 989 fcport->topology = BFA_PPORT_TOPOLOGY_NONE;
962} 990}
963 991
964/** 992/**
965 * Send port enable message to firmware. 993 * Send port enable message to firmware.
966 */ 994 */
967static bfa_boolean_t 995static bfa_boolean_t
968bfa_pport_send_enable(struct bfa_pport_s *port) 996bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
969{ 997{
970 struct bfi_pport_enable_req_s *m; 998 struct bfi_pport_enable_req_s *m;
971 999
@@ -973,32 +1001,34 @@ bfa_pport_send_enable(struct bfa_pport_s *port)
973 * Increment message tag before queue check, so that responses to old 1001 * Increment message tag before queue check, so that responses to old
974 * requests are discarded. 1002 * requests are discarded.
975 */ 1003 */
976 port->msgtag++; 1004 fcport->msgtag++;
977 1005
978 /** 1006 /**
979 * check for room in queue to send request now 1007 * check for room in queue to send request now
980 */ 1008 */
981 m = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); 1009 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
982 if (!m) { 1010 if (!m) {
983 bfa_reqq_wait(port->bfa, BFA_REQQ_PORT, &port->reqq_wait); 1011 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1012 &fcport->reqq_wait);
984 return BFA_FALSE; 1013 return BFA_FALSE;
985 } 1014 }
986 1015
987 bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_ENABLE_REQ, 1016 bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_ENABLE_REQ,
988 bfa_lpuid(port->bfa)); 1017 bfa_lpuid(fcport->bfa));
989 m->nwwn = port->nwwn; 1018 m->nwwn = fcport->nwwn;
990 m->pwwn = port->pwwn; 1019 m->pwwn = fcport->pwwn;
991 m->port_cfg = port->cfg; 1020 m->port_cfg = fcport->cfg;
992 m->msgtag = port->msgtag; 1021 m->msgtag = fcport->msgtag;
993 m->port_cfg.maxfrsize = bfa_os_htons(port->cfg.maxfrsize); 1022 m->port_cfg.maxfrsize = bfa_os_htons(fcport->cfg.maxfrsize);
994 bfa_dma_be_addr_set(m->stats_dma_addr, port->stats_pa); 1023 bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa);
995 bfa_trc(port->bfa, m->stats_dma_addr.a32.addr_lo); 1024 bfa_dma_be_addr_set(m->fcport_stats_dma_addr, fcport->fcport_stats_pa);
996 bfa_trc(port->bfa, m->stats_dma_addr.a32.addr_hi); 1025 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo);
1026 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi);
997 1027
998 /** 1028 /**
999 * queue I/O message to firmware 1029 * queue I/O message to firmware
1000 */ 1030 */
1001 bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); 1031 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1002 return BFA_TRUE; 1032 return BFA_TRUE;
1003} 1033}
1004 1034
@@ -1006,7 +1036,7 @@ bfa_pport_send_enable(struct bfa_pport_s *port)
1006 * Send port disable message to firmware. 1036 * Send port disable message to firmware.
1007 */ 1037 */
1008static bfa_boolean_t 1038static bfa_boolean_t
1009bfa_pport_send_disable(struct bfa_pport_s *port) 1039bfa_fcport_send_disable(struct bfa_fcport_s *fcport)
1010{ 1040{
1011 bfi_pport_disable_req_t *m; 1041 bfi_pport_disable_req_t *m;
1012 1042
@@ -1014,63 +1044,64 @@ bfa_pport_send_disable(struct bfa_pport_s *port)
1014 * Increment message tag before queue check, so that responses to old 1044 * Increment message tag before queue check, so that responses to old
1015 * requests are discarded. 1045 * requests are discarded.
1016 */ 1046 */
1017 port->msgtag++; 1047 fcport->msgtag++;
1018 1048
1019 /** 1049 /**
1020 * check for room in queue to send request now 1050 * check for room in queue to send request now
1021 */ 1051 */
1022 m = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); 1052 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1023 if (!m) { 1053 if (!m) {
1024 bfa_reqq_wait(port->bfa, BFA_REQQ_PORT, &port->reqq_wait); 1054 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1055 &fcport->reqq_wait);
1025 return BFA_FALSE; 1056 return BFA_FALSE;
1026 } 1057 }
1027 1058
1028 bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_DISABLE_REQ, 1059 bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_DISABLE_REQ,
1029 bfa_lpuid(port->bfa)); 1060 bfa_lpuid(fcport->bfa));
1030 m->msgtag = port->msgtag; 1061 m->msgtag = fcport->msgtag;
1031 1062
1032 /** 1063 /**
1033 * queue I/O message to firmware 1064 * queue I/O message to firmware
1034 */ 1065 */
1035 bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); 1066 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1036 1067
1037 return BFA_TRUE; 1068 return BFA_TRUE;
1038} 1069}
1039 1070
1040static void 1071static void
1041bfa_pport_set_wwns(struct bfa_pport_s *port) 1072bfa_fcport_set_wwns(struct bfa_fcport_s *fcport)
1042{ 1073{
1043 port->pwwn = bfa_ioc_get_pwwn(&port->bfa->ioc); 1074 fcport->pwwn = bfa_ioc_get_pwwn(&fcport->bfa->ioc);
1044 port->nwwn = bfa_ioc_get_nwwn(&port->bfa->ioc); 1075 fcport->nwwn = bfa_ioc_get_nwwn(&fcport->bfa->ioc);
1045 1076
1046 bfa_trc(port->bfa, port->pwwn); 1077 bfa_trc(fcport->bfa, fcport->pwwn);
1047 bfa_trc(port->bfa, port->nwwn); 1078 bfa_trc(fcport->bfa, fcport->nwwn);
1048} 1079}
1049 1080
1050static void 1081static void
1051bfa_port_send_txcredit(void *port_cbarg) 1082bfa_fcport_send_txcredit(void *port_cbarg)
1052{ 1083{
1053 1084
1054 struct bfa_pport_s *port = port_cbarg; 1085 struct bfa_fcport_s *fcport = port_cbarg;
1055 struct bfi_pport_set_svc_params_req_s *m; 1086 struct bfi_pport_set_svc_params_req_s *m;
1056 1087
1057 /** 1088 /**
1058 * check for room in queue to send request now 1089 * check for room in queue to send request now
1059 */ 1090 */
1060 m = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); 1091 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1061 if (!m) { 1092 if (!m) {
1062 bfa_trc(port->bfa, port->cfg.tx_bbcredit); 1093 bfa_trc(fcport->bfa, fcport->cfg.tx_bbcredit);
1063 return; 1094 return;
1064 } 1095 }
1065 1096
1066 bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_SET_SVC_PARAMS_REQ, 1097 bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_SET_SVC_PARAMS_REQ,
1067 bfa_lpuid(port->bfa)); 1098 bfa_lpuid(fcport->bfa));
1068 m->tx_bbcredit = bfa_os_htons((u16) port->cfg.tx_bbcredit); 1099 m->tx_bbcredit = bfa_os_htons((u16) fcport->cfg.tx_bbcredit);
1069 1100
1070 /** 1101 /**
1071 * queue I/O message to firmware 1102 * queue I/O message to firmware
1072 */ 1103 */
1073 bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); 1104 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1074} 1105}
1075 1106
1076 1107
@@ -1083,32 +1114,32 @@ bfa_port_send_txcredit(void *port_cbarg)
1083 * Firmware message handler. 1114 * Firmware message handler.
1084 */ 1115 */
1085void 1116void
1086bfa_pport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) 1117bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
1087{ 1118{
1088 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1119 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1089 union bfi_pport_i2h_msg_u i2hmsg; 1120 union bfi_pport_i2h_msg_u i2hmsg;
1090 1121
1091 i2hmsg.msg = msg; 1122 i2hmsg.msg = msg;
1092 pport->event_arg.i2hmsg = i2hmsg; 1123 fcport->event_arg.i2hmsg = i2hmsg;
1093 1124
1094 switch (msg->mhdr.msg_id) { 1125 switch (msg->mhdr.msg_id) {
1095 case BFI_PPORT_I2H_ENABLE_RSP: 1126 case BFI_PPORT_I2H_ENABLE_RSP:
1096 if (pport->msgtag == i2hmsg.enable_rsp->msgtag) 1127 if (fcport->msgtag == i2hmsg.enable_rsp->msgtag)
1097 bfa_sm_send_event(pport, BFA_PPORT_SM_FWRSP); 1128 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
1098 break; 1129 break;
1099 1130
1100 case BFI_PPORT_I2H_DISABLE_RSP: 1131 case BFI_PPORT_I2H_DISABLE_RSP:
1101 if (pport->msgtag == i2hmsg.enable_rsp->msgtag) 1132 if (fcport->msgtag == i2hmsg.enable_rsp->msgtag)
1102 bfa_sm_send_event(pport, BFA_PPORT_SM_FWRSP); 1133 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
1103 break; 1134 break;
1104 1135
1105 case BFI_PPORT_I2H_EVENT: 1136 case BFI_PPORT_I2H_EVENT:
1106 switch (i2hmsg.event->link_state.linkstate) { 1137 switch (i2hmsg.event->link_state.linkstate) {
1107 case BFA_PPORT_LINKUP: 1138 case BFA_PPORT_LINKUP:
1108 bfa_sm_send_event(pport, BFA_PPORT_SM_LINKUP); 1139 bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP);
1109 break; 1140 break;
1110 case BFA_PPORT_LINKDOWN: 1141 case BFA_PPORT_LINKDOWN:
1111 bfa_sm_send_event(pport, BFA_PPORT_SM_LINKDOWN); 1142 bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKDOWN);
1112 break; 1143 break;
1113 case BFA_PPORT_TRUNK_LINKDOWN: 1144 case BFA_PPORT_TRUNK_LINKDOWN:
1114 /** todo: event notification */ 1145 /** todo: event notification */
@@ -1121,32 +1152,63 @@ bfa_pport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
1121 /* 1152 /*
1122 * check for timer pop before processing the rsp 1153 * check for timer pop before processing the rsp
1123 */ 1154 */
1124 if (pport->stats_busy == BFA_FALSE 1155 if (fcport->stats_busy == BFA_FALSE
1125 || pport->stats_status == BFA_STATUS_ETIMER) 1156 || fcport->stats_status == BFA_STATUS_ETIMER)
1126 break; 1157 break;
1127 1158
1128 bfa_timer_stop(&pport->timer); 1159 bfa_timer_stop(&fcport->timer);
1129 pport->stats_status = i2hmsg.getstats_rsp->status; 1160 fcport->stats_status = i2hmsg.getstats_rsp->status;
1130 bfa_cb_queue(pport->bfa, &pport->hcb_qe, __bfa_cb_port_stats, 1161 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, __bfa_cb_port_stats,
1131 pport); 1162 fcport);
1132 break; 1163 break;
1133 case BFI_PPORT_I2H_CLEAR_STATS_RSP: 1164 case BFI_PPORT_I2H_CLEAR_STATS_RSP:
1134 case BFI_PPORT_I2H_CLEAR_QOS_STATS_RSP: 1165 case BFI_PPORT_I2H_CLEAR_QOS_STATS_RSP:
1135 /* 1166 /*
1136 * check for timer pop before processing the rsp 1167 * check for timer pop before processing the rsp
1137 */ 1168 */
1138 if (pport->stats_busy == BFA_FALSE 1169 if (fcport->stats_busy == BFA_FALSE
1139 || pport->stats_status == BFA_STATUS_ETIMER) 1170 || fcport->stats_status == BFA_STATUS_ETIMER)
1140 break; 1171 break;
1141 1172
1142 bfa_timer_stop(&pport->timer); 1173 bfa_timer_stop(&fcport->timer);
1143 pport->stats_status = BFA_STATUS_OK; 1174 fcport->stats_status = BFA_STATUS_OK;
1144 bfa_cb_queue(pport->bfa, &pport->hcb_qe, 1175 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe,
1145 __bfa_cb_port_stats_clr, pport); 1176 __bfa_cb_port_stats_clr, fcport);
1177 break;
1178
1179 case BFI_FCPORT_I2H_GET_STATS_RSP:
1180 /*
1181 * check for timer pop before processing the rsp
1182 */
1183 if (fcport->stats_busy == BFA_FALSE ||
1184 fcport->stats_status == BFA_STATUS_ETIMER) {
1185 break;
1186 }
1187
1188 bfa_timer_stop(&fcport->timer);
1189 fcport->stats_status = i2hmsg.getstats_rsp->status;
1190 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe,
1191 __bfa_cb_fcport_stats, fcport);
1192 break;
1193
1194 case BFI_FCPORT_I2H_CLEAR_STATS_RSP:
1195 /*
1196 * check for timer pop before processing the rsp
1197 */
1198 if (fcport->stats_busy == BFA_FALSE ||
1199 fcport->stats_status == BFA_STATUS_ETIMER) {
1200 break;
1201 }
1202
1203 bfa_timer_stop(&fcport->timer);
1204 fcport->stats_status = BFA_STATUS_OK;
1205 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe,
1206 __bfa_cb_fcport_stats_clr, fcport);
1146 break; 1207 break;
1147 1208
1148 default: 1209 default:
1149 bfa_assert(0); 1210 bfa_assert(0);
1211 break;
1150 } 1212 }
1151} 1213}
1152 1214
@@ -1160,35 +1222,35 @@ bfa_pport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
1160 * Registered callback for port events. 1222 * Registered callback for port events.
1161 */ 1223 */
1162void 1224void
1163bfa_pport_event_register(struct bfa_s *bfa, 1225bfa_fcport_event_register(struct bfa_s *bfa,
1164 void (*cbfn) (void *cbarg, bfa_pport_event_t event), 1226 void (*cbfn) (void *cbarg, bfa_pport_event_t event),
1165 void *cbarg) 1227 void *cbarg)
1166{ 1228{
1167 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1229 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1168 1230
1169 pport->event_cbfn = cbfn; 1231 fcport->event_cbfn = cbfn;
1170 pport->event_cbarg = cbarg; 1232 fcport->event_cbarg = cbarg;
1171} 1233}
1172 1234
1173bfa_status_t 1235bfa_status_t
1174bfa_pport_enable(struct bfa_s *bfa) 1236bfa_fcport_enable(struct bfa_s *bfa)
1175{ 1237{
1176 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1238 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1177 1239
1178 if (pport->diag_busy) 1240 if (fcport->diag_busy)
1179 return BFA_STATUS_DIAG_BUSY; 1241 return BFA_STATUS_DIAG_BUSY;
1180 else if (bfa_sm_cmp_state 1242 else if (bfa_sm_cmp_state
1181 (BFA_PORT_MOD(bfa), bfa_pport_sm_disabling_qwait)) 1243 (BFA_FCPORT_MOD(bfa), bfa_fcport_sm_disabling_qwait))
1182 return BFA_STATUS_DEVBUSY; 1244 return BFA_STATUS_DEVBUSY;
1183 1245
1184 bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_ENABLE); 1246 bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_ENABLE);
1185 return BFA_STATUS_OK; 1247 return BFA_STATUS_OK;
1186} 1248}
1187 1249
1188bfa_status_t 1250bfa_status_t
1189bfa_pport_disable(struct bfa_s *bfa) 1251bfa_fcport_disable(struct bfa_s *bfa)
1190{ 1252{
1191 bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_DISABLE); 1253 bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_DISABLE);
1192 return BFA_STATUS_OK; 1254 return BFA_STATUS_OK;
1193} 1255}
1194 1256
@@ -1196,18 +1258,18 @@ bfa_pport_disable(struct bfa_s *bfa)
1196 * Configure port speed. 1258 * Configure port speed.
1197 */ 1259 */
1198bfa_status_t 1260bfa_status_t
1199bfa_pport_cfg_speed(struct bfa_s *bfa, enum bfa_pport_speed speed) 1261bfa_fcport_cfg_speed(struct bfa_s *bfa, enum bfa_pport_speed speed)
1200{ 1262{
1201 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1263 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1202 1264
1203 bfa_trc(bfa, speed); 1265 bfa_trc(bfa, speed);
1204 1266
1205 if ((speed != BFA_PPORT_SPEED_AUTO) && (speed > pport->speed_sup)) { 1267 if ((speed != BFA_PPORT_SPEED_AUTO) && (speed > fcport->speed_sup)) {
1206 bfa_trc(bfa, pport->speed_sup); 1268 bfa_trc(bfa, fcport->speed_sup);
1207 return BFA_STATUS_UNSUPP_SPEED; 1269 return BFA_STATUS_UNSUPP_SPEED;
1208 } 1270 }
1209 1271
1210 pport->cfg.speed = speed; 1272 fcport->cfg.speed = speed;
1211 1273
1212 return BFA_STATUS_OK; 1274 return BFA_STATUS_OK;
1213} 1275}
@@ -1216,23 +1278,23 @@ bfa_pport_cfg_speed(struct bfa_s *bfa, enum bfa_pport_speed speed)
1216 * Get current speed. 1278 * Get current speed.
1217 */ 1279 */
1218enum bfa_pport_speed 1280enum bfa_pport_speed
1219bfa_pport_get_speed(struct bfa_s *bfa) 1281bfa_fcport_get_speed(struct bfa_s *bfa)
1220{ 1282{
1221 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1283 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1222 1284
1223 return port->speed; 1285 return fcport->speed;
1224} 1286}
1225 1287
1226/** 1288/**
1227 * Configure port topology. 1289 * Configure port topology.
1228 */ 1290 */
1229bfa_status_t 1291bfa_status_t
1230bfa_pport_cfg_topology(struct bfa_s *bfa, enum bfa_pport_topology topology) 1292bfa_fcport_cfg_topology(struct bfa_s *bfa, enum bfa_pport_topology topology)
1231{ 1293{
1232 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1294 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1233 1295
1234 bfa_trc(bfa, topology); 1296 bfa_trc(bfa, topology);
1235 bfa_trc(bfa, pport->cfg.topology); 1297 bfa_trc(bfa, fcport->cfg.topology);
1236 1298
1237 switch (topology) { 1299 switch (topology) {
1238 case BFA_PPORT_TOPOLOGY_P2P: 1300 case BFA_PPORT_TOPOLOGY_P2P:
@@ -1244,7 +1306,7 @@ bfa_pport_cfg_topology(struct bfa_s *bfa, enum bfa_pport_topology topology)
1244 return BFA_STATUS_EINVAL; 1306 return BFA_STATUS_EINVAL;
1245 } 1307 }
1246 1308
1247 pport->cfg.topology = topology; 1309 fcport->cfg.topology = topology;
1248 return BFA_STATUS_OK; 1310 return BFA_STATUS_OK;
1249} 1311}
1250 1312
@@ -1252,64 +1314,64 @@ bfa_pport_cfg_topology(struct bfa_s *bfa, enum bfa_pport_topology topology)
1252 * Get current topology. 1314 * Get current topology.
1253 */ 1315 */
1254enum bfa_pport_topology 1316enum bfa_pport_topology
1255bfa_pport_get_topology(struct bfa_s *bfa) 1317bfa_fcport_get_topology(struct bfa_s *bfa)
1256{ 1318{
1257 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1319 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1258 1320
1259 return port->topology; 1321 return fcport->topology;
1260} 1322}
1261 1323
1262bfa_status_t 1324bfa_status_t
1263bfa_pport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa) 1325bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa)
1264{ 1326{
1265 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1327 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1266 1328
1267 bfa_trc(bfa, alpa); 1329 bfa_trc(bfa, alpa);
1268 bfa_trc(bfa, pport->cfg.cfg_hardalpa); 1330 bfa_trc(bfa, fcport->cfg.cfg_hardalpa);
1269 bfa_trc(bfa, pport->cfg.hardalpa); 1331 bfa_trc(bfa, fcport->cfg.hardalpa);
1270 1332
1271 pport->cfg.cfg_hardalpa = BFA_TRUE; 1333 fcport->cfg.cfg_hardalpa = BFA_TRUE;
1272 pport->cfg.hardalpa = alpa; 1334 fcport->cfg.hardalpa = alpa;
1273 1335
1274 return BFA_STATUS_OK; 1336 return BFA_STATUS_OK;
1275} 1337}
1276 1338
1277bfa_status_t 1339bfa_status_t
1278bfa_pport_clr_hardalpa(struct bfa_s *bfa) 1340bfa_fcport_clr_hardalpa(struct bfa_s *bfa)
1279{ 1341{
1280 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1342 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1281 1343
1282 bfa_trc(bfa, pport->cfg.cfg_hardalpa); 1344 bfa_trc(bfa, fcport->cfg.cfg_hardalpa);
1283 bfa_trc(bfa, pport->cfg.hardalpa); 1345 bfa_trc(bfa, fcport->cfg.hardalpa);
1284 1346
1285 pport->cfg.cfg_hardalpa = BFA_FALSE; 1347 fcport->cfg.cfg_hardalpa = BFA_FALSE;
1286 return BFA_STATUS_OK; 1348 return BFA_STATUS_OK;
1287} 1349}
1288 1350
1289bfa_boolean_t 1351bfa_boolean_t
1290bfa_pport_get_hardalpa(struct bfa_s *bfa, u8 *alpa) 1352bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa)
1291{ 1353{
1292 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1354 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1293 1355
1294 *alpa = port->cfg.hardalpa; 1356 *alpa = fcport->cfg.hardalpa;
1295 return port->cfg.cfg_hardalpa; 1357 return fcport->cfg.cfg_hardalpa;
1296} 1358}
1297 1359
1298u8 1360u8
1299bfa_pport_get_myalpa(struct bfa_s *bfa) 1361bfa_fcport_get_myalpa(struct bfa_s *bfa)
1300{ 1362{
1301 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1363 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1302 1364
1303 return port->myalpa; 1365 return fcport->myalpa;
1304} 1366}
1305 1367
1306bfa_status_t 1368bfa_status_t
1307bfa_pport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxfrsize) 1369bfa_fcport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxfrsize)
1308{ 1370{
1309 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1371 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1310 1372
1311 bfa_trc(bfa, maxfrsize); 1373 bfa_trc(bfa, maxfrsize);
1312 bfa_trc(bfa, pport->cfg.maxfrsize); 1374 bfa_trc(bfa, fcport->cfg.maxfrsize);
1313 1375
1314 /* 1376 /*
1315 * with in range 1377 * with in range
@@ -1323,41 +1385,41 @@ bfa_pport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxfrsize)
1323 if ((maxfrsize != FC_MAX_PDUSZ) && (maxfrsize & (maxfrsize - 1))) 1385 if ((maxfrsize != FC_MAX_PDUSZ) && (maxfrsize & (maxfrsize - 1)))
1324 return BFA_STATUS_INVLD_DFSZ; 1386 return BFA_STATUS_INVLD_DFSZ;
1325 1387
1326 pport->cfg.maxfrsize = maxfrsize; 1388 fcport->cfg.maxfrsize = maxfrsize;
1327 return BFA_STATUS_OK; 1389 return BFA_STATUS_OK;
1328} 1390}
1329 1391
1330u16 1392u16
1331bfa_pport_get_maxfrsize(struct bfa_s *bfa) 1393bfa_fcport_get_maxfrsize(struct bfa_s *bfa)
1332{ 1394{
1333 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1395 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1334 1396
1335 return port->cfg.maxfrsize; 1397 return fcport->cfg.maxfrsize;
1336} 1398}
1337 1399
1338u32 1400u32
1339bfa_pport_mypid(struct bfa_s *bfa) 1401bfa_fcport_mypid(struct bfa_s *bfa)
1340{ 1402{
1341 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1403 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1342 1404
1343 return port->mypid; 1405 return fcport->mypid;
1344} 1406}
1345 1407
1346u8 1408u8
1347bfa_pport_get_rx_bbcredit(struct bfa_s *bfa) 1409bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa)
1348{ 1410{
1349 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1411 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1350 1412
1351 return port->cfg.rx_bbcredit; 1413 return fcport->cfg.rx_bbcredit;
1352} 1414}
1353 1415
1354void 1416void
1355bfa_pport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit) 1417bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit)
1356{ 1418{
1357 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1419 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1358 1420
1359 port->cfg.tx_bbcredit = (u8) tx_bbcredit; 1421 fcport->cfg.tx_bbcredit = (u8) tx_bbcredit;
1360 bfa_port_send_txcredit(port); 1422 bfa_fcport_send_txcredit(fcport);
1361} 1423}
1362 1424
1363/** 1425/**
@@ -1365,78 +1427,79 @@ bfa_pport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit)
1365 */ 1427 */
1366 1428
1367wwn_t 1429wwn_t
1368bfa_pport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node) 1430bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node)
1369{ 1431{
1370 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1432 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1371 if (node) 1433 if (node)
1372 return pport->nwwn; 1434 return fcport->nwwn;
1373 else 1435 else
1374 return pport->pwwn; 1436 return fcport->pwwn;
1375} 1437}
1376 1438
1377void 1439void
1378bfa_pport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr) 1440bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr)
1379{ 1441{
1380 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1442 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1381 1443
1382 bfa_os_memset(attr, 0, sizeof(struct bfa_pport_attr_s)); 1444 bfa_os_memset(attr, 0, sizeof(struct bfa_pport_attr_s));
1383 1445
1384 attr->nwwn = pport->nwwn; 1446 attr->nwwn = fcport->nwwn;
1385 attr->pwwn = pport->pwwn; 1447 attr->pwwn = fcport->pwwn;
1386 1448
1387 bfa_os_memcpy(&attr->pport_cfg, &pport->cfg, 1449 bfa_os_memcpy(&attr->pport_cfg, &fcport->cfg,
1388 sizeof(struct bfa_pport_cfg_s)); 1450 sizeof(struct bfa_pport_cfg_s));
1389 /* 1451 /*
1390 * speed attributes 1452 * speed attributes
1391 */ 1453 */
1392 attr->pport_cfg.speed = pport->cfg.speed; 1454 attr->pport_cfg.speed = fcport->cfg.speed;
1393 attr->speed_supported = pport->speed_sup; 1455 attr->speed_supported = fcport->speed_sup;
1394 attr->speed = pport->speed; 1456 attr->speed = fcport->speed;
1395 attr->cos_supported = FC_CLASS_3; 1457 attr->cos_supported = FC_CLASS_3;
1396 1458
1397 /* 1459 /*
1398 * topology attributes 1460 * topology attributes
1399 */ 1461 */
1400 attr->pport_cfg.topology = pport->cfg.topology; 1462 attr->pport_cfg.topology = fcport->cfg.topology;
1401 attr->topology = pport->topology; 1463 attr->topology = fcport->topology;
1402 1464
1403 /* 1465 /*
1404 * beacon attributes 1466 * beacon attributes
1405 */ 1467 */
1406 attr->beacon = pport->beacon; 1468 attr->beacon = fcport->beacon;
1407 attr->link_e2e_beacon = pport->link_e2e_beacon; 1469 attr->link_e2e_beacon = fcport->link_e2e_beacon;
1408 attr->plog_enabled = bfa_plog_get_setting(pport->bfa->plog); 1470 attr->plog_enabled = bfa_plog_get_setting(fcport->bfa->plog);
1409 1471
1410 attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); 1472 attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa);
1411 attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa); 1473 attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa);
1412 attr->port_state = bfa_sm_to_state(hal_pport_sm_table, pport->sm); 1474 attr->port_state = bfa_sm_to_state(hal_pport_sm_table, fcport->sm);
1413 if (bfa_ioc_is_disabled(&pport->bfa->ioc)) 1475 if (bfa_ioc_is_disabled(&fcport->bfa->ioc))
1414 attr->port_state = BFA_PPORT_ST_IOCDIS; 1476 attr->port_state = BFA_PPORT_ST_IOCDIS;
1415 else if (bfa_ioc_fw_mismatch(&pport->bfa->ioc)) 1477 else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc))
1416 attr->port_state = BFA_PPORT_ST_FWMISMATCH; 1478 attr->port_state = BFA_PPORT_ST_FWMISMATCH;
1417} 1479}
1418 1480
1419static void 1481static void
1420bfa_port_stats_query(void *cbarg) 1482bfa_port_stats_query(void *cbarg)
1421{ 1483{
1422 struct bfa_pport_s *port = (struct bfa_pport_s *)cbarg; 1484 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
1423 bfi_pport_get_stats_req_t *msg; 1485 bfi_pport_get_stats_req_t *msg;
1424 1486
1425 msg = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); 1487 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1426 1488
1427 if (!msg) { 1489 if (!msg) {
1428 port->stats_qfull = BFA_TRUE; 1490 fcport->stats_qfull = BFA_TRUE;
1429 bfa_reqq_winit(&port->stats_reqq_wait, bfa_port_stats_query, 1491 bfa_reqq_winit(&fcport->stats_reqq_wait, bfa_port_stats_query,
1430 port); 1492 fcport);
1431 bfa_reqq_wait(port->bfa, BFA_REQQ_PORT, &port->stats_reqq_wait); 1493 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1494 &fcport->stats_reqq_wait);
1432 return; 1495 return;
1433 } 1496 }
1434 port->stats_qfull = BFA_FALSE; 1497 fcport->stats_qfull = BFA_FALSE;
1435 1498
1436 bfa_os_memset(msg, 0, sizeof(bfi_pport_get_stats_req_t)); 1499 bfa_os_memset(msg, 0, sizeof(bfi_pport_get_stats_req_t));
1437 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_GET_STATS_REQ, 1500 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_GET_STATS_REQ,
1438 bfa_lpuid(port->bfa)); 1501 bfa_lpuid(fcport->bfa));
1439 bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); 1502 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1440 1503
1441 return; 1504 return;
1442} 1505}
@@ -1444,65 +1507,111 @@ bfa_port_stats_query(void *cbarg)
1444static void 1507static void
1445bfa_port_stats_clear(void *cbarg) 1508bfa_port_stats_clear(void *cbarg)
1446{ 1509{
1447 struct bfa_pport_s *port = (struct bfa_pport_s *)cbarg; 1510 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
1448 bfi_pport_clear_stats_req_t *msg; 1511 bfi_pport_clear_stats_req_t *msg;
1449 1512
1450 msg = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); 1513 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1451 1514
1452 if (!msg) { 1515 if (!msg) {
1453 port->stats_qfull = BFA_TRUE; 1516 fcport->stats_qfull = BFA_TRUE;
1454 bfa_reqq_winit(&port->stats_reqq_wait, bfa_port_stats_clear, 1517 bfa_reqq_winit(&fcport->stats_reqq_wait, bfa_port_stats_clear,
1455 port); 1518 fcport);
1456 bfa_reqq_wait(port->bfa, BFA_REQQ_PORT, &port->stats_reqq_wait); 1519 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1520 &fcport->stats_reqq_wait);
1457 return; 1521 return;
1458 } 1522 }
1459 port->stats_qfull = BFA_FALSE; 1523 fcport->stats_qfull = BFA_FALSE;
1460 1524
1461 bfa_os_memset(msg, 0, sizeof(bfi_pport_clear_stats_req_t)); 1525 bfa_os_memset(msg, 0, sizeof(bfi_pport_clear_stats_req_t));
1462 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_CLEAR_STATS_REQ, 1526 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_CLEAR_STATS_REQ,
1463 bfa_lpuid(port->bfa)); 1527 bfa_lpuid(fcport->bfa));
1464 bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); 1528 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1465 return; 1529 return;
1466} 1530}
1467 1531
1468static void 1532static void
1533bfa_fcport_stats_query(void *cbarg)
1534{
1535 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1536 bfi_pport_get_stats_req_t *msg;
1537
1538 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1539
1540 if (!msg) {
1541 fcport->stats_qfull = BFA_TRUE;
1542 bfa_reqq_winit(&fcport->stats_reqq_wait,
1543 bfa_fcport_stats_query, fcport);
1544 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1545 &fcport->stats_reqq_wait);
1546 return;
1547 }
1548 fcport->stats_qfull = BFA_FALSE;
1549
1550 bfa_os_memset(msg, 0, sizeof(bfi_pport_get_stats_req_t));
1551 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_FCPORT_H2I_GET_STATS_REQ,
1552 bfa_lpuid(fcport->bfa));
1553 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1554}
1555
1556static void
1557bfa_fcport_stats_clear(void *cbarg)
1558{
1559 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1560 bfi_pport_clear_stats_req_t *msg;
1561
1562 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1563
1564 if (!msg) {
1565 fcport->stats_qfull = BFA_TRUE;
1566 bfa_reqq_winit(&fcport->stats_reqq_wait,
1567 bfa_fcport_stats_clear, fcport);
1568 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1569 &fcport->stats_reqq_wait);
1570 return;
1571 }
1572 fcport->stats_qfull = BFA_FALSE;
1573
1574 bfa_os_memset(msg, 0, sizeof(bfi_pport_clear_stats_req_t));
1575 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_FCPORT_H2I_CLEAR_STATS_REQ,
1576 bfa_lpuid(fcport->bfa));
1577 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1578}
1579
1580static void
1469bfa_port_qos_stats_clear(void *cbarg) 1581bfa_port_qos_stats_clear(void *cbarg)
1470{ 1582{
1471 struct bfa_pport_s *port = (struct bfa_pport_s *)cbarg; 1583 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
1472 bfi_pport_clear_qos_stats_req_t *msg; 1584 bfi_pport_clear_qos_stats_req_t *msg;
1473 1585
1474 msg = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); 1586 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1475 1587
1476 if (!msg) { 1588 if (!msg) {
1477 port->stats_qfull = BFA_TRUE; 1589 fcport->stats_qfull = BFA_TRUE;
1478 bfa_reqq_winit(&port->stats_reqq_wait, bfa_port_qos_stats_clear, 1590 bfa_reqq_winit(&fcport->stats_reqq_wait,
1479 port); 1591 bfa_port_qos_stats_clear, fcport);
1480 bfa_reqq_wait(port->bfa, BFA_REQQ_PORT, &port->stats_reqq_wait); 1592 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1593 &fcport->stats_reqq_wait);
1481 return; 1594 return;
1482 } 1595 }
1483 port->stats_qfull = BFA_FALSE; 1596 fcport->stats_qfull = BFA_FALSE;
1484 1597
1485 bfa_os_memset(msg, 0, sizeof(bfi_pport_clear_qos_stats_req_t)); 1598 bfa_os_memset(msg, 0, sizeof(bfi_pport_clear_qos_stats_req_t));
1486 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_CLEAR_QOS_STATS_REQ, 1599 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_CLEAR_QOS_STATS_REQ,
1487 bfa_lpuid(port->bfa)); 1600 bfa_lpuid(fcport->bfa));
1488 bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); 1601 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1489 return; 1602 return;
1490} 1603}
1491 1604
1492static void 1605static void
1493bfa_pport_stats_swap(union bfa_pport_stats_u *d, union bfa_pport_stats_u *s) 1606bfa_fcport_stats_swap(union bfa_fcport_stats_u *d, union bfa_fcport_stats_u *s)
1494{ 1607{
1495 u32 *dip = (u32 *) d; 1608 u32 *dip = (u32 *) d;
1496 u32 *sip = (u32 *) s; 1609 u32 *sip = (u32 *) s;
1497 int i; 1610 int i;
1498 1611
1499 /* 1612 /* Do 64 bit fields swap first */
1500 * Do 64 bit fields swap first 1613 for (i = 0; i < ((sizeof(union bfa_fcport_stats_u) -
1501 */ 1614 sizeof(struct bfa_qos_stats_s))/sizeof(u32)); i = i + 2) {
1502 for (i = 0;
1503 i <
1504 ((sizeof(union bfa_pport_stats_u) -
1505 sizeof(struct bfa_qos_stats_s)) / sizeof(u32)); i = i + 2) {
1506#ifdef __BIGENDIAN 1615#ifdef __BIGENDIAN
1507 dip[i] = bfa_os_ntohl(sip[i]); 1616 dip[i] = bfa_os_ntohl(sip[i]);
1508 dip[i + 1] = bfa_os_ntohl(sip[i + 1]); 1617 dip[i + 1] = bfa_os_ntohl(sip[i + 1]);
@@ -1512,56 +1621,88 @@ bfa_pport_stats_swap(union bfa_pport_stats_u *d, union bfa_pport_stats_u *s)
1512#endif 1621#endif
1513 } 1622 }
1514 1623
1515 /* 1624 /* Now swap the 32 bit fields */
1516 * Now swap the 32 bit fields 1625 for (; i < (sizeof(union bfa_fcport_stats_u)/sizeof(u32)); ++i)
1517 */ 1626 dip[i] = bfa_os_ntohl(sip[i]);
1518 for (; i < (sizeof(union bfa_pport_stats_u) / sizeof(u32)); ++i) 1627}
1628
1629static void
1630bfa_port_stats_swap(union bfa_pport_stats_u *d, union bfa_pport_stats_u *s)
1631{
1632 u32 *dip = (u32 *) d;
1633 u32 *sip = (u32 *) s;
1634 int i;
1635
1636 /* Do 64 bit fields swap first */
1637 for (i = 0; i < (sizeof(union bfa_pport_stats_u) / sizeof(u32));
1638 i = i + 2) {
1639#ifdef __BIGENDIAN
1519 dip[i] = bfa_os_ntohl(sip[i]); 1640 dip[i] = bfa_os_ntohl(sip[i]);
1641 dip[i + 1] = bfa_os_ntohl(sip[i + 1]);
1642#else
1643 dip[i] = bfa_os_ntohl(sip[i + 1]);
1644 dip[i + 1] = bfa_os_ntohl(sip[i]);
1645#endif
1646 }
1520} 1647}
1521 1648
1522static void 1649static void
1523__bfa_cb_port_stats_clr(void *cbarg, bfa_boolean_t complete) 1650__bfa_cb_port_stats_clr(void *cbarg, bfa_boolean_t complete)
1524{ 1651{
1525 struct bfa_pport_s *port = cbarg; 1652 struct bfa_fcport_s *fcport = cbarg;
1526 1653
1527 if (complete) { 1654 if (complete) {
1528 port->stats_cbfn(port->stats_cbarg, port->stats_status); 1655 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
1529 } else { 1656 } else {
1530 port->stats_busy = BFA_FALSE; 1657 fcport->stats_busy = BFA_FALSE;
1531 port->stats_status = BFA_STATUS_OK; 1658 fcport->stats_status = BFA_STATUS_OK;
1659 }
1660}
1661
1662static void
1663__bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete)
1664{
1665 struct bfa_fcport_s *fcport = cbarg;
1666
1667 if (complete) {
1668 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
1669 } else {
1670 fcport->stats_busy = BFA_FALSE;
1671 fcport->stats_status = BFA_STATUS_OK;
1532 } 1672 }
1533} 1673}
1534 1674
1535static void 1675static void
1536bfa_port_stats_clr_timeout(void *cbarg) 1676bfa_port_stats_clr_timeout(void *cbarg)
1537{ 1677{
1538 struct bfa_pport_s *port = (struct bfa_pport_s *)cbarg; 1678 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
1539 1679
1540 bfa_trc(port->bfa, port->stats_qfull); 1680 bfa_trc(fcport->bfa, fcport->stats_qfull);
1541 1681
1542 if (port->stats_qfull) { 1682 if (fcport->stats_qfull) {
1543 bfa_reqq_wcancel(&port->stats_reqq_wait); 1683 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
1544 port->stats_qfull = BFA_FALSE; 1684 fcport->stats_qfull = BFA_FALSE;
1545 } 1685 }
1546 1686
1547 port->stats_status = BFA_STATUS_ETIMER; 1687 fcport->stats_status = BFA_STATUS_ETIMER;
1548 bfa_cb_queue(port->bfa, &port->hcb_qe, __bfa_cb_port_stats_clr, port); 1688 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe,
1689 __bfa_cb_port_stats_clr, fcport);
1549} 1690}
1550 1691
1551static void 1692static void
1552bfa_pport_callback(struct bfa_pport_s *pport, enum bfa_pport_linkstate event) 1693bfa_fcport_callback(struct bfa_fcport_s *fcport, enum bfa_pport_linkstate event)
1553{ 1694{
1554 if (pport->bfa->fcs) { 1695 if (fcport->bfa->fcs) {
1555 pport->event_cbfn(pport->event_cbarg, event); 1696 fcport->event_cbfn(fcport->event_cbarg, event);
1556 return; 1697 return;
1557 } 1698 }
1558 1699
1559 switch (event) { 1700 switch (event) {
1560 case BFA_PPORT_LINKUP: 1701 case BFA_PPORT_LINKUP:
1561 bfa_sm_send_event(&pport->ln, BFA_PPORT_LN_SM_LINKUP); 1702 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKUP);
1562 break; 1703 break;
1563 case BFA_PPORT_LINKDOWN: 1704 case BFA_PPORT_LINKDOWN:
1564 bfa_sm_send_event(&pport->ln, BFA_PPORT_LN_SM_LINKDOWN); 1705 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN);
1565 break; 1706 break;
1566 default: 1707 default:
1567 bfa_assert(0); 1708 bfa_assert(0);
@@ -1569,41 +1710,92 @@ bfa_pport_callback(struct bfa_pport_s *pport, enum bfa_pport_linkstate event)
1569} 1710}
1570 1711
1571static void 1712static void
1572bfa_pport_queue_cb(struct bfa_pport_ln_s *ln, enum bfa_pport_linkstate event) 1713bfa_fcport_queue_cb(struct bfa_fcport_ln_s *ln, enum bfa_pport_linkstate event)
1573{ 1714{
1574 ln->ln_event = event; 1715 ln->ln_event = event;
1575 bfa_cb_queue(ln->pport->bfa, &ln->ln_qe, __bfa_cb_port_event, ln); 1716 bfa_cb_queue(ln->fcport->bfa, &ln->ln_qe, __bfa_cb_fcport_event, ln);
1717}
1718
1719static void
1720bfa_fcport_stats_clr_timeout(void *cbarg)
1721{
1722 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1723
1724 bfa_trc(fcport->bfa, fcport->stats_qfull);
1725
1726 if (fcport->stats_qfull) {
1727 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
1728 fcport->stats_qfull = BFA_FALSE;
1729 }
1730
1731 fcport->stats_status = BFA_STATUS_ETIMER;
1732 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, __bfa_cb_fcport_stats_clr,
1733 fcport);
1576} 1734}
1577 1735
1578static void 1736static void
1579__bfa_cb_port_stats(void *cbarg, bfa_boolean_t complete) 1737__bfa_cb_port_stats(void *cbarg, bfa_boolean_t complete)
1580{ 1738{
1581 struct bfa_pport_s *port = cbarg; 1739 struct bfa_fcport_s *fcport = cbarg;
1582 1740
1583 if (complete) { 1741 if (complete) {
1584 if (port->stats_status == BFA_STATUS_OK) 1742 if (fcport->stats_status == BFA_STATUS_OK)
1585 bfa_pport_stats_swap(port->stats_ret, port->stats); 1743 bfa_port_stats_swap(fcport->stats_ret, fcport->stats);
1586 port->stats_cbfn(port->stats_cbarg, port->stats_status); 1744 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
1587 } else { 1745 } else {
1588 port->stats_busy = BFA_FALSE; 1746 fcport->stats_busy = BFA_FALSE;
1589 port->stats_status = BFA_STATUS_OK; 1747 fcport->stats_status = BFA_STATUS_OK;
1590 } 1748 }
1591} 1749}
1592 1750
1593static void 1751static void
1594bfa_port_stats_timeout(void *cbarg) 1752bfa_port_stats_timeout(void *cbarg)
1595{ 1753{
1596 struct bfa_pport_s *port = (struct bfa_pport_s *)cbarg; 1754 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
1597 1755
1598 bfa_trc(port->bfa, port->stats_qfull); 1756 bfa_trc(fcport->bfa, fcport->stats_qfull);
1599 1757
1600 if (port->stats_qfull) { 1758 if (fcport->stats_qfull) {
1601 bfa_reqq_wcancel(&port->stats_reqq_wait); 1759 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
1602 port->stats_qfull = BFA_FALSE; 1760 fcport->stats_qfull = BFA_FALSE;
1603 } 1761 }
1604 1762
1605 port->stats_status = BFA_STATUS_ETIMER; 1763 fcport->stats_status = BFA_STATUS_ETIMER;
1606 bfa_cb_queue(port->bfa, &port->hcb_qe, __bfa_cb_port_stats, port); 1764 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, __bfa_cb_port_stats, fcport);
1765}
1766
1767static void
1768__bfa_cb_fcport_stats(void *cbarg, bfa_boolean_t complete)
1769{
1770 struct bfa_fcport_s *fcport = cbarg;
1771
1772 if (complete) {
1773 if (fcport->stats_status == BFA_STATUS_OK) {
1774 bfa_fcport_stats_swap(fcport->fcport_stats_ret,
1775 fcport->fcport_stats);
1776 }
1777 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
1778 } else {
1779 fcport->stats_busy = BFA_FALSE;
1780 fcport->stats_status = BFA_STATUS_OK;
1781 }
1782}
1783
1784static void
1785bfa_fcport_stats_timeout(void *cbarg)
1786{
1787 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1788
1789 bfa_trc(fcport->bfa, fcport->stats_qfull);
1790
1791 if (fcport->stats_qfull) {
1792 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
1793 fcport->stats_qfull = BFA_FALSE;
1794 }
1795
1796 fcport->stats_status = BFA_STATUS_ETIMER;
1797 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, __bfa_cb_fcport_stats,
1798 fcport);
1607} 1799}
1608 1800
1609#define BFA_PORT_STATS_TOV 1000 1801#define BFA_PORT_STATS_TOV 1000
@@ -1615,21 +1807,21 @@ bfa_status_t
1615bfa_pport_get_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats, 1807bfa_pport_get_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats,
1616 bfa_cb_pport_t cbfn, void *cbarg) 1808 bfa_cb_pport_t cbfn, void *cbarg)
1617{ 1809{
1618 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1810 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1619 1811
1620 if (port->stats_busy) { 1812 if (fcport->stats_busy) {
1621 bfa_trc(bfa, port->stats_busy); 1813 bfa_trc(bfa, fcport->stats_busy);
1622 return BFA_STATUS_DEVBUSY; 1814 return BFA_STATUS_DEVBUSY;
1623 } 1815 }
1624 1816
1625 port->stats_busy = BFA_TRUE; 1817 fcport->stats_busy = BFA_TRUE;
1626 port->stats_ret = stats; 1818 fcport->stats_ret = stats;
1627 port->stats_cbfn = cbfn; 1819 fcport->stats_cbfn = cbfn;
1628 port->stats_cbarg = cbarg; 1820 fcport->stats_cbarg = cbarg;
1629 1821
1630 bfa_port_stats_query(port); 1822 bfa_port_stats_query(fcport);
1631 1823
1632 bfa_timer_start(bfa, &port->timer, bfa_port_stats_timeout, port, 1824 bfa_timer_start(bfa, &fcport->timer, bfa_port_stats_timeout, fcport,
1633 BFA_PORT_STATS_TOV); 1825 BFA_PORT_STATS_TOV);
1634 return BFA_STATUS_OK; 1826 return BFA_STATUS_OK;
1635} 1827}
@@ -1637,57 +1829,111 @@ bfa_pport_get_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats,
1637bfa_status_t 1829bfa_status_t
1638bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg) 1830bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1639{ 1831{
1640 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1832 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1833
1834 if (fcport->stats_busy) {
1835 bfa_trc(bfa, fcport->stats_busy);
1836 return BFA_STATUS_DEVBUSY;
1837 }
1838
1839 fcport->stats_busy = BFA_TRUE;
1840 fcport->stats_cbfn = cbfn;
1841 fcport->stats_cbarg = cbarg;
1842
1843 bfa_port_stats_clear(fcport);
1844
1845 bfa_timer_start(bfa, &fcport->timer, bfa_port_stats_clr_timeout,
1846 fcport, BFA_PORT_STATS_TOV);
1847 return BFA_STATUS_OK;
1848}
1849
1850/**
1851 * @brief
1852 * Fetch FCPort statistics.
1853 * Todo TBD: sharing timer,stats_busy and other resources of fcport for now -
1854 * ideally we want to create seperate ones for fcport once bfa_fcport_s is
1855 * decided.
1856 *
1857 */
1858bfa_status_t
1859bfa_fcport_get_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats,
1860 bfa_cb_pport_t cbfn, void *cbarg)
1861{
1862 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1641 1863
1642 if (port->stats_busy) { 1864 if (fcport->stats_busy) {
1643 bfa_trc(bfa, port->stats_busy); 1865 bfa_trc(bfa, fcport->stats_busy);
1644 return BFA_STATUS_DEVBUSY; 1866 return BFA_STATUS_DEVBUSY;
1645 } 1867 }
1646 1868
1647 port->stats_busy = BFA_TRUE; 1869 fcport->stats_busy = BFA_TRUE;
1648 port->stats_cbfn = cbfn; 1870 fcport->fcport_stats_ret = stats;
1649 port->stats_cbarg = cbarg; 1871 fcport->stats_cbfn = cbfn;
1872 fcport->stats_cbarg = cbarg;
1650 1873
1651 bfa_port_stats_clear(port); 1874 bfa_fcport_stats_query(fcport);
1652 1875
1653 bfa_timer_start(bfa, &port->timer, bfa_port_stats_clr_timeout, port, 1876 bfa_timer_start(bfa, &fcport->timer, bfa_fcport_stats_timeout, fcport,
1654 BFA_PORT_STATS_TOV); 1877 BFA_PORT_STATS_TOV);
1878
1879 return BFA_STATUS_OK;
1880}
1881
1882bfa_status_t
1883bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1884{
1885 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1886
1887 if (fcport->stats_busy) {
1888 bfa_trc(bfa, fcport->stats_busy);
1889 return BFA_STATUS_DEVBUSY;
1890 }
1891
1892 fcport->stats_busy = BFA_TRUE;
1893 fcport->stats_cbfn = cbfn;
1894 fcport->stats_cbarg = cbarg;
1895
1896 bfa_fcport_stats_clear(fcport);
1897
1898 bfa_timer_start(bfa, &fcport->timer, bfa_fcport_stats_clr_timeout,
1899 fcport, BFA_PORT_STATS_TOV);
1900
1655 return BFA_STATUS_OK; 1901 return BFA_STATUS_OK;
1656} 1902}
1657 1903
1658bfa_status_t 1904bfa_status_t
1659bfa_pport_trunk_enable(struct bfa_s *bfa, u8 bitmap) 1905bfa_fcport_trunk_enable(struct bfa_s *bfa, u8 bitmap)
1660{ 1906{
1661 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1907 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1662 1908
1663 bfa_trc(bfa, bitmap); 1909 bfa_trc(bfa, bitmap);
1664 bfa_trc(bfa, pport->cfg.trunked); 1910 bfa_trc(bfa, fcport->cfg.trunked);
1665 bfa_trc(bfa, pport->cfg.trunk_ports); 1911 bfa_trc(bfa, fcport->cfg.trunk_ports);
1666 1912
1667 if (!bitmap || (bitmap & (bitmap - 1))) 1913 if (!bitmap || (bitmap & (bitmap - 1)))
1668 return BFA_STATUS_EINVAL; 1914 return BFA_STATUS_EINVAL;
1669 1915
1670 pport->cfg.trunked = BFA_TRUE; 1916 fcport->cfg.trunked = BFA_TRUE;
1671 pport->cfg.trunk_ports = bitmap; 1917 fcport->cfg.trunk_ports = bitmap;
1672 1918
1673 return BFA_STATUS_OK; 1919 return BFA_STATUS_OK;
1674} 1920}
1675 1921
1676void 1922void
1677bfa_pport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr) 1923bfa_fcport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr)
1678{ 1924{
1679 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1925 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1680 1926
1681 qos_attr->state = bfa_os_ntohl(pport->qos_attr.state); 1927 qos_attr->state = bfa_os_ntohl(fcport->qos_attr.state);
1682 qos_attr->total_bb_cr = bfa_os_ntohl(pport->qos_attr.total_bb_cr); 1928 qos_attr->total_bb_cr = bfa_os_ntohl(fcport->qos_attr.total_bb_cr);
1683} 1929}
1684 1930
1685void 1931void
1686bfa_pport_qos_get_vc_attr(struct bfa_s *bfa, 1932bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa,
1687 struct bfa_qos_vc_attr_s *qos_vc_attr) 1933 struct bfa_qos_vc_attr_s *qos_vc_attr)
1688{ 1934{
1689 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1935 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1690 struct bfa_qos_vc_attr_s *bfa_vc_attr = &pport->qos_vc_attr; 1936 struct bfa_qos_vc_attr_s *bfa_vc_attr = &fcport->qos_vc_attr;
1691 u32 i = 0; 1937 u32 i = 0;
1692 1938
1693 qos_vc_attr->total_vc_count = bfa_os_ntohs(bfa_vc_attr->total_vc_count); 1939 qos_vc_attr->total_vc_count = bfa_os_ntohs(bfa_vc_attr->total_vc_count);
@@ -1713,7 +1959,7 @@ bfa_pport_qos_get_vc_attr(struct bfa_s *bfa,
1713 * Fetch QoS Stats. 1959 * Fetch QoS Stats.
1714 */ 1960 */
1715bfa_status_t 1961bfa_status_t
1716bfa_pport_get_qos_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats, 1962bfa_fcport_get_qos_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats,
1717 bfa_cb_pport_t cbfn, void *cbarg) 1963 bfa_cb_pport_t cbfn, void *cbarg)
1718{ 1964{
1719 /* 1965 /*
@@ -1723,23 +1969,23 @@ bfa_pport_get_qos_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats,
1723} 1969}
1724 1970
1725bfa_status_t 1971bfa_status_t
1726bfa_pport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg) 1972bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1727{ 1973{
1728 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1974 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1729 1975
1730 if (port->stats_busy) { 1976 if (fcport->stats_busy) {
1731 bfa_trc(bfa, port->stats_busy); 1977 bfa_trc(bfa, fcport->stats_busy);
1732 return BFA_STATUS_DEVBUSY; 1978 return BFA_STATUS_DEVBUSY;
1733 } 1979 }
1734 1980
1735 port->stats_busy = BFA_TRUE; 1981 fcport->stats_busy = BFA_TRUE;
1736 port->stats_cbfn = cbfn; 1982 fcport->stats_cbfn = cbfn;
1737 port->stats_cbarg = cbarg; 1983 fcport->stats_cbarg = cbarg;
1738 1984
1739 bfa_port_qos_stats_clear(port); 1985 bfa_port_qos_stats_clear(fcport);
1740 1986
1741 bfa_timer_start(bfa, &port->timer, bfa_port_stats_clr_timeout, port, 1987 bfa_timer_start(bfa, &fcport->timer, bfa_port_stats_clr_timeout,
1742 BFA_PORT_STATS_TOV); 1988 fcport, BFA_PORT_STATS_TOV);
1743 return BFA_STATUS_OK; 1989 return BFA_STATUS_OK;
1744} 1990}
1745 1991
@@ -1747,82 +1993,82 @@ bfa_pport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1747 * Fetch port attributes. 1993 * Fetch port attributes.
1748 */ 1994 */
1749bfa_status_t 1995bfa_status_t
1750bfa_pport_trunk_disable(struct bfa_s *bfa) 1996bfa_fcport_trunk_disable(struct bfa_s *bfa)
1751{ 1997{
1752 return BFA_STATUS_OK; 1998 return BFA_STATUS_OK;
1753} 1999}
1754 2000
1755bfa_boolean_t 2001bfa_boolean_t
1756bfa_pport_trunk_query(struct bfa_s *bfa, u32 *bitmap) 2002bfa_fcport_trunk_query(struct bfa_s *bfa, u32 *bitmap)
1757{ 2003{
1758 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 2004 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1759 2005
1760 *bitmap = port->cfg.trunk_ports; 2006 *bitmap = fcport->cfg.trunk_ports;
1761 return port->cfg.trunked; 2007 return fcport->cfg.trunked;
1762} 2008}
1763 2009
1764bfa_boolean_t 2010bfa_boolean_t
1765bfa_pport_is_disabled(struct bfa_s *bfa) 2011bfa_fcport_is_disabled(struct bfa_s *bfa)
1766{ 2012{
1767 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 2013 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1768 2014
1769 return bfa_sm_to_state(hal_pport_sm_table, port->sm) == 2015 return bfa_sm_to_state(hal_pport_sm_table, fcport->sm) ==
1770 BFA_PPORT_ST_DISABLED; 2016 BFA_PPORT_ST_DISABLED;
1771 2017
1772} 2018}
1773 2019
1774bfa_boolean_t 2020bfa_boolean_t
1775bfa_pport_is_ratelim(struct bfa_s *bfa) 2021bfa_fcport_is_ratelim(struct bfa_s *bfa)
1776{ 2022{
1777 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 2023 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1778 2024
1779 return pport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE; 2025 return fcport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE;
1780 2026
1781} 2027}
1782 2028
1783void 2029void
1784bfa_pport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off) 2030bfa_fcport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off)
1785{ 2031{
1786 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 2032 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1787 2033
1788 bfa_trc(bfa, on_off); 2034 bfa_trc(bfa, on_off);
1789 bfa_trc(bfa, pport->cfg.qos_enabled); 2035 bfa_trc(bfa, fcport->cfg.qos_enabled);
1790 2036
1791 pport->cfg.qos_enabled = on_off; 2037 fcport->cfg.qos_enabled = on_off;
1792} 2038}
1793 2039
1794void 2040void
1795bfa_pport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off) 2041bfa_fcport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off)
1796{ 2042{
1797 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 2043 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1798 2044
1799 bfa_trc(bfa, on_off); 2045 bfa_trc(bfa, on_off);
1800 bfa_trc(bfa, pport->cfg.ratelimit); 2046 bfa_trc(bfa, fcport->cfg.ratelimit);
1801 2047
1802 pport->cfg.ratelimit = on_off; 2048 fcport->cfg.ratelimit = on_off;
1803 if (pport->cfg.trl_def_speed == BFA_PPORT_SPEED_UNKNOWN) 2049 if (fcport->cfg.trl_def_speed == BFA_PPORT_SPEED_UNKNOWN)
1804 pport->cfg.trl_def_speed = BFA_PPORT_SPEED_1GBPS; 2050 fcport->cfg.trl_def_speed = BFA_PPORT_SPEED_1GBPS;
1805} 2051}
1806 2052
1807/** 2053/**
1808 * Configure default minimum ratelim speed 2054 * Configure default minimum ratelim speed
1809 */ 2055 */
1810bfa_status_t 2056bfa_status_t
1811bfa_pport_cfg_ratelim_speed(struct bfa_s *bfa, enum bfa_pport_speed speed) 2057bfa_fcport_cfg_ratelim_speed(struct bfa_s *bfa, enum bfa_pport_speed speed)
1812{ 2058{
1813 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 2059 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1814 2060
1815 bfa_trc(bfa, speed); 2061 bfa_trc(bfa, speed);
1816 2062
1817 /* 2063 /*
1818 * Auto and speeds greater than the supported speed, are invalid 2064 * Auto and speeds greater than the supported speed, are invalid
1819 */ 2065 */
1820 if ((speed == BFA_PPORT_SPEED_AUTO) || (speed > pport->speed_sup)) { 2066 if ((speed == BFA_PPORT_SPEED_AUTO) || (speed > fcport->speed_sup)) {
1821 bfa_trc(bfa, pport->speed_sup); 2067 bfa_trc(bfa, fcport->speed_sup);
1822 return BFA_STATUS_UNSUPP_SPEED; 2068 return BFA_STATUS_UNSUPP_SPEED;
1823 } 2069 }
1824 2070
1825 pport->cfg.trl_def_speed = speed; 2071 fcport->cfg.trl_def_speed = speed;
1826 2072
1827 return BFA_STATUS_OK; 2073 return BFA_STATUS_OK;
1828} 2074}
@@ -1831,45 +2077,45 @@ bfa_pport_cfg_ratelim_speed(struct bfa_s *bfa, enum bfa_pport_speed speed)
1831 * Get default minimum ratelim speed 2077 * Get default minimum ratelim speed
1832 */ 2078 */
1833enum bfa_pport_speed 2079enum bfa_pport_speed
1834bfa_pport_get_ratelim_speed(struct bfa_s *bfa) 2080bfa_fcport_get_ratelim_speed(struct bfa_s *bfa)
1835{ 2081{
1836 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 2082 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1837 2083
1838 bfa_trc(bfa, pport->cfg.trl_def_speed); 2084 bfa_trc(bfa, fcport->cfg.trl_def_speed);
1839 return pport->cfg.trl_def_speed; 2085 return fcport->cfg.trl_def_speed;
1840 2086
1841} 2087}
1842 2088
1843void 2089void
1844bfa_pport_busy(struct bfa_s *bfa, bfa_boolean_t status) 2090bfa_fcport_busy(struct bfa_s *bfa, bfa_boolean_t status)
1845{ 2091{
1846 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 2092 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1847 2093
1848 bfa_trc(bfa, status); 2094 bfa_trc(bfa, status);
1849 bfa_trc(bfa, pport->diag_busy); 2095 bfa_trc(bfa, fcport->diag_busy);
1850 2096
1851 pport->diag_busy = status; 2097 fcport->diag_busy = status;
1852} 2098}
1853 2099
1854void 2100void
1855bfa_pport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon, 2101bfa_fcport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon,
1856 bfa_boolean_t link_e2e_beacon) 2102 bfa_boolean_t link_e2e_beacon)
1857{ 2103{
1858 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 2104 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1859 2105
1860 bfa_trc(bfa, beacon); 2106 bfa_trc(bfa, beacon);
1861 bfa_trc(bfa, link_e2e_beacon); 2107 bfa_trc(bfa, link_e2e_beacon);
1862 bfa_trc(bfa, pport->beacon); 2108 bfa_trc(bfa, fcport->beacon);
1863 bfa_trc(bfa, pport->link_e2e_beacon); 2109 bfa_trc(bfa, fcport->link_e2e_beacon);
1864 2110
1865 pport->beacon = beacon; 2111 fcport->beacon = beacon;
1866 pport->link_e2e_beacon = link_e2e_beacon; 2112 fcport->link_e2e_beacon = link_e2e_beacon;
1867} 2113}
1868 2114
1869bfa_boolean_t 2115bfa_boolean_t
1870bfa_pport_is_linkup(struct bfa_s *bfa) 2116bfa_fcport_is_linkup(struct bfa_s *bfa)
1871{ 2117{
1872 return bfa_sm_cmp_state(BFA_PORT_MOD(bfa), bfa_pport_sm_linkup); 2118 return bfa_sm_cmp_state(BFA_FCPORT_MOD(bfa), bfa_fcport_sm_linkup);
1873} 2119}
1874 2120
1875 2121
diff --git a/drivers/scsi/bfa/bfa_fcs_port.c b/drivers/scsi/bfa/bfa_fcs_port.c
index 53808d0418a1..3c27788cd527 100644
--- a/drivers/scsi/bfa/bfa_fcs_port.c
+++ b/drivers/scsi/bfa/bfa_fcs_port.c
@@ -57,5 +57,5 @@ bfa_fcs_pport_event_handler(void *cbarg, bfa_pport_event_t event)
57void 57void
58bfa_fcs_pport_attach(struct bfa_fcs_s *fcs) 58bfa_fcs_pport_attach(struct bfa_fcs_s *fcs)
59{ 59{
60 bfa_pport_event_register(fcs->bfa, bfa_fcs_pport_event_handler, fcs); 60 bfa_fcport_event_register(fcs->bfa, bfa_fcs_pport_event_handler, fcs);
61} 61}
diff --git a/drivers/scsi/bfa/bfa_module.c b/drivers/scsi/bfa/bfa_module.c
index 32eda8e1ec65..a7fcc80c177e 100644
--- a/drivers/scsi/bfa/bfa_module.c
+++ b/drivers/scsi/bfa/bfa_module.c
@@ -24,7 +24,7 @@
24 */ 24 */
25struct bfa_module_s *hal_mods[] = { 25struct bfa_module_s *hal_mods[] = {
26 &hal_mod_sgpg, 26 &hal_mod_sgpg,
27 &hal_mod_pport, 27 &hal_mod_fcport,
28 &hal_mod_fcxp, 28 &hal_mod_fcxp,
29 &hal_mod_lps, 29 &hal_mod_lps,
30 &hal_mod_uf, 30 &hal_mod_uf,
@@ -45,7 +45,7 @@ bfa_isr_func_t bfa_isrs[BFI_MC_MAX] = {
45 bfa_isr_unhandled, /* BFI_MC_DIAG */ 45 bfa_isr_unhandled, /* BFI_MC_DIAG */
46 bfa_isr_unhandled, /* BFI_MC_FLASH */ 46 bfa_isr_unhandled, /* BFI_MC_FLASH */
47 bfa_isr_unhandled, /* BFI_MC_CEE */ 47 bfa_isr_unhandled, /* BFI_MC_CEE */
48 bfa_pport_isr, /* BFI_MC_PORT */ 48 bfa_fcport_isr, /* BFI_MC_FCPORT */
49 bfa_isr_unhandled, /* BFI_MC_IOCFC */ 49 bfa_isr_unhandled, /* BFI_MC_IOCFC */
50 bfa_isr_unhandled, /* BFI_MC_LL */ 50 bfa_isr_unhandled, /* BFI_MC_LL */
51 bfa_uf_isr, /* BFI_MC_UF */ 51 bfa_uf_isr, /* BFI_MC_UF */
diff --git a/drivers/scsi/bfa/bfa_modules_priv.h b/drivers/scsi/bfa/bfa_modules_priv.h
index 96f70534593c..f554c2fad6a9 100644
--- a/drivers/scsi/bfa/bfa_modules_priv.h
+++ b/drivers/scsi/bfa/bfa_modules_priv.h
@@ -29,7 +29,7 @@
29 29
30 30
31struct bfa_modules_s { 31struct bfa_modules_s {
32 struct bfa_pport_s pport; /* physical port module */ 32 struct bfa_fcport_s fcport; /* fc port module */
33 struct bfa_fcxp_mod_s fcxp_mod; /* fcxp module */ 33 struct bfa_fcxp_mod_s fcxp_mod; /* fcxp module */
34 struct bfa_lps_mod_s lps_mod; /* fcxp module */ 34 struct bfa_lps_mod_s lps_mod; /* fcxp module */
35 struct bfa_uf_mod_s uf_mod; /* unsolicited frame module */ 35 struct bfa_uf_mod_s uf_mod; /* unsolicited frame module */
diff --git a/drivers/scsi/bfa/bfa_port_priv.h b/drivers/scsi/bfa/bfa_port_priv.h
index f29701bd2369..6d315ffb1e99 100644
--- a/drivers/scsi/bfa/bfa_port_priv.h
+++ b/drivers/scsi/bfa/bfa_port_priv.h
@@ -25,17 +25,17 @@
25/** 25/**
26 * Link notification data structure 26 * Link notification data structure
27 */ 27 */
28struct bfa_pport_ln_s { 28struct bfa_fcport_ln_s {
29 struct bfa_pport_s *pport; 29 struct bfa_fcport_s *fcport;
30 bfa_sm_t sm; 30 bfa_sm_t sm;
31 struct bfa_cb_qe_s ln_qe; /* BFA callback queue elem for ln */ 31 struct bfa_cb_qe_s ln_qe; /* BFA callback queue elem for ln */
32 enum bfa_pport_linkstate ln_event; /* ln event for callback */ 32 enum bfa_pport_linkstate ln_event; /* ln event for callback */
33}; 33};
34 34
35/** 35/**
36 * BFA physical port data structure 36 * BFA FC port data structure
37 */ 37 */
38struct bfa_pport_s { 38struct bfa_fcport_s {
39 struct bfa_s *bfa; /* parent BFA instance */ 39 struct bfa_s *bfa; /* parent BFA instance */
40 bfa_sm_t sm; /* port state machine */ 40 bfa_sm_t sm; /* port state machine */
41 wwn_t nwwn; /* node wwn of physical port */ 41 wwn_t nwwn; /* node wwn of physical port */
@@ -62,7 +62,7 @@ struct bfa_pport_s {
62 union bfi_pport_i2h_msg_u i2hmsg; 62 union bfi_pport_i2h_msg_u i2hmsg;
63 } event_arg; 63 } event_arg;
64 void *bfad; /* BFA driver handle */ 64 void *bfad; /* BFA driver handle */
65 struct bfa_pport_ln_s ln; /* Link Notification */ 65 struct bfa_fcport_ln_s ln; /* Link Notification */
66 struct bfa_cb_qe_s hcb_qe; /* BFA callback queue elem */ 66 struct bfa_cb_qe_s hcb_qe; /* BFA callback queue elem */
67 u32 msgtag; /* fimrware msg tag for reply */ 67 u32 msgtag; /* fimrware msg tag for reply */
68 u8 *stats_kva; 68 u8 *stats_kva;
@@ -88,12 +88,17 @@ struct bfa_pport_s {
88 /* driver callback function */ 88 /* driver callback function */
89 void *stats_cbarg; 89 void *stats_cbarg;
90 /* *!< user callback arg */ 90 /* *!< user callback arg */
91 /* FCport stats */
92 u8 *fcport_stats_kva;
93 u64 fcport_stats_pa;
94 union bfa_fcport_stats_u *fcport_stats;
95 union bfa_fcport_stats_u *fcport_stats_ret;
91}; 96};
92 97
93#define BFA_PORT_MOD(__bfa) (&(__bfa)->modules.pport) 98#define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport)
94 99
95/* 100/*
96 * public functions 101 * public functions
97 */ 102 */
98void bfa_pport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); 103void bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
99#endif /* __BFA_PORT_PRIV_H__ */ 104#endif /* __BFA_PORT_PRIV_H__ */
diff --git a/drivers/scsi/bfa/bfa_priv.h b/drivers/scsi/bfa/bfa_priv.h
index 0747a6b26f7b..be80fc7e1b0e 100644
--- a/drivers/scsi/bfa/bfa_priv.h
+++ b/drivers/scsi/bfa/bfa_priv.h
@@ -101,7 +101,7 @@ extern bfa_boolean_t bfa_auto_recover;
101extern struct bfa_module_s hal_mod_flash; 101extern struct bfa_module_s hal_mod_flash;
102extern struct bfa_module_s hal_mod_fcdiag; 102extern struct bfa_module_s hal_mod_fcdiag;
103extern struct bfa_module_s hal_mod_sgpg; 103extern struct bfa_module_s hal_mod_sgpg;
104extern struct bfa_module_s hal_mod_pport; 104extern struct bfa_module_s hal_mod_fcport;
105extern struct bfa_module_s hal_mod_fcxp; 105extern struct bfa_module_s hal_mod_fcxp;
106extern struct bfa_module_s hal_mod_lps; 106extern struct bfa_module_s hal_mod_lps;
107extern struct bfa_module_s hal_mod_uf; 107extern struct bfa_module_s hal_mod_uf;
diff --git a/drivers/scsi/bfa/bfa_trcmod_priv.h b/drivers/scsi/bfa/bfa_trcmod_priv.h
index 3d947d47b837..a7a82610db85 100644
--- a/drivers/scsi/bfa/bfa_trcmod_priv.h
+++ b/drivers/scsi/bfa/bfa_trcmod_priv.h
@@ -37,7 +37,7 @@ enum {
37 BFA_TRC_HAL_IOIM = 6, 37 BFA_TRC_HAL_IOIM = 6,
38 BFA_TRC_HAL_TSKIM = 7, 38 BFA_TRC_HAL_TSKIM = 7,
39 BFA_TRC_HAL_ITNIM = 8, 39 BFA_TRC_HAL_ITNIM = 8,
40 BFA_TRC_HAL_PPORT = 9, 40 BFA_TRC_HAL_FCPORT = 9,
41 BFA_TRC_HAL_SGPG = 10, 41 BFA_TRC_HAL_SGPG = 10,
42 BFA_TRC_HAL_FLASH = 11, 42 BFA_TRC_HAL_FLASH = 11,
43 BFA_TRC_HAL_DEBUG = 12, 43 BFA_TRC_HAL_DEBUG = 12,
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 79956c152af9..a8a529d5fea4 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -664,7 +664,7 @@ bfad_fcs_port_cfg(struct bfad_s *bfad)
664 664
665 sprintf(symname, "%s-%d", BFAD_DRIVER_NAME, bfad->inst_no); 665 sprintf(symname, "%s-%d", BFAD_DRIVER_NAME, bfad->inst_no);
666 memcpy(port_cfg.sym_name.symname, symname, strlen(symname)); 666 memcpy(port_cfg.sym_name.symname, symname, strlen(symname));
667 bfa_pport_get_attr(&bfad->bfa, &attr); 667 bfa_fcport_get_attr(&bfad->bfa, &attr);
668 port_cfg.nwwn = attr.nwwn; 668 port_cfg.nwwn = attr.nwwn;
669 port_cfg.pwwn = attr.pwwn; 669 port_cfg.pwwn = attr.pwwn;
670 670
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index adf801dbfa15..a691133c31a2 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -141,7 +141,7 @@ bfad_im_get_host_port_type(struct Scsi_Host *shost)
141 struct bfad_s *bfad = im_port->bfad; 141 struct bfad_s *bfad = im_port->bfad;
142 struct bfa_pport_attr_s attr; 142 struct bfa_pport_attr_s attr;
143 143
144 bfa_pport_get_attr(&bfad->bfa, &attr); 144 bfa_fcport_get_attr(&bfad->bfa, &attr);
145 145
146 switch (attr.port_type) { 146 switch (attr.port_type) {
147 case BFA_PPORT_TYPE_NPORT: 147 case BFA_PPORT_TYPE_NPORT:
@@ -173,7 +173,7 @@ bfad_im_get_host_port_state(struct Scsi_Host *shost)
173 struct bfad_s *bfad = im_port->bfad; 173 struct bfad_s *bfad = im_port->bfad;
174 struct bfa_pport_attr_s attr; 174 struct bfa_pport_attr_s attr;
175 175
176 bfa_pport_get_attr(&bfad->bfa, &attr); 176 bfa_fcport_get_attr(&bfad->bfa, &attr);
177 177
178 switch (attr.port_state) { 178 switch (attr.port_state) {
179 case BFA_PPORT_ST_LINKDOWN: 179 case BFA_PPORT_ST_LINKDOWN:
@@ -232,7 +232,7 @@ bfad_im_get_host_speed(struct Scsi_Host *shost)
232 unsigned long flags; 232 unsigned long flags;
233 233
234 spin_lock_irqsave(shost->host_lock, flags); 234 spin_lock_irqsave(shost->host_lock, flags);
235 bfa_pport_get_attr(&bfad->bfa, &attr); 235 bfa_fcport_get_attr(&bfad->bfa, &attr);
236 switch (attr.speed) { 236 switch (attr.speed) {
237 case BFA_PPORT_SPEED_8GBPS: 237 case BFA_PPORT_SPEED_8GBPS:
238 fc_host_speed(shost) = FC_PORTSPEED_8GBIT; 238 fc_host_speed(shost) = FC_PORTSPEED_8GBIT;
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index f788c2a0ab07..23390b40b9c3 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -966,7 +966,7 @@ bfad_os_fc_host_init(struct bfad_im_port_s *im_port)
966 FC_PORTSPEED_1GBIT; 966 FC_PORTSPEED_1GBIT;
967 967
968 memset(&attr.pattr, 0, sizeof(attr.pattr)); 968 memset(&attr.pattr, 0, sizeof(attr.pattr));
969 bfa_pport_get_attr(&bfad->bfa, &attr.pattr); 969 bfa_fcport_get_attr(&bfad->bfa, &attr.pattr);
970 fc_host_maxframe_size(host) = attr.pattr.pport_cfg.maxfrsize; 970 fc_host_maxframe_size(host) = attr.pattr.pport_cfg.maxfrsize;
971} 971}
972 972
diff --git a/drivers/scsi/bfa/fabric.c b/drivers/scsi/bfa/fabric.c
index b02ed7653eb6..e1a4b312e9d4 100644
--- a/drivers/scsi/bfa/fabric.c
+++ b/drivers/scsi/bfa/fabric.c
@@ -37,7 +37,7 @@ BFA_TRC_FILE(FCS, FABRIC);
37#define BFA_FCS_FABRIC_CLEANUP_DELAY (10000) /* Milliseconds */ 37#define BFA_FCS_FABRIC_CLEANUP_DELAY (10000) /* Milliseconds */
38 38
39#define bfa_fcs_fabric_set_opertype(__fabric) do { \ 39#define bfa_fcs_fabric_set_opertype(__fabric) do { \
40 if (bfa_pport_get_topology((__fabric)->fcs->bfa) \ 40 if (bfa_fcport_get_topology((__fabric)->fcs->bfa) \
41 == BFA_PPORT_TOPOLOGY_P2P) \ 41 == BFA_PPORT_TOPOLOGY_P2P) \
42 (__fabric)->oper_type = BFA_PPORT_TYPE_NPORT; \ 42 (__fabric)->oper_type = BFA_PPORT_TYPE_NPORT; \
43 else \ 43 else \
@@ -160,7 +160,7 @@ bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric,
160 160
161 switch (event) { 161 switch (event) {
162 case BFA_FCS_FABRIC_SM_START: 162 case BFA_FCS_FABRIC_SM_START:
163 if (bfa_pport_is_linkup(fabric->fcs->bfa)) { 163 if (bfa_fcport_is_linkup(fabric->fcs->bfa)) {
164 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi); 164 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi);
165 bfa_fcs_fabric_login(fabric); 165 bfa_fcs_fabric_login(fabric);
166 } else 166 } else
@@ -224,7 +224,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
224 switch (event) { 224 switch (event) {
225 case BFA_FCS_FABRIC_SM_CONT_OP: 225 case BFA_FCS_FABRIC_SM_CONT_OP:
226 226
227 bfa_pport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); 227 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit);
228 fabric->fab_type = BFA_FCS_FABRIC_SWITCHED; 228 fabric->fab_type = BFA_FCS_FABRIC_SWITCHED;
229 229
230 if (fabric->auth_reqd && fabric->is_auth) { 230 if (fabric->auth_reqd && fabric->is_auth) {
@@ -251,7 +251,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
251 251
252 case BFA_FCS_FABRIC_SM_NO_FABRIC: 252 case BFA_FCS_FABRIC_SM_NO_FABRIC:
253 fabric->fab_type = BFA_FCS_FABRIC_N2N; 253 fabric->fab_type = BFA_FCS_FABRIC_N2N;
254 bfa_pport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); 254 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit);
255 bfa_fcs_fabric_notify_online(fabric); 255 bfa_fcs_fabric_notify_online(fabric);
256 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric); 256 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric);
257 break; 257 break;
@@ -418,7 +418,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric,
418 418
419 case BFA_FCS_FABRIC_SM_NO_FABRIC: 419 case BFA_FCS_FABRIC_SM_NO_FABRIC:
420 bfa_trc(fabric->fcs, fabric->bb_credit); 420 bfa_trc(fabric->fcs, fabric->bb_credit);
421 bfa_pport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); 421 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit);
422 break; 422 break;
423 423
424 default: 424 default:
@@ -718,10 +718,10 @@ bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric)
718 struct bfa_port_cfg_s *pcfg = &fabric->bport.port_cfg; 718 struct bfa_port_cfg_s *pcfg = &fabric->bport.port_cfg;
719 u8 alpa = 0; 719 u8 alpa = 0;
720 720
721 if (bfa_pport_get_topology(bfa) == BFA_PPORT_TOPOLOGY_LOOP) 721 if (bfa_fcport_get_topology(bfa) == BFA_PPORT_TOPOLOGY_LOOP)
722 alpa = bfa_pport_get_myalpa(bfa); 722 alpa = bfa_fcport_get_myalpa(bfa);
723 723
724 bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_pport_get_maxfrsize(bfa), 724 bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa),
725 pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd); 725 pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd);
726 726
727 fabric->stats.flogi_sent++; 727 fabric->stats.flogi_sent++;
@@ -1176,8 +1176,8 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
1176 reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), 1176 reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
1177 bfa_os_hton3b(FC_FABRIC_PORT), 1177 bfa_os_hton3b(FC_FABRIC_PORT),
1178 n2n_port->reply_oxid, pcfg->pwwn, 1178 n2n_port->reply_oxid, pcfg->pwwn,
1179 pcfg->nwwn, bfa_pport_get_maxfrsize(bfa), 1179 pcfg->nwwn, bfa_fcport_get_maxfrsize(bfa),
1180 bfa_pport_get_rx_bbcredit(bfa)); 1180 bfa_fcport_get_rx_bbcredit(bfa));
1181 1181
1182 bfa_fcxp_send(fcxp, NULL, fabric->vf_id, bfa_lps_get_tag(fabric->lps), 1182 bfa_fcxp_send(fcxp, NULL, fabric->vf_id, bfa_lps_get_tag(fabric->lps),
1183 BFA_FALSE, FC_CLASS_3, reqlen, &fchs, 1183 BFA_FALSE, FC_CLASS_3, reqlen, &fchs,
diff --git a/drivers/scsi/bfa/fdmi.c b/drivers/scsi/bfa/fdmi.c
index e8120868701b..2c9e7132a368 100644
--- a/drivers/scsi/bfa/fdmi.c
+++ b/drivers/scsi/bfa/fdmi.c
@@ -1175,7 +1175,7 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_port_fdmi_s *fdmi,
1175 /* 1175 /*
1176 * get pport attributes from hal 1176 * get pport attributes from hal
1177 */ 1177 */
1178 bfa_pport_get_attr(port->fcs->bfa, &pport_attr); 1178 bfa_fcport_get_attr(port->fcs->bfa, &pport_attr);
1179 1179
1180 /* 1180 /*
1181 * get FC4 type Bitmask 1181 * get FC4 type Bitmask
diff --git a/drivers/scsi/bfa/include/bfa_svc.h b/drivers/scsi/bfa/include/bfa_svc.h
index 71ffb75a71ca..f2c30858900b 100644
--- a/drivers/scsi/bfa/include/bfa_svc.h
+++ b/drivers/scsi/bfa/include/bfa_svc.h
@@ -26,6 +26,7 @@ struct bfa_fcxp_s;
26#include <defs/bfa_defs_pport.h> 26#include <defs/bfa_defs_pport.h>
27#include <defs/bfa_defs_rport.h> 27#include <defs/bfa_defs_rport.h>
28#include <defs/bfa_defs_qos.h> 28#include <defs/bfa_defs_qos.h>
29#include <defs/bfa_defs_fcport.h>
29#include <cs/bfa_sm.h> 30#include <cs/bfa_sm.h>
30#include <bfa.h> 31#include <bfa.h>
31 32
@@ -151,60 +152,67 @@ struct bfa_lps_s {
151 bfa_eproto_status_t ext_status; 152 bfa_eproto_status_t ext_status;
152}; 153};
153 154
155#define BFA_FCPORT(_bfa) (&((_bfa)->modules.port))
156
154/* 157/*
155 * bfa pport API functions 158 * bfa pport API functions
156 */ 159 */
157bfa_status_t bfa_pport_enable(struct bfa_s *bfa); 160bfa_status_t bfa_fcport_enable(struct bfa_s *bfa);
158bfa_status_t bfa_pport_disable(struct bfa_s *bfa); 161bfa_status_t bfa_fcport_disable(struct bfa_s *bfa);
159bfa_status_t bfa_pport_cfg_speed(struct bfa_s *bfa, 162bfa_status_t bfa_fcport_cfg_speed(struct bfa_s *bfa,
160 enum bfa_pport_speed speed); 163 enum bfa_pport_speed speed);
161enum bfa_pport_speed bfa_pport_get_speed(struct bfa_s *bfa); 164enum bfa_pport_speed bfa_fcport_get_speed(struct bfa_s *bfa);
162bfa_status_t bfa_pport_cfg_topology(struct bfa_s *bfa, 165bfa_status_t bfa_fcport_cfg_topology(struct bfa_s *bfa,
163 enum bfa_pport_topology topo); 166 enum bfa_pport_topology topo);
164enum bfa_pport_topology bfa_pport_get_topology(struct bfa_s *bfa); 167enum bfa_pport_topology bfa_fcport_get_topology(struct bfa_s *bfa);
165bfa_status_t bfa_pport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa); 168bfa_status_t bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa);
166bfa_boolean_t bfa_pport_get_hardalpa(struct bfa_s *bfa, u8 *alpa); 169bfa_boolean_t bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa);
167u8 bfa_pport_get_myalpa(struct bfa_s *bfa); 170u8 bfa_fcport_get_myalpa(struct bfa_s *bfa);
168bfa_status_t bfa_pport_clr_hardalpa(struct bfa_s *bfa); 171bfa_status_t bfa_fcport_clr_hardalpa(struct bfa_s *bfa);
169bfa_status_t bfa_pport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxsize); 172bfa_status_t bfa_fcport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxsize);
170u16 bfa_pport_get_maxfrsize(struct bfa_s *bfa); 173u16 bfa_fcport_get_maxfrsize(struct bfa_s *bfa);
171u32 bfa_pport_mypid(struct bfa_s *bfa); 174u32 bfa_fcport_mypid(struct bfa_s *bfa);
172u8 bfa_pport_get_rx_bbcredit(struct bfa_s *bfa); 175u8 bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa);
173bfa_status_t bfa_pport_trunk_enable(struct bfa_s *bfa, u8 bitmap); 176bfa_status_t bfa_fcport_trunk_enable(struct bfa_s *bfa, u8 bitmap);
174bfa_status_t bfa_pport_trunk_disable(struct bfa_s *bfa); 177bfa_status_t bfa_fcport_trunk_disable(struct bfa_s *bfa);
175bfa_boolean_t bfa_pport_trunk_query(struct bfa_s *bfa, u32 *bitmap); 178bfa_boolean_t bfa_fcport_trunk_query(struct bfa_s *bfa, u32 *bitmap);
176void bfa_pport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr); 179void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr);
177wwn_t bfa_pport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node); 180wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node);
178bfa_status_t bfa_pport_get_stats(struct bfa_s *bfa, 181bfa_status_t bfa_pport_get_stats(struct bfa_s *bfa,
179 union bfa_pport_stats_u *stats, 182 union bfa_pport_stats_u *stats,
180 bfa_cb_pport_t cbfn, void *cbarg); 183 bfa_cb_pport_t cbfn, void *cbarg);
181bfa_status_t bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, 184bfa_status_t bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn,
182 void *cbarg); 185 void *cbarg);
183void bfa_pport_event_register(struct bfa_s *bfa, 186void bfa_fcport_event_register(struct bfa_s *bfa,
184 void (*event_cbfn) (void *cbarg, 187 void (*event_cbfn) (void *cbarg,
185 bfa_pport_event_t event), void *event_cbarg); 188 bfa_pport_event_t event), void *event_cbarg);
186bfa_boolean_t bfa_pport_is_disabled(struct bfa_s *bfa); 189bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa);
187void bfa_pport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off); 190void bfa_fcport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off);
188void bfa_pport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off); 191void bfa_fcport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off);
189bfa_status_t bfa_pport_cfg_ratelim_speed(struct bfa_s *bfa, 192bfa_status_t bfa_fcport_cfg_ratelim_speed(struct bfa_s *bfa,
190 enum bfa_pport_speed speed); 193 enum bfa_pport_speed speed);
191enum bfa_pport_speed bfa_pport_get_ratelim_speed(struct bfa_s *bfa); 194enum bfa_pport_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa);
192 195
193void bfa_pport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit); 196void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit);
194void bfa_pport_busy(struct bfa_s *bfa, bfa_boolean_t status); 197void bfa_fcport_busy(struct bfa_s *bfa, bfa_boolean_t status);
195void bfa_pport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon, 198void bfa_fcport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon,
196 bfa_boolean_t link_e2e_beacon); 199 bfa_boolean_t link_e2e_beacon);
197void bfa_cb_pport_event(void *cbarg, bfa_pport_event_t event); 200void bfa_cb_pport_event(void *cbarg, bfa_pport_event_t event);
198void bfa_pport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr); 201void bfa_fcport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr);
199void bfa_pport_qos_get_vc_attr(struct bfa_s *bfa, 202void bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa,
200 struct bfa_qos_vc_attr_s *qos_vc_attr); 203 struct bfa_qos_vc_attr_s *qos_vc_attr);
201bfa_status_t bfa_pport_get_qos_stats(struct bfa_s *bfa, 204bfa_status_t bfa_fcport_get_qos_stats(struct bfa_s *bfa,
202 union bfa_pport_stats_u *stats, 205 union bfa_pport_stats_u *stats,
203 bfa_cb_pport_t cbfn, void *cbarg); 206 bfa_cb_pport_t cbfn, void *cbarg);
204bfa_status_t bfa_pport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, 207bfa_status_t bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn,
205 void *cbarg); 208 void *cbarg);
206bfa_boolean_t bfa_pport_is_ratelim(struct bfa_s *bfa); 209bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa);
207bfa_boolean_t bfa_pport_is_linkup(struct bfa_s *bfa); 210bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa);
211bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa,
212 union bfa_fcport_stats_u *stats,
213 bfa_cb_pport_t cbfn, void *cbarg);
214bfa_status_t bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn,
215 void *cbarg);
208 216
209/* 217/*
210 * bfa rport API functions 218 * bfa rport API functions
diff --git a/drivers/scsi/bfa/include/bfi/bfi_pport.h b/drivers/scsi/bfa/include/bfi/bfi_pport.h
index c96d246851af..5c3d289d986d 100644
--- a/drivers/scsi/bfa/include/bfi/bfi_pport.h
+++ b/drivers/scsi/bfa/include/bfi/bfi_pport.h
@@ -32,6 +32,8 @@ enum bfi_pport_h2i {
32 BFI_PPORT_H2I_ENABLE_TX_VF_TAG_REQ = (7), 32 BFI_PPORT_H2I_ENABLE_TX_VF_TAG_REQ = (7),
33 BFI_PPORT_H2I_GET_QOS_STATS_REQ = (8), 33 BFI_PPORT_H2I_GET_QOS_STATS_REQ = (8),
34 BFI_PPORT_H2I_CLEAR_QOS_STATS_REQ = (9), 34 BFI_PPORT_H2I_CLEAR_QOS_STATS_REQ = (9),
35 BFI_FCPORT_H2I_GET_STATS_REQ = (10),
36 BFI_FCPORT_H2I_CLEAR_STATS_REQ = (11),
35}; 37};
36 38
37enum bfi_pport_i2h { 39enum bfi_pport_i2h {
@@ -45,6 +47,8 @@ enum bfi_pport_i2h {
45 BFI_PPORT_I2H_EVENT = BFA_I2HM(8), 47 BFI_PPORT_I2H_EVENT = BFA_I2HM(8),
46 BFI_PPORT_I2H_GET_QOS_STATS_RSP = BFA_I2HM(9), 48 BFI_PPORT_I2H_GET_QOS_STATS_RSP = BFA_I2HM(9),
47 BFI_PPORT_I2H_CLEAR_QOS_STATS_RSP = BFA_I2HM(10), 49 BFI_PPORT_I2H_CLEAR_QOS_STATS_RSP = BFA_I2HM(10),
50 BFI_FCPORT_I2H_GET_STATS_RSP = BFA_I2HM(11),
51 BFI_FCPORT_I2H_CLEAR_STATS_RSP = BFA_I2HM(12),
48}; 52};
49 53
50/** 54/**
@@ -75,6 +79,7 @@ struct bfi_pport_enable_req_s {
75 wwn_t pwwn; /* port wwn of physical port */ 79 wwn_t pwwn; /* port wwn of physical port */
76 struct bfa_pport_cfg_s port_cfg; /* port configuration */ 80 struct bfa_pport_cfg_s port_cfg; /* port configuration */
77 union bfi_addr_u stats_dma_addr; /* DMA address for stats */ 81 union bfi_addr_u stats_dma_addr; /* DMA address for stats */
82 union bfi_addr_u fcport_stats_dma_addr;/*!< DMA address for stats */
78 u32 msgtag; /* msgtag for reply */ 83 u32 msgtag; /* msgtag for reply */
79 u32 rsvd2; 84 u32 rsvd2;
80}; 85};
diff --git a/drivers/scsi/bfa/include/cs/bfa_sm.h b/drivers/scsi/bfa/include/cs/bfa_sm.h
index b0a92baf6657..11fba9082f05 100644
--- a/drivers/scsi/bfa/include/cs/bfa_sm.h
+++ b/drivers/scsi/bfa/include/cs/bfa_sm.h
@@ -23,6 +23,14 @@
23#define __BFA_SM_H__ 23#define __BFA_SM_H__
24 24
25typedef void (*bfa_sm_t)(void *sm, int event); 25typedef void (*bfa_sm_t)(void *sm, int event);
26/**
27 * oc - object class eg. bfa_ioc
28 * st - state, eg. reset
29 * otype - object type, eg. struct bfa_ioc_s
30 * etype - object type, eg. enum ioc_event
31 */
32#define bfa_sm_state_decl(oc, st, otype, etype) \
33 static void oc ## _sm_ ## st(otype * fsm, etype event)
26 34
27#define bfa_sm_set_state(_sm, _state) ((_sm)->sm = (bfa_sm_t)(_state)) 35#define bfa_sm_set_state(_sm, _state) ((_sm)->sm = (bfa_sm_t)(_state))
28#define bfa_sm_send_event(_sm, _event) ((_sm)->sm((_sm), (_event))) 36#define bfa_sm_send_event(_sm, _event) ((_sm)->sm((_sm), (_event)))
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_ethport.h b/drivers/scsi/bfa/include/defs/bfa_defs_ethport.h
index 79f9b3e146f7..b4fa0923aa89 100644
--- a/drivers/scsi/bfa/include/defs/bfa_defs_ethport.h
+++ b/drivers/scsi/bfa/include/defs/bfa_defs_ethport.h
@@ -19,6 +19,7 @@
19#define __BFA_DEFS_ETHPORT_H__ 19#define __BFA_DEFS_ETHPORT_H__
20 20
21#include <defs/bfa_defs_status.h> 21#include <defs/bfa_defs_status.h>
22#include <defs/bfa_defs_port.h>
22#include <protocol/types.h> 23#include <protocol/types.h>
23#include <cna/pstats/phyport_defs.h> 24#include <cna/pstats/phyport_defs.h>
24#include <cna/pstats/ethport_defs.h> 25#include <cna/pstats/ethport_defs.h>
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_fcport.h b/drivers/scsi/bfa/include/defs/bfa_defs_fcport.h
new file mode 100644
index 000000000000..a07ef4a3cd78
--- /dev/null
+++ b/drivers/scsi/bfa/include/defs/bfa_defs_fcport.h
@@ -0,0 +1,94 @@
1/*
2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
5 *
6 * bfa_defs_fcport.h
7 *
8 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License (GPL) Version 2 as
12 * published by the Free Software Foundation
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 */
19#ifndef __BFA_DEFS_FCPORT_H__
20#define __BFA_DEFS_FCPORT_H__
21
22#include <defs/bfa_defs_types.h>
23#include <protocol/types.h>
24
25#pragma pack(1)
26
27/**
28 * FCoE statistics
29 */
30struct bfa_fcoe_stats_s {
31 u64 secs_reset; /* Seconds since stats reset */
32 u64 cee_linkups; /* CEE link up */
33 u64 cee_linkdns; /* CEE link down */
34 u64 fip_linkups; /* FIP link up */
35 u64 fip_linkdns; /* FIP link down */
36 u64 fip_fails; /* FIP failures */
37 u64 mac_invalids; /* Invalid mac assignments */
38 u64 vlan_req; /* Vlan requests */
39 u64 vlan_notify; /* Vlan notifications */
40 u64 vlan_err; /* Vlan notification errors */
41 u64 vlan_timeouts; /* Vlan request timeouts */
42 u64 vlan_invalids; /* Vlan invalids */
43 u64 disc_req; /* Discovery requests */
44 u64 disc_rsp; /* Discovery responses */
45 u64 disc_err; /* Discovery error frames */
46 u64 disc_unsol; /* Discovery unsolicited */
47 u64 disc_timeouts; /* Discovery timeouts */
48 u64 disc_fcf_unavail; /* Discovery FCF not avail */
49 u64 linksvc_unsupp; /* FIP link service req unsupp. */
50 u64 linksvc_err; /* FIP link service req errors */
51 u64 logo_req; /* FIP logo */
52 u64 clrvlink_req; /* Clear virtual link requests */
53 u64 op_unsupp; /* FIP operation unsupp. */
54 u64 untagged; /* FIP untagged frames */
55 u64 txf_ucast; /* Tx FCoE unicast frames */
56 u64 txf_ucast_vlan; /* Tx FCoE unicast vlan frames */
57 u64 txf_ucast_octets; /* Tx FCoE unicast octets */
58 u64 txf_mcast; /* Tx FCoE mutlicast frames */
59 u64 txf_mcast_vlan; /* Tx FCoE mutlicast vlan frames */
60 u64 txf_mcast_octets; /* Tx FCoE multicast octets */
61 u64 txf_bcast; /* Tx FCoE broadcast frames */
62 u64 txf_bcast_vlan; /* Tx FCoE broadcast vlan frames */
63 u64 txf_bcast_octets; /* Tx FCoE broadcast octets */
64 u64 txf_timeout; /* Tx timeouts */
65 u64 txf_parity_errors; /* Transmit parity err */
66 u64 txf_fid_parity_errors; /* Transmit FID parity err */
67 u64 tx_pause; /* Tx pause frames */
68 u64 tx_zero_pause; /* Tx zero pause frames */
69 u64 tx_first_pause; /* Tx first pause frames */
70 u64 rx_pause; /* Rx pause frames */
71 u64 rx_zero_pause; /* Rx zero pause frames */
72 u64 rx_first_pause; /* Rx first pause frames */
73 u64 rxf_ucast_octets; /* Rx unicast octets */
74 u64 rxf_ucast; /* Rx unicast frames */
75 u64 rxf_ucast_vlan; /* Rx unicast vlan frames */
76 u64 rxf_mcast_octets; /* Rx multicast octets */
77 u64 rxf_mcast; /* Rx multicast frames */
78 u64 rxf_mcast_vlan; /* Rx multicast vlan frames */
79 u64 rxf_bcast_octets; /* Rx broadcast octests */
80 u64 rxf_bcast; /* Rx broadcast frames */
81 u64 rxf_bcast_vlan; /* Rx broadcast vlan frames */
82};
83
84/**
85 * QoS or FCoE stats (fcport stats excluding physical FC port stats)
86 */
87union bfa_fcport_stats_u {
88 struct bfa_qos_stats_s fcqos;
89 struct bfa_fcoe_stats_s fcoe;
90};
91
92#pragma pack()
93
94#endif /* __BFA_DEFS_FCPORT_H__ */
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_iocfc.h b/drivers/scsi/bfa/include/defs/bfa_defs_iocfc.h
index 87f0401c6439..c290fb13d2d1 100644
--- a/drivers/scsi/bfa/include/defs/bfa_defs_iocfc.h
+++ b/drivers/scsi/bfa/include/defs/bfa_defs_iocfc.h
@@ -236,6 +236,7 @@ struct bfa_fw_fip_stats_s {
236 u32 disc_err; /* Discovery advt. parse errors */ 236 u32 disc_err; /* Discovery advt. parse errors */
237 u32 disc_unsol; /* Discovery unsolicited */ 237 u32 disc_unsol; /* Discovery unsolicited */
238 u32 disc_timeouts; /* Discovery timeouts */ 238 u32 disc_timeouts; /* Discovery timeouts */
239 u32 disc_fcf_unavail; /* Discovery FCF Not Avail. */
239 u32 linksvc_unsupp; /* Unsupported link service req */ 240 u32 linksvc_unsupp; /* Unsupported link service req */
240 u32 linksvc_err; /* Parse error in link service req */ 241 u32 linksvc_err; /* Parse error in link service req */
241 u32 logo_req; /* Number of FIP logos received */ 242 u32 logo_req; /* Number of FIP logos received */
diff --git a/drivers/scsi/bfa/loop.c b/drivers/scsi/bfa/loop.c
index f7c7f4f3c640..f6342efb6a90 100644
--- a/drivers/scsi/bfa/loop.c
+++ b/drivers/scsi/bfa/loop.c
@@ -162,7 +162,7 @@ bfa_fcs_port_loop_send_plogi(struct bfa_fcs_port_s *port, u8 alpa)
162 len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), alpa, 162 len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), alpa,
163 bfa_fcs_port_get_fcid(port), 0, 163 bfa_fcs_port_get_fcid(port), 0,
164 port->port_cfg.pwwn, port->port_cfg.nwwn, 164 port->port_cfg.pwwn, port->port_cfg.nwwn,
165 bfa_pport_get_maxfrsize(port->fcs->bfa)); 165 bfa_fcport_get_maxfrsize(port->fcs->bfa));
166 166
167 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, 167 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
168 FC_CLASS_3, len, &fchs, 168 FC_CLASS_3, len, &fchs,
diff --git a/drivers/scsi/bfa/lport_api.c b/drivers/scsi/bfa/lport_api.c
index 4a4ccce99364..d3907d184e2b 100644
--- a/drivers/scsi/bfa/lport_api.c
+++ b/drivers/scsi/bfa/lport_api.c
@@ -156,7 +156,7 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
156 /* 156 /*
157 * Get Physical port's current speed 157 * Get Physical port's current speed
158 */ 158 */
159 bfa_pport_get_attr(port->fcs->bfa, &pport_attr); 159 bfa_fcport_get_attr(port->fcs->bfa, &pport_attr);
160 pport_speed = pport_attr.speed; 160 pport_speed = pport_attr.speed;
161 bfa_trc(fcs, pport_speed); 161 bfa_trc(fcs, pport_speed);
162 162
diff --git a/drivers/scsi/bfa/ms.c b/drivers/scsi/bfa/ms.c
index f0275a409fd2..e6db5fd301f2 100644
--- a/drivers/scsi/bfa/ms.c
+++ b/drivers/scsi/bfa/ms.c
@@ -637,7 +637,7 @@ bfa_fcs_port_ms_send_plogi(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced)
637 bfa_os_hton3b(FC_MGMT_SERVER), 637 bfa_os_hton3b(FC_MGMT_SERVER),
638 bfa_fcs_port_get_fcid(port), 0, 638 bfa_fcs_port_get_fcid(port), 0,
639 port->port_cfg.pwwn, port->port_cfg.nwwn, 639 port->port_cfg.pwwn, port->port_cfg.nwwn,
640 bfa_pport_get_maxfrsize(port->fcs->bfa)); 640 bfa_fcport_get_maxfrsize(port->fcs->bfa));
641 641
642 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, 642 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
643 FC_CLASS_3, len, &fchs, bfa_fcs_port_ms_plogi_response, 643 FC_CLASS_3, len, &fchs, bfa_fcs_port_ms_plogi_response,
diff --git a/drivers/scsi/bfa/ns.c b/drivers/scsi/bfa/ns.c
index 6de06a557e2d..d20dd7e15742 100644
--- a/drivers/scsi/bfa/ns.c
+++ b/drivers/scsi/bfa/ns.c
@@ -660,7 +660,7 @@ bfa_fcs_port_ns_send_plogi(void *ns_cbarg, struct bfa_fcxp_s *fcxp_alloced)
660 bfa_os_hton3b(FC_NAME_SERVER), 660 bfa_os_hton3b(FC_NAME_SERVER),
661 bfa_fcs_port_get_fcid(port), 0, 661 bfa_fcs_port_get_fcid(port), 0,
662 port->port_cfg.pwwn, port->port_cfg.nwwn, 662 port->port_cfg.pwwn, port->port_cfg.nwwn,
663 bfa_pport_get_maxfrsize(port->fcs->bfa)); 663 bfa_fcport_get_maxfrsize(port->fcs->bfa));
664 664
665 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, 665 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
666 FC_CLASS_3, len, &fchs, bfa_fcs_port_ns_plogi_response, 666 FC_CLASS_3, len, &fchs, bfa_fcs_port_ns_plogi_response,
diff --git a/drivers/scsi/bfa/rport.c b/drivers/scsi/bfa/rport.c
index 80592e352226..8c5969c86934 100644
--- a/drivers/scsi/bfa/rport.c
+++ b/drivers/scsi/bfa/rport.c
@@ -1373,7 +1373,7 @@ bfa_fcs_rport_send_plogi(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced)
1373 len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid, 1373 len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid,
1374 bfa_fcs_port_get_fcid(port), 0, 1374 bfa_fcs_port_get_fcid(port), 0,
1375 port->port_cfg.pwwn, port->port_cfg.nwwn, 1375 port->port_cfg.pwwn, port->port_cfg.nwwn,
1376 bfa_pport_get_maxfrsize(port->fcs->bfa)); 1376 bfa_fcport_get_maxfrsize(port->fcs->bfa));
1377 1377
1378 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, 1378 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
1379 FC_CLASS_3, len, &fchs, bfa_fcs_rport_plogi_response, 1379 FC_CLASS_3, len, &fchs, bfa_fcs_rport_plogi_response,
@@ -1485,7 +1485,7 @@ bfa_fcs_rport_send_plogiacc(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced)
1485 len = fc_plogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid, 1485 len = fc_plogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid,
1486 bfa_fcs_port_get_fcid(port), rport->reply_oxid, 1486 bfa_fcs_port_get_fcid(port), rport->reply_oxid,
1487 port->port_cfg.pwwn, port->port_cfg.nwwn, 1487 port->port_cfg.pwwn, port->port_cfg.nwwn,
1488 bfa_pport_get_maxfrsize(port->fcs->bfa)); 1488 bfa_fcport_get_maxfrsize(port->fcs->bfa));
1489 1489
1490 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, 1490 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
1491 FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0); 1491 FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0);
@@ -1820,7 +1820,7 @@ bfa_fcs_rport_process_rpsc(struct bfa_fcs_rport_s *rport,
1820 /* 1820 /*
1821 * get curent speed from pport attributes from BFA 1821 * get curent speed from pport attributes from BFA
1822 */ 1822 */
1823 bfa_pport_get_attr(port->fcs->bfa, &pport_attr); 1823 bfa_fcport_get_attr(port->fcs->bfa, &pport_attr);
1824 1824
1825 speeds.port_op_speed = fc_bfa_speed_to_rpsc_operspeed(pport_attr.speed); 1825 speeds.port_op_speed = fc_bfa_speed_to_rpsc_operspeed(pport_attr.speed);
1826 1826
@@ -2171,7 +2171,7 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi)
2171 bfa_trc(port->fcs, port->fabric->bb_credit); 2171 bfa_trc(port->fcs, port->fabric->bb_credit);
2172 2172
2173 port->fabric->bb_credit = bfa_os_ntohs(plogi->csp.bbcred); 2173 port->fabric->bb_credit = bfa_os_ntohs(plogi->csp.bbcred);
2174 bfa_pport_set_tx_bbcredit(port->fcs->bfa, 2174 bfa_fcport_set_tx_bbcredit(port->fcs->bfa,
2175 port->fabric->bb_credit); 2175 port->fabric->bb_credit);
2176 } 2176 }
2177 2177
diff --git a/drivers/scsi/bfa/rport_api.c b/drivers/scsi/bfa/rport_api.c
index 3dae1774181e..a441f41d2a64 100644
--- a/drivers/scsi/bfa/rport_api.c
+++ b/drivers/scsi/bfa/rport_api.c
@@ -102,7 +102,7 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
102 rport_attr->qos_attr = qos_attr; 102 rport_attr->qos_attr = qos_attr;
103 103
104 rport_attr->trl_enforced = BFA_FALSE; 104 rport_attr->trl_enforced = BFA_FALSE;
105 if (bfa_pport_is_ratelim(port->fcs->bfa)) { 105 if (bfa_fcport_is_ratelim(port->fcs->bfa)) {
106 if ((rport->rpf.rpsc_speed == BFA_PPORT_SPEED_UNKNOWN) || 106 if ((rport->rpf.rpsc_speed == BFA_PPORT_SPEED_UNKNOWN) ||
107 (rport->rpf.rpsc_speed < 107 (rport->rpf.rpsc_speed <
108 bfa_fcs_port_get_rport_max_speed(port))) 108 bfa_fcs_port_get_rport_max_speed(port)))
diff --git a/drivers/scsi/bfa/vport.c b/drivers/scsi/bfa/vport.c
index 14fb7ac2bfbc..c5e534eb1620 100644
--- a/drivers/scsi/bfa/vport.c
+++ b/drivers/scsi/bfa/vport.c
@@ -478,7 +478,7 @@ static void
478bfa_fcs_vport_do_fdisc(struct bfa_fcs_vport_s *vport) 478bfa_fcs_vport_do_fdisc(struct bfa_fcs_vport_s *vport)
479{ 479{
480 bfa_lps_fdisc(vport->lps, vport, 480 bfa_lps_fdisc(vport->lps, vport,
481 bfa_pport_get_maxfrsize(__vport_bfa(vport)), 481 bfa_fcport_get_maxfrsize(__vport_bfa(vport)),
482 __vport_pwwn(vport), __vport_nwwn(vport)); 482 __vport_pwwn(vport), __vport_nwwn(vport));
483 vport->vport_stats.fdisc_sent++; 483 vport->vport_stats.fdisc_sent++;
484} 484}