aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r--drivers/scsi/bfa/bfa_cb_ioim_macros.h10
-rw-r--r--drivers/scsi/bfa/bfa_cee.c2
-rw-r--r--drivers/scsi/bfa/bfa_csdebug.c4
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.c4
-rw-r--r--drivers/scsi/bfa/bfa_fcpim_priv.h4
-rw-r--r--drivers/scsi/bfa/bfa_fcport.c59
-rw-r--r--drivers/scsi/bfa/bfa_fcs_lport.c11
-rw-r--r--drivers/scsi/bfa/bfa_fcxp.c8
-rw-r--r--drivers/scsi/bfa/bfa_intr.c2
-rw-r--r--drivers/scsi/bfa/bfa_intr_priv.h18
-rw-r--r--drivers/scsi/bfa/bfa_ioc.c10
-rw-r--r--drivers/scsi/bfa/bfa_ioc.h12
-rw-r--r--drivers/scsi/bfa/bfa_iocfc.c8
-rw-r--r--drivers/scsi/bfa/bfa_iocfc.h8
-rw-r--r--drivers/scsi/bfa/bfa_ioim.c4
-rw-r--r--drivers/scsi/bfa/bfa_itnim.c6
-rw-r--r--drivers/scsi/bfa/bfa_log.c4
-rw-r--r--drivers/scsi/bfa/bfa_port_priv.h4
-rw-r--r--drivers/scsi/bfa/bfa_rport.c6
-rw-r--r--drivers/scsi/bfa/bfa_tskim.c9
-rw-r--r--drivers/scsi/bfa/bfa_uf.c2
-rw-r--r--drivers/scsi/bfa/bfad.c6
-rw-r--r--drivers/scsi/bfa/bfad_fwimg.c8
-rw-r--r--drivers/scsi/bfa/bfad_im.c2
-rw-r--r--drivers/scsi/bfa/bfad_im_compat.h2
-rw-r--r--drivers/scsi/bfa/bfad_intr.c3
-rw-r--r--drivers/scsi/bfa/fabric.c18
-rw-r--r--drivers/scsi/bfa/fcbuild.c190
-rw-r--r--drivers/scsi/bfa/fcbuild.h6
-rw-r--r--drivers/scsi/bfa/fcpim.c7
-rw-r--r--drivers/scsi/bfa/fcs.h2
-rw-r--r--drivers/scsi/bfa/fdmi.c8
-rw-r--r--drivers/scsi/bfa/include/aen/bfa_aen.h2
-rw-r--r--drivers/scsi/bfa/include/bfa.h10
-rw-r--r--drivers/scsi/bfa/include/bfa_svc.h8
-rw-r--r--drivers/scsi/bfa/include/bfi/bfi.h12
-rw-r--r--drivers/scsi/bfa/include/bfi/bfi_ioc.h2
-rw-r--r--drivers/scsi/bfa/include/bfi/bfi_lps.h4
-rw-r--r--drivers/scsi/bfa/include/bfi/bfi_rport.h8
-rw-r--r--drivers/scsi/bfa/include/cs/bfa_checksum.h6
-rw-r--r--drivers/scsi/bfa/include/cs/bfa_sm.h6
-rw-r--r--drivers/scsi/bfa/include/cs/bfa_trc.h2
-rw-r--r--drivers/scsi/bfa/include/fcs/bfa_fcs_fabric.h2
-rw-r--r--drivers/scsi/bfa/include/fcs/bfa_fcs_lport.h17
-rw-r--r--drivers/scsi/bfa/include/protocol/ct.h10
-rw-r--r--drivers/scsi/bfa/include/protocol/fc.h22
-rw-r--r--drivers/scsi/bfa/loop.c233
-rw-r--r--drivers/scsi/bfa/lport_api.c15
-rw-r--r--drivers/scsi/bfa/ns.c5
-rw-r--r--drivers/scsi/bfa/plog.c2
-rw-r--r--drivers/scsi/bfa/rport_ftrs.c28
-rw-r--r--drivers/scsi/bfa/vfapi.c2
-rw-r--r--drivers/scsi/bfa/vport.c20
53 files changed, 324 insertions, 539 deletions
diff --git a/drivers/scsi/bfa/bfa_cb_ioim_macros.h b/drivers/scsi/bfa/bfa_cb_ioim_macros.h
index 0050c838c358..961fe439daad 100644
--- a/drivers/scsi/bfa/bfa_cb_ioim_macros.h
+++ b/drivers/scsi/bfa/bfa_cb_ioim_macros.h
@@ -51,7 +51,7 @@ bfad_int_to_lun(u32 luno)
51 lun.bfa_lun = 0; 51 lun.bfa_lun = 0;
52 lun.scsi_lun[0] = bfa_os_htons(luno); 52 lun.scsi_lun[0] = bfa_os_htons(luno);
53 53
54 return (lun.bfa_lun); 54 return lun.bfa_lun;
55} 55}
56 56
57/** 57/**
@@ -68,7 +68,7 @@ bfa_cb_ioim_get_cdb(struct bfad_ioim_s *dio)
68{ 68{
69 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; 69 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
70 70
71 return ((u8 *) cmnd->cmnd); 71 return (u8 *) cmnd->cmnd;
72} 72}
73 73
74/** 74/**
@@ -97,7 +97,7 @@ bfa_cb_ioim_get_size(struct bfad_ioim_s *dio)
97{ 97{
98 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; 98 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
99 99
100 return (scsi_bufflen(cmnd)); 100 return scsi_bufflen(cmnd);
101} 101}
102 102
103/** 103/**
@@ -129,7 +129,7 @@ bfa_cb_ioim_get_sgaddr(struct bfad_ioim_s *dio, int sgeid)
129 sge = (struct scatterlist *)scsi_sglist(cmnd) + sgeid; 129 sge = (struct scatterlist *)scsi_sglist(cmnd) + sgeid;
130 addr = (u64) sg_dma_address(sge); 130 addr = (u64) sg_dma_address(sge);
131 131
132 return (*(union bfi_addr_u *) &addr); 132 return *((union bfi_addr_u *) &addr);
133} 133}
134 134
135static inline u32 135static inline u32
@@ -197,7 +197,7 @@ bfa_cb_ioim_get_cdblen(struct bfad_ioim_s *dio)
197{ 197{
198 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; 198 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
199 199
200 return (cmnd->cmd_len); 200 return cmnd->cmd_len;
201} 201}
202 202
203 203
diff --git a/drivers/scsi/bfa/bfa_cee.c b/drivers/scsi/bfa/bfa_cee.c
index 7a959c34e789..2b917792c6bc 100644
--- a/drivers/scsi/bfa/bfa_cee.c
+++ b/drivers/scsi/bfa/bfa_cee.c
@@ -228,7 +228,7 @@ bfa_cee_reset_stats_isr(struct bfa_cee_s *cee, bfa_status_t status)
228u32 228u32
229bfa_cee_meminfo(void) 229bfa_cee_meminfo(void)
230{ 230{
231 return (bfa_cee_attr_meminfo() + bfa_cee_stats_meminfo()); 231 return bfa_cee_attr_meminfo() + bfa_cee_stats_meminfo();
232} 232}
233 233
234/** 234/**
diff --git a/drivers/scsi/bfa/bfa_csdebug.c b/drivers/scsi/bfa/bfa_csdebug.c
index 1b71d349451a..caeb1143a4e6 100644
--- a/drivers/scsi/bfa/bfa_csdebug.c
+++ b/drivers/scsi/bfa/bfa_csdebug.c
@@ -47,12 +47,12 @@ bfa_q_is_on_q_func(struct list_head *q, struct list_head *qe)
47 tqe = bfa_q_next(q); 47 tqe = bfa_q_next(q);
48 while (tqe != q) { 48 while (tqe != q) {
49 if (tqe == qe) 49 if (tqe == qe)
50 return (1); 50 return 1;
51 tqe = bfa_q_next(tqe); 51 tqe = bfa_q_next(tqe);
52 if (tqe == NULL) 52 if (tqe == NULL)
53 break; 53 break;
54 } 54 }
55 return (0); 55 return 0;
56} 56}
57 57
58 58
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c
index 401babe3494e..790c945aeae6 100644
--- a/drivers/scsi/bfa/bfa_fcpim.c
+++ b/drivers/scsi/bfa/bfa_fcpim.c
@@ -131,7 +131,7 @@ bfa_fcpim_path_tov_get(struct bfa_s *bfa)
131{ 131{
132 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 132 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
133 133
134 return (fcpim->path_tov / 1000); 134 return fcpim->path_tov / 1000;
135} 135}
136 136
137bfa_status_t 137bfa_status_t
@@ -169,7 +169,7 @@ bfa_fcpim_qdepth_get(struct bfa_s *bfa)
169{ 169{
170 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 170 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
171 171
172 return (fcpim->q_depth); 172 return fcpim->q_depth;
173} 173}
174 174
175 175
diff --git a/drivers/scsi/bfa/bfa_fcpim_priv.h b/drivers/scsi/bfa/bfa_fcpim_priv.h
index 153206cfb37a..5cf418460f75 100644
--- a/drivers/scsi/bfa/bfa_fcpim_priv.h
+++ b/drivers/scsi/bfa/bfa_fcpim_priv.h
@@ -35,7 +35,7 @@
35#define BFA_FCPIM_PATHTOV_MAX (90 * 1000) /* in millisecs */ 35#define BFA_FCPIM_PATHTOV_MAX (90 * 1000) /* in millisecs */
36 36
37#define bfa_fcpim_stats(__fcpim, __stats) \ 37#define bfa_fcpim_stats(__fcpim, __stats) \
38 (__fcpim)->stats.__stats ++ 38 ((__fcpim)->stats.__stats++)
39 39
40struct bfa_fcpim_mod_s { 40struct bfa_fcpim_mod_s {
41 struct bfa_s *bfa; 41 struct bfa_s *bfa;
@@ -143,7 +143,7 @@ struct bfa_itnim_s {
143 struct bfa_itnim_hal_stats_s stats; 143 struct bfa_itnim_hal_stats_s stats;
144}; 144};
145 145
146#define bfa_itnim_is_online(_itnim) (_itnim)->is_online 146#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online)
147#define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod) 147#define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod)
148#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ 148#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \
149 (&fcpim->ioim_arr[_iotag]) 149 (&fcpim->ioim_arr[_iotag])
diff --git a/drivers/scsi/bfa/bfa_fcport.c b/drivers/scsi/bfa/bfa_fcport.c
index 992435987deb..aef648b55dfc 100644
--- a/drivers/scsi/bfa/bfa_fcport.c
+++ b/drivers/scsi/bfa/bfa_fcport.c
@@ -388,32 +388,29 @@ bfa_pport_sm_linkup(struct bfa_pport_s *pport, enum bfa_pport_sm_event event)
388 bfa_pport_callback(pport, BFA_PPORT_LINKDOWN); 388 bfa_pport_callback(pport, BFA_PPORT_LINKDOWN);
389 bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, 389 bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL,
390 BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown"); 390 BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown");
391 if (BFA_PORT_IS_DISABLED(pport->bfa)) { 391 if (BFA_PORT_IS_DISABLED(pport->bfa))
392 bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); 392 bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE);
393 } else { 393 else
394 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT); 394 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT);
395 }
396 break; 395 break;
397 396
398 case BFA_PPORT_SM_STOP: 397 case BFA_PPORT_SM_STOP:
399 bfa_sm_set_state(pport, bfa_pport_sm_stopped); 398 bfa_sm_set_state(pport, bfa_pport_sm_stopped);
400 bfa_pport_reset_linkinfo(pport); 399 bfa_pport_reset_linkinfo(pport);
401 if (BFA_PORT_IS_DISABLED(pport->bfa)) { 400 if (BFA_PORT_IS_DISABLED(pport->bfa))
402 bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); 401 bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE);
403 } else { 402 else
404 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT); 403 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT);
405 }
406 break; 404 break;
407 405
408 case BFA_PPORT_SM_HWFAIL: 406 case BFA_PPORT_SM_HWFAIL:
409 bfa_sm_set_state(pport, bfa_pport_sm_iocdown); 407 bfa_sm_set_state(pport, bfa_pport_sm_iocdown);
410 bfa_pport_reset_linkinfo(pport); 408 bfa_pport_reset_linkinfo(pport);
411 bfa_pport_callback(pport, BFA_PPORT_LINKDOWN); 409 bfa_pport_callback(pport, BFA_PPORT_LINKDOWN);
412 if (BFA_PORT_IS_DISABLED(pport->bfa)) { 410 if (BFA_PORT_IS_DISABLED(pport->bfa))
413 bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); 411 bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE);
414 } else { 412 else
415 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT); 413 bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT);
416 }
417 break; 414 break;
418 415
419 default: 416 default:
@@ -999,10 +996,10 @@ bfa_pport_enable(struct bfa_s *bfa)
999 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 996 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa);
1000 997
1001 if (pport->diag_busy) 998 if (pport->diag_busy)
1002 return (BFA_STATUS_DIAG_BUSY); 999 return BFA_STATUS_DIAG_BUSY;
1003 else if (bfa_sm_cmp_state 1000 else if (bfa_sm_cmp_state
1004 (BFA_PORT_MOD(bfa), bfa_pport_sm_disabling_qwait)) 1001 (BFA_PORT_MOD(bfa), bfa_pport_sm_disabling_qwait))
1005 return (BFA_STATUS_DEVBUSY); 1002 return BFA_STATUS_DEVBUSY;
1006 1003
1007 bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_ENABLE); 1004 bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_ENABLE);
1008 return BFA_STATUS_OK; 1005 return BFA_STATUS_OK;
@@ -1032,7 +1029,7 @@ bfa_pport_cfg_speed(struct bfa_s *bfa, enum bfa_pport_speed speed)
1032 1029
1033 pport->cfg.speed = speed; 1030 pport->cfg.speed = speed;
1034 1031
1035 return (BFA_STATUS_OK); 1032 return BFA_STATUS_OK;
1036} 1033}
1037 1034
1038/** 1035/**
@@ -1068,7 +1065,7 @@ bfa_pport_cfg_topology(struct bfa_s *bfa, enum bfa_pport_topology topology)
1068 } 1065 }
1069 1066
1070 pport->cfg.topology = topology; 1067 pport->cfg.topology = topology;
1071 return (BFA_STATUS_OK); 1068 return BFA_STATUS_OK;
1072} 1069}
1073 1070
1074/** 1071/**
@@ -1094,7 +1091,7 @@ bfa_pport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa)
1094 pport->cfg.cfg_hardalpa = BFA_TRUE; 1091 pport->cfg.cfg_hardalpa = BFA_TRUE;
1095 pport->cfg.hardalpa = alpa; 1092 pport->cfg.hardalpa = alpa;
1096 1093
1097 return (BFA_STATUS_OK); 1094 return BFA_STATUS_OK;
1098} 1095}
1099 1096
1100bfa_status_t 1097bfa_status_t
@@ -1106,7 +1103,7 @@ bfa_pport_clr_hardalpa(struct bfa_s *bfa)
1106 bfa_trc(bfa, pport->cfg.hardalpa); 1103 bfa_trc(bfa, pport->cfg.hardalpa);
1107 1104
1108 pport->cfg.cfg_hardalpa = BFA_FALSE; 1105 pport->cfg.cfg_hardalpa = BFA_FALSE;
1109 return (BFA_STATUS_OK); 1106 return BFA_STATUS_OK;
1110} 1107}
1111 1108
1112bfa_boolean_t 1109bfa_boolean_t
@@ -1138,16 +1135,16 @@ bfa_pport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxfrsize)
1138 * with in range 1135 * with in range
1139 */ 1136 */
1140 if ((maxfrsize > FC_MAX_PDUSZ) || (maxfrsize < FC_MIN_PDUSZ)) 1137 if ((maxfrsize > FC_MAX_PDUSZ) || (maxfrsize < FC_MIN_PDUSZ))
1141 return (BFA_STATUS_INVLD_DFSZ); 1138 return BFA_STATUS_INVLD_DFSZ;
1142 1139
1143 /* 1140 /*
1144 * power of 2, if not the max frame size of 2112 1141 * power of 2, if not the max frame size of 2112
1145 */ 1142 */
1146 if ((maxfrsize != FC_MAX_PDUSZ) && (maxfrsize & (maxfrsize - 1))) 1143 if ((maxfrsize != FC_MAX_PDUSZ) && (maxfrsize & (maxfrsize - 1)))
1147 return (BFA_STATUS_INVLD_DFSZ); 1144 return BFA_STATUS_INVLD_DFSZ;
1148 1145
1149 pport->cfg.maxfrsize = maxfrsize; 1146 pport->cfg.maxfrsize = maxfrsize;
1150 return (BFA_STATUS_OK); 1147 return BFA_STATUS_OK;
1151} 1148}
1152 1149
1153u16 1150u16
@@ -1415,7 +1412,7 @@ bfa_pport_get_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats,
1415 1412
1416 if (port->stats_busy) { 1413 if (port->stats_busy) {
1417 bfa_trc(bfa, port->stats_busy); 1414 bfa_trc(bfa, port->stats_busy);
1418 return (BFA_STATUS_DEVBUSY); 1415 return BFA_STATUS_DEVBUSY;
1419 } 1416 }
1420 1417
1421 port->stats_busy = BFA_TRUE; 1418 port->stats_busy = BFA_TRUE;
@@ -1427,7 +1424,7 @@ bfa_pport_get_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats,
1427 1424
1428 bfa_timer_start(bfa, &port->timer, bfa_port_stats_timeout, port, 1425 bfa_timer_start(bfa, &port->timer, bfa_port_stats_timeout, port,
1429 BFA_PORT_STATS_TOV); 1426 BFA_PORT_STATS_TOV);
1430 return (BFA_STATUS_OK); 1427 return BFA_STATUS_OK;
1431} 1428}
1432 1429
1433bfa_status_t 1430bfa_status_t
@@ -1437,7 +1434,7 @@ bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1437 1434
1438 if (port->stats_busy) { 1435 if (port->stats_busy) {
1439 bfa_trc(bfa, port->stats_busy); 1436 bfa_trc(bfa, port->stats_busy);
1440 return (BFA_STATUS_DEVBUSY); 1437 return BFA_STATUS_DEVBUSY;
1441 } 1438 }
1442 1439
1443 port->stats_busy = BFA_TRUE; 1440 port->stats_busy = BFA_TRUE;
@@ -1448,7 +1445,7 @@ bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1448 1445
1449 bfa_timer_start(bfa, &port->timer, bfa_port_stats_clr_timeout, port, 1446 bfa_timer_start(bfa, &port->timer, bfa_port_stats_clr_timeout, port,
1450 BFA_PORT_STATS_TOV); 1447 BFA_PORT_STATS_TOV);
1451 return (BFA_STATUS_OK); 1448 return BFA_STATUS_OK;
1452} 1449}
1453 1450
1454bfa_status_t 1451bfa_status_t
@@ -1515,7 +1512,7 @@ bfa_pport_get_qos_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats,
1515 /* 1512 /*
1516 * QoS stats is embedded in port stats 1513 * QoS stats is embedded in port stats
1517 */ 1514 */
1518 return (bfa_pport_get_stats(bfa, stats, cbfn, cbarg)); 1515 return bfa_pport_get_stats(bfa, stats, cbfn, cbarg);
1519} 1516}
1520 1517
1521bfa_status_t 1518bfa_status_t
@@ -1525,7 +1522,7 @@ bfa_pport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1525 1522
1526 if (port->stats_busy) { 1523 if (port->stats_busy) {
1527 bfa_trc(bfa, port->stats_busy); 1524 bfa_trc(bfa, port->stats_busy);
1528 return (BFA_STATUS_DEVBUSY); 1525 return BFA_STATUS_DEVBUSY;
1529 } 1526 }
1530 1527
1531 port->stats_busy = BFA_TRUE; 1528 port->stats_busy = BFA_TRUE;
@@ -1536,7 +1533,7 @@ bfa_pport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1536 1533
1537 bfa_timer_start(bfa, &port->timer, bfa_port_stats_clr_timeout, port, 1534 bfa_timer_start(bfa, &port->timer, bfa_port_stats_clr_timeout, port,
1538 BFA_PORT_STATS_TOV); 1535 BFA_PORT_STATS_TOV);
1539 return (BFA_STATUS_OK); 1536 return BFA_STATUS_OK;
1540} 1537}
1541 1538
1542/** 1539/**
@@ -1545,7 +1542,7 @@ bfa_pport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1545bfa_status_t 1542bfa_status_t
1546bfa_pport_trunk_disable(struct bfa_s *bfa) 1543bfa_pport_trunk_disable(struct bfa_s *bfa)
1547{ 1544{
1548 return (BFA_STATUS_OK); 1545 return BFA_STATUS_OK;
1549} 1546}
1550 1547
1551bfa_boolean_t 1548bfa_boolean_t
@@ -1562,8 +1559,8 @@ bfa_pport_is_disabled(struct bfa_s *bfa)
1562{ 1559{
1563 struct bfa_pport_s *port = BFA_PORT_MOD(bfa); 1560 struct bfa_pport_s *port = BFA_PORT_MOD(bfa);
1564 1561
1565 return (bfa_sm_to_state(hal_pport_sm_table, port->sm) == 1562 return bfa_sm_to_state(hal_pport_sm_table, port->sm) ==
1566 BFA_PPORT_ST_DISABLED); 1563 BFA_PPORT_ST_DISABLED;
1567 1564
1568} 1565}
1569 1566
@@ -1572,7 +1569,7 @@ bfa_pport_is_ratelim(struct bfa_s *bfa)
1572{ 1569{
1573 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1570 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa);
1574 1571
1575return (pport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE); 1572 return pport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE;
1576 1573
1577} 1574}
1578 1575
@@ -1620,7 +1617,7 @@ bfa_pport_cfg_ratelim_speed(struct bfa_s *bfa, enum bfa_pport_speed speed)
1620 1617
1621 pport->cfg.trl_def_speed = speed; 1618 pport->cfg.trl_def_speed = speed;
1622 1619
1623 return (BFA_STATUS_OK); 1620 return BFA_STATUS_OK;
1624} 1621}
1625 1622
1626/** 1623/**
@@ -1632,7 +1629,7 @@ bfa_pport_get_ratelim_speed(struct bfa_s *bfa)
1632 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); 1629 struct bfa_pport_s *pport = BFA_PORT_MOD(bfa);
1633 1630
1634 bfa_trc(bfa, pport->cfg.trl_def_speed); 1631 bfa_trc(bfa, pport->cfg.trl_def_speed);
1635 return (pport->cfg.trl_def_speed); 1632 return pport->cfg.trl_def_speed;
1636 1633
1637} 1634}
1638 1635
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 8975ed041dc0..c7ab257f10a7 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -568,11 +568,10 @@ bfa_fcs_port_offline_actions(struct bfa_fcs_port_s *port)
568 568
569 __port_action[port->fabric->fab_type].offline(port); 569 __port_action[port->fabric->fab_type].offline(port);
570 570
571 if (bfa_fcs_fabric_is_online(port->fabric) == BFA_TRUE) { 571 if (bfa_fcs_fabric_is_online(port->fabric) == BFA_TRUE)
572 bfa_fcs_port_aen_post(port, BFA_LPORT_AEN_DISCONNECT); 572 bfa_fcs_port_aen_post(port, BFA_LPORT_AEN_DISCONNECT);
573 } else { 573 else
574 bfa_fcs_port_aen_post(port, BFA_LPORT_AEN_OFFLINE); 574 bfa_fcs_port_aen_post(port, BFA_LPORT_AEN_OFFLINE);
575 }
576 bfa_fcb_port_offline(port->fcs->bfad, port->port_cfg.roles, 575 bfa_fcb_port_offline(port->fcs->bfad, port->port_cfg.roles,
577 port->fabric->vf_drv, 576 port->fabric->vf_drv,
578 (port->vport == NULL) ? NULL : port->vport->vport_drv); 577 (port->vport == NULL) ? NULL : port->vport->vport_drv);
@@ -777,7 +776,7 @@ bfa_fcs_port_get_rport_by_pwwn(struct bfa_fcs_port_s *port, wwn_t pwwn)
777 } 776 }
778 777
779 bfa_trc(port->fcs, pwwn); 778 bfa_trc(port->fcs, pwwn);
780 return (NULL); 779 return NULL;
781} 780}
782 781
783/** 782/**
@@ -796,7 +795,7 @@ bfa_fcs_port_get_rport_by_nwwn(struct bfa_fcs_port_s *port, wwn_t nwwn)
796 } 795 }
797 796
798 bfa_trc(port->fcs, nwwn); 797 bfa_trc(port->fcs, nwwn);
799 return (NULL); 798 return NULL;
800} 799}
801 800
802/** 801/**
@@ -870,7 +869,7 @@ bfa_fcs_port_lip(struct bfa_fcs_port_s *port)
870bfa_boolean_t 869bfa_boolean_t
871bfa_fcs_port_is_online(struct bfa_fcs_port_s *port) 870bfa_fcs_port_is_online(struct bfa_fcs_port_s *port)
872{ 871{
873 return (bfa_sm_cmp_state(port, bfa_fcs_port_sm_online)); 872 return bfa_sm_cmp_state(port, bfa_fcs_port_sm_online);
874} 873}
875 874
876/** 875/**
diff --git a/drivers/scsi/bfa/bfa_fcxp.c b/drivers/scsi/bfa/bfa_fcxp.c
index 4754a0e9006a..cf0ad6782686 100644
--- a/drivers/scsi/bfa/bfa_fcxp.c
+++ b/drivers/scsi/bfa/bfa_fcxp.c
@@ -199,7 +199,7 @@ bfa_fcxp_get(struct bfa_fcxp_mod_s *fm)
199 if (fcxp) 199 if (fcxp)
200 list_add_tail(&fcxp->qe, &fm->fcxp_active_q); 200 list_add_tail(&fcxp->qe, &fm->fcxp_active_q);
201 201
202 return (fcxp); 202 return fcxp;
203} 203}
204 204
205static void 205static void
@@ -503,7 +503,7 @@ bfa_fcxp_alloc(void *caller, struct bfa_s *bfa, int nreq_sgles,
503 503
504 fcxp = bfa_fcxp_get(BFA_FCXP_MOD(bfa)); 504 fcxp = bfa_fcxp_get(BFA_FCXP_MOD(bfa));
505 if (fcxp == NULL) 505 if (fcxp == NULL)
506 return (NULL); 506 return NULL;
507 507
508 bfa_trc(bfa, fcxp->fcxp_tag); 508 bfa_trc(bfa, fcxp->fcxp_tag);
509 509
@@ -568,7 +568,7 @@ bfa_fcxp_alloc(void *caller, struct bfa_s *bfa, int nreq_sgles,
568 } 568 }
569 } 569 }
570 570
571 return (fcxp); 571 return fcxp;
572} 572}
573 573
574/** 574/**
@@ -709,7 +709,7 @@ bfa_status_t
709bfa_fcxp_abort(struct bfa_fcxp_s *fcxp) 709bfa_fcxp_abort(struct bfa_fcxp_s *fcxp)
710{ 710{
711 bfa_assert(0); 711 bfa_assert(0);
712 return (BFA_STATUS_OK); 712 return BFA_STATUS_OK;
713} 713}
714 714
715void 715void
diff --git a/drivers/scsi/bfa/bfa_intr.c b/drivers/scsi/bfa/bfa_intr.c
index 0ca125712a04..b36540e4ed76 100644
--- a/drivers/scsi/bfa/bfa_intr.c
+++ b/drivers/scsi/bfa/bfa_intr.c
@@ -59,7 +59,7 @@ bfa_intx(struct bfa_s *bfa)
59 qintr = intr & __HFN_INT_RME_MASK; 59 qintr = intr & __HFN_INT_RME_MASK;
60 bfa_reg_write(bfa->iocfc.bfa_regs.intr_status, qintr); 60 bfa_reg_write(bfa->iocfc.bfa_regs.intr_status, qintr);
61 61
62 for (queue = 0; queue < BFI_IOC_MAX_CQS_ASIC; queue ++) { 62 for (queue = 0; queue < BFI_IOC_MAX_CQS_ASIC; queue++) {
63 if (intr & (__HFN_INT_RME_Q0 << queue)) 63 if (intr & (__HFN_INT_RME_Q0 << queue))
64 bfa_msix_rspq(bfa, queue & (BFI_IOC_MAX_CQS - 1)); 64 bfa_msix_rspq(bfa, queue & (BFI_IOC_MAX_CQS - 1));
65 } 65 }
diff --git a/drivers/scsi/bfa/bfa_intr_priv.h b/drivers/scsi/bfa/bfa_intr_priv.h
index 8ce6e6b105c8..5fc301cf4d1b 100644
--- a/drivers/scsi/bfa/bfa_intr_priv.h
+++ b/drivers/scsi/bfa/bfa_intr_priv.h
@@ -26,9 +26,9 @@ void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m);
26void bfa_isr_bind(enum bfi_mclass mc, bfa_isr_func_t isr_func); 26void bfa_isr_bind(enum bfi_mclass mc, bfa_isr_func_t isr_func);
27 27
28 28
29#define bfa_reqq_pi(__bfa, __reqq) (__bfa)->iocfc.req_cq_pi[__reqq] 29#define bfa_reqq_pi(__bfa, __reqq) ((__bfa)->iocfc.req_cq_pi[__reqq])
30#define bfa_reqq_ci(__bfa, __reqq) \ 30#define bfa_reqq_ci(__bfa, __reqq) \
31 *(u32 *)((__bfa)->iocfc.req_cq_shadow_ci[__reqq].kva) 31 (*(u32 *)((__bfa)->iocfc.req_cq_shadow_ci[__reqq].kva))
32 32
33#define bfa_reqq_full(__bfa, __reqq) \ 33#define bfa_reqq_full(__bfa, __reqq) \
34 (((bfa_reqq_pi(__bfa, __reqq) + 1) & \ 34 (((bfa_reqq_pi(__bfa, __reqq) + 1) & \
@@ -50,14 +50,16 @@ void bfa_isr_bind(enum bfi_mclass mc, bfa_isr_func_t isr_func);
50} while (0) 50} while (0)
51 51
52#define bfa_rspq_pi(__bfa, __rspq) \ 52#define bfa_rspq_pi(__bfa, __rspq) \
53 *(u32 *)((__bfa)->iocfc.rsp_cq_shadow_pi[__rspq].kva) 53 (*(u32 *)((__bfa)->iocfc.rsp_cq_shadow_pi[__rspq].kva))
54 54
55#define bfa_rspq_ci(__bfa, __rspq) (__bfa)->iocfc.rsp_cq_ci[__rspq] 55#define bfa_rspq_ci(__bfa, __rspq) ((__bfa)->iocfc.rsp_cq_ci[__rspq])
56#define bfa_rspq_elem(__bfa, __rspq, __ci) \ 56#define bfa_rspq_elem(__bfa, __rspq, __ci) \
57 &((struct bfi_msg_s *)((__bfa)->iocfc.rsp_cq_ba[__rspq].kva))[__ci] 57 (&((struct bfi_msg_s *)((__bfa)->iocfc.rsp_cq_ba[__rspq].kva))[__ci])
58 58
59#define CQ_INCR(__index, __size) \ 59#define CQ_INCR(__index, __size) do { \
60 (__index)++; (__index) &= ((__size) - 1) 60 (__index)++; \
61 (__index) &= ((__size) - 1); \
62} while (0)
61 63
62/** 64/**
63 * Queue element to wait for room in request queue. FIFO order is 65 * Queue element to wait for room in request queue. FIFO order is
@@ -94,7 +96,7 @@ bfa_reqq_winit(struct bfa_reqq_wait_s *wqe, void (*qresume) (void *cbarg),
94 wqe->cbarg = cbarg; 96 wqe->cbarg = cbarg;
95} 97}
96 98
97#define bfa_reqq(__bfa, __reqq) &(__bfa)->reqq_waitq[__reqq] 99#define bfa_reqq(__bfa, __reqq) (&(__bfa)->reqq_waitq[__reqq])
98 100
99/** 101/**
100 * static inline void 102 * static inline void
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c
index 149348934ce3..397d7e9eade5 100644
--- a/drivers/scsi/bfa/bfa_ioc.c
+++ b/drivers/scsi/bfa/bfa_ioc.c
@@ -51,7 +51,7 @@ BFA_TRC_FILE(HAL, IOC);
51 (sizeof(struct bfa_trc_mod_s) - \ 51 (sizeof(struct bfa_trc_mod_s) - \
52 BFA_TRC_MAX * sizeof(struct bfa_trc_s))) 52 BFA_TRC_MAX * sizeof(struct bfa_trc_s)))
53#define BFA_DBG_FWTRC_OFF(_fn) (BFI_IOC_TRC_OFF + BFA_DBG_FWTRC_LEN * (_fn)) 53#define BFA_DBG_FWTRC_OFF(_fn) (BFI_IOC_TRC_OFF + BFA_DBG_FWTRC_LEN * (_fn))
54#define bfa_ioc_stats(_ioc, _stats) (_ioc)->stats._stats ++ 54#define bfa_ioc_stats(_ioc, _stats) ((_ioc)->stats._stats++)
55 55
56#define BFA_FLASH_CHUNK_NO(off) (off / BFI_FLASH_CHUNK_SZ_WORDS) 56#define BFA_FLASH_CHUNK_NO(off) (off / BFI_FLASH_CHUNK_SZ_WORDS)
57#define BFA_FLASH_OFFSET_IN_CHUNK(off) (off % BFI_FLASH_CHUNK_SZ_WORDS) 57#define BFA_FLASH_OFFSET_IN_CHUNK(off) (off % BFI_FLASH_CHUNK_SZ_WORDS)
@@ -1953,8 +1953,8 @@ bfa_ioc_error_isr(struct bfa_ioc_s *ioc)
1953bfa_boolean_t 1953bfa_boolean_t
1954bfa_ioc_is_disabled(struct bfa_ioc_s *ioc) 1954bfa_ioc_is_disabled(struct bfa_ioc_s *ioc)
1955{ 1955{
1956 return (bfa_fsm_cmp_state(ioc, bfa_ioc_sm_disabling) 1956 return bfa_fsm_cmp_state(ioc, bfa_ioc_sm_disabling)
1957 || bfa_fsm_cmp_state(ioc, bfa_ioc_sm_disabled)); 1957 || bfa_fsm_cmp_state(ioc, bfa_ioc_sm_disabled);
1958} 1958}
1959 1959
1960/** 1960/**
@@ -1963,9 +1963,9 @@ bfa_ioc_is_disabled(struct bfa_ioc_s *ioc)
1963bfa_boolean_t 1963bfa_boolean_t
1964bfa_ioc_fw_mismatch(struct bfa_ioc_s *ioc) 1964bfa_ioc_fw_mismatch(struct bfa_ioc_s *ioc)
1965{ 1965{
1966 return (bfa_fsm_cmp_state(ioc, bfa_ioc_sm_reset) 1966 return bfa_fsm_cmp_state(ioc, bfa_ioc_sm_reset)
1967 || bfa_fsm_cmp_state(ioc, bfa_ioc_sm_fwcheck) 1967 || bfa_fsm_cmp_state(ioc, bfa_ioc_sm_fwcheck)
1968 || bfa_fsm_cmp_state(ioc, bfa_ioc_sm_mismatch)); 1968 || bfa_fsm_cmp_state(ioc, bfa_ioc_sm_mismatch);
1969} 1969}
1970 1970
1971#define bfa_ioc_state_disabled(__sm) \ 1971#define bfa_ioc_state_disabled(__sm) \
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h
index 58efd4b13143..7c30f05ab137 100644
--- a/drivers/scsi/bfa/bfa_ioc.h
+++ b/drivers/scsi/bfa/bfa_ioc.h
@@ -179,16 +179,16 @@ struct bfa_ioc_s {
179 struct bfa_ioc_mbox_mod_s mbox_mod; 179 struct bfa_ioc_mbox_mod_s mbox_mod;
180}; 180};
181 181
182#define bfa_ioc_pcifn(__ioc) (__ioc)->pcidev.pci_func 182#define bfa_ioc_pcifn(__ioc) ((__ioc)->pcidev.pci_func)
183#define bfa_ioc_devid(__ioc) (__ioc)->pcidev.device_id 183#define bfa_ioc_devid(__ioc) ((__ioc)->pcidev.device_id)
184#define bfa_ioc_bar0(__ioc) (__ioc)->pcidev.pci_bar_kva 184#define bfa_ioc_bar0(__ioc) ((__ioc)->pcidev.pci_bar_kva)
185#define bfa_ioc_portid(__ioc) ((__ioc)->port_id) 185#define bfa_ioc_portid(__ioc) ((__ioc)->port_id)
186#define bfa_ioc_fetch_stats(__ioc, __stats) \ 186#define bfa_ioc_fetch_stats(__ioc, __stats) \
187 ((__stats)->drv_stats) = (__ioc)->stats 187 (((__stats)->drv_stats) = (__ioc)->stats)
188#define bfa_ioc_clr_stats(__ioc) \ 188#define bfa_ioc_clr_stats(__ioc) \
189 bfa_os_memset(&(__ioc)->stats, 0, sizeof((__ioc)->stats)) 189 bfa_os_memset(&(__ioc)->stats, 0, sizeof((__ioc)->stats))
190#define bfa_ioc_maxfrsize(__ioc) (__ioc)->attr->maxfrsize 190#define bfa_ioc_maxfrsize(__ioc) ((__ioc)->attr->maxfrsize)
191#define bfa_ioc_rx_bbcredit(__ioc) (__ioc)->attr->rx_bbcredit 191#define bfa_ioc_rx_bbcredit(__ioc) ((__ioc)->attr->rx_bbcredit)
192#define bfa_ioc_speed_sup(__ioc) \ 192#define bfa_ioc_speed_sup(__ioc) \
193 BFI_ADAPTER_GETP(SPEED, (__ioc)->attr->adapter_prop) 193 BFI_ADAPTER_GETP(SPEED, (__ioc)->attr->adapter_prop)
194 194
diff --git a/drivers/scsi/bfa/bfa_iocfc.c b/drivers/scsi/bfa/bfa_iocfc.c
index 12350b022d63..d7ab792a9e54 100644
--- a/drivers/scsi/bfa/bfa_iocfc.c
+++ b/drivers/scsi/bfa/bfa_iocfc.c
@@ -794,7 +794,7 @@ bfa_iocfc_get_stats(struct bfa_s *bfa, struct bfa_iocfc_stats_s *stats,
794 794
795 if (iocfc->stats_busy) { 795 if (iocfc->stats_busy) {
796 bfa_trc(bfa, iocfc->stats_busy); 796 bfa_trc(bfa, iocfc->stats_busy);
797 return (BFA_STATUS_DEVBUSY); 797 return BFA_STATUS_DEVBUSY;
798 } 798 }
799 799
800 iocfc->stats_busy = BFA_TRUE; 800 iocfc->stats_busy = BFA_TRUE;
@@ -804,7 +804,7 @@ bfa_iocfc_get_stats(struct bfa_s *bfa, struct bfa_iocfc_stats_s *stats,
804 804
805 bfa_iocfc_stats_query(bfa); 805 bfa_iocfc_stats_query(bfa);
806 806
807 return (BFA_STATUS_OK); 807 return BFA_STATUS_OK;
808} 808}
809 809
810bfa_status_t 810bfa_status_t
@@ -814,7 +814,7 @@ bfa_iocfc_clear_stats(struct bfa_s *bfa, bfa_cb_ioc_t cbfn, void *cbarg)
814 814
815 if (iocfc->stats_busy) { 815 if (iocfc->stats_busy) {
816 bfa_trc(bfa, iocfc->stats_busy); 816 bfa_trc(bfa, iocfc->stats_busy);
817 return (BFA_STATUS_DEVBUSY); 817 return BFA_STATUS_DEVBUSY;
818 } 818 }
819 819
820 iocfc->stats_busy = BFA_TRUE; 820 iocfc->stats_busy = BFA_TRUE;
@@ -822,7 +822,7 @@ bfa_iocfc_clear_stats(struct bfa_s *bfa, bfa_cb_ioc_t cbfn, void *cbarg)
822 iocfc->stats_cbarg = cbarg; 822 iocfc->stats_cbarg = cbarg;
823 823
824 bfa_iocfc_stats_clear(bfa); 824 bfa_iocfc_stats_clear(bfa);
825 return (BFA_STATUS_OK); 825 return BFA_STATUS_OK;
826} 826}
827 827
828/** 828/**
diff --git a/drivers/scsi/bfa/bfa_iocfc.h b/drivers/scsi/bfa/bfa_iocfc.h
index 7ad177ed4cfc..ce9a830a4207 100644
--- a/drivers/scsi/bfa/bfa_iocfc.h
+++ b/drivers/scsi/bfa/bfa_iocfc.h
@@ -107,13 +107,13 @@ struct bfa_iocfc_s {
107 107
108#define bfa_lpuid(__bfa) bfa_ioc_portid(&(__bfa)->ioc) 108#define bfa_lpuid(__bfa) bfa_ioc_portid(&(__bfa)->ioc)
109#define bfa_msix_init(__bfa, __nvecs) \ 109#define bfa_msix_init(__bfa, __nvecs) \
110 (__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs) 110 ((__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs))
111#define bfa_msix_install(__bfa) \ 111#define bfa_msix_install(__bfa) \
112 (__bfa)->iocfc.hwif.hw_msix_install(__bfa) 112 ((__bfa)->iocfc.hwif.hw_msix_install(__bfa))
113#define bfa_msix_uninstall(__bfa) \ 113#define bfa_msix_uninstall(__bfa) \
114 (__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa) 114 ((__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa))
115#define bfa_isr_mode_set(__bfa, __msix) \ 115#define bfa_isr_mode_set(__bfa, __msix) \
116 (__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix) 116 ((__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix))
117#define bfa_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec) \ 117#define bfa_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec) \
118 (__bfa)->iocfc.hwif.hw_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec) 118 (__bfa)->iocfc.hwif.hw_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec)
119 119
diff --git a/drivers/scsi/bfa/bfa_ioim.c b/drivers/scsi/bfa/bfa_ioim.c
index 7ae2552e1e14..f81d359b7089 100644
--- a/drivers/scsi/bfa/bfa_ioim.c
+++ b/drivers/scsi/bfa/bfa_ioim.c
@@ -105,13 +105,13 @@ bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
105 bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); 105 bfa_sm_set_state(ioim, bfa_ioim_sm_hcb);
106 list_del(&ioim->qe); 106 list_del(&ioim->qe);
107 list_add_tail(&ioim->qe, 107 list_add_tail(&ioim->qe,
108 &ioim->fcpim->ioim_comp_q); 108 &ioim->fcpim->ioim_comp_q);
109 bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, 109 bfa_cb_queue(ioim->bfa, &ioim->hcb_qe,
110 __bfa_cb_ioim_pathtov, ioim); 110 __bfa_cb_ioim_pathtov, ioim);
111 } else { 111 } else {
112 list_del(&ioim->qe); 112 list_del(&ioim->qe);
113 list_add_tail(&ioim->qe, 113 list_add_tail(&ioim->qe,
114 &ioim->itnim->pending_q); 114 &ioim->itnim->pending_q);
115 } 115 }
116 break; 116 break;
117 } 117 }
diff --git a/drivers/scsi/bfa/bfa_itnim.c b/drivers/scsi/bfa/bfa_itnim.c
index 4d5c61a4f85c..eabf7d38bd09 100644
--- a/drivers/scsi/bfa/bfa_itnim.c
+++ b/drivers/scsi/bfa/bfa_itnim.c
@@ -1029,7 +1029,7 @@ bfa_itnim_create(struct bfa_s *bfa, struct bfa_rport_s *rport, void *ditn)
1029 bfa_stats(itnim, creates); 1029 bfa_stats(itnim, creates);
1030 bfa_sm_send_event(itnim, BFA_ITNIM_SM_CREATE); 1030 bfa_sm_send_event(itnim, BFA_ITNIM_SM_CREATE);
1031 1031
1032 return (itnim); 1032 return itnim;
1033} 1033}
1034 1034
1035void 1035void
@@ -1061,7 +1061,7 @@ bfa_itnim_offline(struct bfa_itnim_s *itnim)
1061bfa_boolean_t 1061bfa_boolean_t
1062bfa_itnim_hold_io(struct bfa_itnim_s *itnim) 1062bfa_itnim_hold_io(struct bfa_itnim_s *itnim)
1063{ 1063{
1064 return ( 1064 return
1065 itnim->fcpim->path_tov && itnim->iotov_active && 1065 itnim->fcpim->path_tov && itnim->iotov_active &&
1066 (bfa_sm_cmp_state(itnim, bfa_itnim_sm_fwcreate) || 1066 (bfa_sm_cmp_state(itnim, bfa_itnim_sm_fwcreate) ||
1067 bfa_sm_cmp_state(itnim, bfa_itnim_sm_sler) || 1067 bfa_sm_cmp_state(itnim, bfa_itnim_sm_sler) ||
@@ -1069,7 +1069,7 @@ bfa_itnim_hold_io(struct bfa_itnim_s *itnim)
1069 bfa_sm_cmp_state(itnim, bfa_itnim_sm_fwdelete) || 1069 bfa_sm_cmp_state(itnim, bfa_itnim_sm_fwdelete) ||
1070 bfa_sm_cmp_state(itnim, bfa_itnim_sm_offline) || 1070 bfa_sm_cmp_state(itnim, bfa_itnim_sm_offline) ||
1071 bfa_sm_cmp_state(itnim, bfa_itnim_sm_iocdisable)) 1071 bfa_sm_cmp_state(itnim, bfa_itnim_sm_iocdisable))
1072); 1072 ;
1073} 1073}
1074 1074
1075void 1075void
diff --git a/drivers/scsi/bfa/bfa_log.c b/drivers/scsi/bfa/bfa_log.c
index c2735e55cf03..e7514016c9c6 100644
--- a/drivers/scsi/bfa/bfa_log.c
+++ b/drivers/scsi/bfa/bfa_log.c
@@ -231,9 +231,9 @@ bfa_log_get_level(struct bfa_log_mod_s *log_mod, int mod_id)
231 return BFA_LOG_INVALID; 231 return BFA_LOG_INVALID;
232 232
233 if (log_mod) 233 if (log_mod)
234 return (log_mod->log_level[mod_id]); 234 return log_mod->log_level[mod_id];
235 else 235 else
236 return (bfa_log_info[mod_id].level); 236 return bfa_log_info[mod_id].level;
237} 237}
238 238
239enum bfa_log_severity 239enum bfa_log_severity
diff --git a/drivers/scsi/bfa/bfa_port_priv.h b/drivers/scsi/bfa/bfa_port_priv.h
index 4b97e2759908..51f698a06b6d 100644
--- a/drivers/scsi/bfa/bfa_port_priv.h
+++ b/drivers/scsi/bfa/bfa_port_priv.h
@@ -59,8 +59,8 @@ struct bfa_pport_s {
59 u8 *stats_kva; 59 u8 *stats_kva;
60 u64 stats_pa; 60 u64 stats_pa;
61 union bfa_pport_stats_u *stats; /* pport stats */ 61 union bfa_pport_stats_u *stats; /* pport stats */
62 u32 mypid : 24; 62 u32 mypid:24;
63 u32 rsvd_b : 8; 63 u32 rsvd_b:8;
64 struct bfa_timer_s timer; /* timer */ 64 struct bfa_timer_s timer; /* timer */
65 union bfa_pport_stats_u *stats_ret; 65 union bfa_pport_stats_u *stats_ret;
66 /* driver stats location */ 66 /* driver stats location */
diff --git a/drivers/scsi/bfa/bfa_rport.c b/drivers/scsi/bfa/bfa_rport.c
index 16da77a8db28..3e1990a74258 100644
--- a/drivers/scsi/bfa/bfa_rport.c
+++ b/drivers/scsi/bfa/bfa_rport.c
@@ -677,7 +677,7 @@ bfa_rport_alloc(struct bfa_rport_mod_s *mod)
677 if (rport) 677 if (rport)
678 list_add_tail(&rport->qe, &mod->rp_active_q); 678 list_add_tail(&rport->qe, &mod->rp_active_q);
679 679
680 return (rport); 680 return rport;
681} 681}
682 682
683static void 683static void
@@ -834,7 +834,7 @@ bfa_rport_create(struct bfa_s *bfa, void *rport_drv)
834 rp = bfa_rport_alloc(BFA_RPORT_MOD(bfa)); 834 rp = bfa_rport_alloc(BFA_RPORT_MOD(bfa));
835 835
836 if (rp == NULL) 836 if (rp == NULL)
837 return (NULL); 837 return NULL;
838 838
839 rp->bfa = bfa; 839 rp->bfa = bfa;
840 rp->rport_drv = rport_drv; 840 rp->rport_drv = rport_drv;
@@ -843,7 +843,7 @@ bfa_rport_create(struct bfa_s *bfa, void *rport_drv)
843 bfa_assert(bfa_sm_cmp_state(rp, bfa_rport_sm_uninit)); 843 bfa_assert(bfa_sm_cmp_state(rp, bfa_rport_sm_uninit));
844 bfa_sm_send_event(rp, BFA_RPORT_SM_CREATE); 844 bfa_sm_send_event(rp, BFA_RPORT_SM_CREATE);
845 845
846 return (rp); 846 return rp;
847} 847}
848 848
849void 849void
diff --git a/drivers/scsi/bfa/bfa_tskim.c b/drivers/scsi/bfa/bfa_tskim.c
index 010d40d1e5d3..ff7a4dc0bf3c 100644
--- a/drivers/scsi/bfa/bfa_tskim.c
+++ b/drivers/scsi/bfa/bfa_tskim.c
@@ -23,13 +23,14 @@ BFA_TRC_FILE(HAL, TSKIM);
23/** 23/**
24 * task management completion handling 24 * task management completion handling
25 */ 25 */
26#define bfa_tskim_qcomp(__tskim, __cbfn) do { \ 26#define bfa_tskim_qcomp(__tskim, __cbfn) do { \
27 bfa_cb_queue((__tskim)->bfa, &(__tskim)->hcb_qe, __cbfn, (__tskim)); \ 27 bfa_cb_queue((__tskim)->bfa, &(__tskim)->hcb_qe, \
28 __cbfn, (__tskim)); \
28 bfa_tskim_notify_comp(__tskim); \ 29 bfa_tskim_notify_comp(__tskim); \
29} while (0) 30} while (0)
30 31
31#define bfa_tskim_notify_comp(__tskim) do { \ 32#define bfa_tskim_notify_comp(__tskim) do { \
32 if ((__tskim)->notify) \ 33 if ((__tskim)->notify) \
33 bfa_itnim_tskdone((__tskim)->itnim); \ 34 bfa_itnim_tskdone((__tskim)->itnim); \
34} while (0) 35} while (0)
35 36
diff --git a/drivers/scsi/bfa/bfa_uf.c b/drivers/scsi/bfa/bfa_uf.c
index ff5f9deb1b22..4b3c2417d180 100644
--- a/drivers/scsi/bfa/bfa_uf.c
+++ b/drivers/scsi/bfa/bfa_uf.c
@@ -185,7 +185,7 @@ bfa_uf_get(struct bfa_uf_mod_s *uf_mod)
185 struct bfa_uf_s *uf; 185 struct bfa_uf_s *uf;
186 186
187 bfa_q_deq(&uf_mod->uf_free_q, &uf); 187 bfa_q_deq(&uf_mod->uf_free_q, &uf);
188 return (uf); 188 return uf;
189} 189}
190 190
191static void 191static void
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 6f2be5abf561..b52b773d49d9 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -188,8 +188,8 @@ static struct bfad_port_s *
188bfad_get_drv_port(struct bfad_s *bfad, struct bfad_vf_s *vf_drv, 188bfad_get_drv_port(struct bfad_s *bfad, struct bfad_vf_s *vf_drv,
189 struct bfad_vport_s *vp_drv) 189 struct bfad_vport_s *vp_drv)
190{ 190{
191 return ((vp_drv) ? (&(vp_drv)->drv_port) 191 return (vp_drv) ? (&(vp_drv)->drv_port)
192 : ((vf_drv) ? (&(vf_drv)->base_port) : (&(bfad)->pport))); 192 : ((vf_drv) ? (&(vf_drv)->base_port) : (&(bfad)->pport));
193} 193}
194 194
195struct bfad_port_s * 195struct bfad_port_s *
@@ -716,7 +716,7 @@ bfad_drv_init(struct bfad_s *bfad)
716 if ((bfad->bfad_flags & BFAD_MSIX_ON) 716 if ((bfad->bfad_flags & BFAD_MSIX_ON)
717 && bfad_install_msix_handler(bfad)) { 717 && bfad_install_msix_handler(bfad)) {
718 printk(KERN_WARNING "%s: install_msix failed, bfad%d\n", 718 printk(KERN_WARNING "%s: install_msix failed, bfad%d\n",
719 __FUNCTION__, bfad->inst_no); 719 __func__, bfad->inst_no);
720 } 720 }
721 721
722 bfad_init_timer(bfad); 722 bfad_init_timer(bfad);
diff --git a/drivers/scsi/bfa/bfad_fwimg.c b/drivers/scsi/bfa/bfad_fwimg.c
index bd34b0db2d6b..2ad65f275a92 100644
--- a/drivers/scsi/bfa/bfad_fwimg.c
+++ b/drivers/scsi/bfa/bfad_fwimg.c
@@ -65,10 +65,10 @@ bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
65 memcpy(*bfi_image, fw->data, fw->size); 65 memcpy(*bfi_image, fw->data, fw->size);
66 *bfi_image_size = fw->size/sizeof(u32); 66 *bfi_image_size = fw->size/sizeof(u32);
67 67
68 return(*bfi_image); 68 return *bfi_image;
69 69
70error: 70error:
71 return(NULL); 71 return NULL;
72} 72}
73 73
74u32 * 74u32 *
@@ -78,12 +78,12 @@ bfad_get_firmware_buf(struct pci_dev *pdev)
78 if (bfi_image_ct_size == 0) 78 if (bfi_image_ct_size == 0)
79 bfad_read_firmware(pdev, &bfi_image_ct, 79 bfad_read_firmware(pdev, &bfi_image_ct,
80 &bfi_image_ct_size, BFAD_FW_FILE_CT); 80 &bfi_image_ct_size, BFAD_FW_FILE_CT);
81 return(bfi_image_ct); 81 return bfi_image_ct;
82 } else { 82 } else {
83 if (bfi_image_cb_size == 0) 83 if (bfi_image_cb_size == 0)
84 bfad_read_firmware(pdev, &bfi_image_cb, 84 bfad_read_firmware(pdev, &bfi_image_cb,
85 &bfi_image_cb_size, BFAD_FW_FILE_CB); 85 &bfi_image_cb_size, BFAD_FW_FILE_CB);
86 return(bfi_image_cb); 86 return bfi_image_cb;
87 } 87 }
88} 88}
89 89
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 55d012a9a668..f788c2a0ab07 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -1050,7 +1050,7 @@ bfad_im_itnim_work_handler(struct work_struct *work)
1050 } else { 1050 } else {
1051 printk(KERN_WARNING 1051 printk(KERN_WARNING
1052 "%s: itnim %llx is already in online state\n", 1052 "%s: itnim %llx is already in online state\n",
1053 __FUNCTION__, 1053 __func__,
1054 bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim)); 1054 bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim));
1055 } 1055 }
1056 1056
diff --git a/drivers/scsi/bfa/bfad_im_compat.h b/drivers/scsi/bfa/bfad_im_compat.h
index 1d3e74ec338c..b36be15044a4 100644
--- a/drivers/scsi/bfa/bfad_im_compat.h
+++ b/drivers/scsi/bfa/bfad_im_compat.h
@@ -31,7 +31,7 @@ u32 *bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
31static inline u32 * 31static inline u32 *
32bfad_load_fwimg(struct pci_dev *pdev) 32bfad_load_fwimg(struct pci_dev *pdev)
33{ 33{
34 return(bfad_get_firmware_buf(pdev)); 34 return bfad_get_firmware_buf(pdev);
35} 35}
36 36
37static inline void 37static inline void
diff --git a/drivers/scsi/bfa/bfad_intr.c b/drivers/scsi/bfa/bfad_intr.c
index f104e029cac9..7de8832f6fee 100644
--- a/drivers/scsi/bfa/bfad_intr.c
+++ b/drivers/scsi/bfa/bfad_intr.c
@@ -23,13 +23,12 @@ BFA_TRC_FILE(LDRV, INTR);
23/** 23/**
24 * bfa_isr BFA driver interrupt functions 24 * bfa_isr BFA driver interrupt functions
25 */ 25 */
26irqreturn_t bfad_intx(int irq, void *dev_id);
27static int msix_disable; 26static int msix_disable;
28module_param(msix_disable, int, S_IRUGO | S_IWUSR); 27module_param(msix_disable, int, S_IRUGO | S_IWUSR);
29/** 28/**
30 * Line based interrupt handler. 29 * Line based interrupt handler.
31 */ 30 */
32irqreturn_t 31static irqreturn_t
33bfad_intx(int irq, void *dev_id) 32bfad_intx(int irq, void *dev_id)
34{ 33{
35 struct bfad_s *bfad = dev_id; 34 struct bfad_s *bfad = dev_id;
diff --git a/drivers/scsi/bfa/fabric.c b/drivers/scsi/bfa/fabric.c
index a8b14c47b009..a4b5dd449573 100644
--- a/drivers/scsi/bfa/fabric.c
+++ b/drivers/scsi/bfa/fabric.c
@@ -36,12 +36,12 @@ BFA_TRC_FILE(FCS, FABRIC);
36#define BFA_FCS_FABRIC_RETRY_DELAY (2000) /* Milliseconds */ 36#define BFA_FCS_FABRIC_RETRY_DELAY (2000) /* Milliseconds */
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_pport_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 \
44 (__fabric)->oper_type = BFA_PPORT_TYPE_NLPORT; \ 44 (__fabric)->oper_type = BFA_PPORT_TYPE_NLPORT; \
45} while (0) 45} while (0)
46 46
47/* 47/*
@@ -887,7 +887,7 @@ bfa_fcs_fabric_modsusp(struct bfa_fcs_s *fcs)
887bfa_boolean_t 887bfa_boolean_t
888bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric) 888bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric)
889{ 889{
890 return (bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_loopback)); 890 return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_loopback);
891} 891}
892 892
893enum bfa_pport_type 893enum bfa_pport_type
@@ -974,7 +974,7 @@ bfa_fcs_fabric_port_delete_comp(struct bfa_fcs_fabric_s *fabric)
974int 974int
975bfa_fcs_fabric_is_online(struct bfa_fcs_fabric_s *fabric) 975bfa_fcs_fabric_is_online(struct bfa_fcs_fabric_s *fabric)
976{ 976{
977 return (bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_online)); 977 return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_online);
978} 978}
979 979
980 980
@@ -1015,7 +1015,7 @@ bfa_fcs_fabric_vport_lookup(struct bfa_fcs_fabric_s *fabric, wwn_t pwwn)
1015u16 1015u16
1016bfa_fcs_fabric_vport_count(struct bfa_fcs_fabric_s *fabric) 1016bfa_fcs_fabric_vport_count(struct bfa_fcs_fabric_s *fabric)
1017{ 1017{
1018 return (fabric->num_vports); 1018 return fabric->num_vports;
1019} 1019}
1020 1020
1021/** 1021/**
diff --git a/drivers/scsi/bfa/fcbuild.c b/drivers/scsi/bfa/fcbuild.c
index d174706b9caa..fee5456451cb 100644
--- a/drivers/scsi/bfa/fcbuild.c
+++ b/drivers/scsi/bfa/fcbuild.c
@@ -188,14 +188,14 @@ fc_els_rsp_parse(struct fchs_s *fchs, int len)
188 switch (els_cmd->els_code) { 188 switch (els_cmd->els_code) {
189 case FC_ELS_LS_RJT: 189 case FC_ELS_LS_RJT:
190 if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY) 190 if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY)
191 return (FC_PARSE_BUSY); 191 return FC_PARSE_BUSY;
192 else 192 else
193 return (FC_PARSE_FAILURE); 193 return FC_PARSE_FAILURE;
194 194
195 case FC_ELS_ACC: 195 case FC_ELS_ACC:
196 return (FC_PARSE_OK); 196 return FC_PARSE_OK;
197 } 197 }
198 return (FC_PARSE_OK); 198 return FC_PARSE_OK;
199} 199}
200 200
201static void 201static void
@@ -228,7 +228,7 @@ fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
228 bfa_os_memcpy(&plogi->port_name, &port_name, sizeof(wwn_t)); 228 bfa_os_memcpy(&plogi->port_name, &port_name, sizeof(wwn_t));
229 bfa_os_memcpy(&plogi->node_name, &node_name, sizeof(wwn_t)); 229 bfa_os_memcpy(&plogi->node_name, &node_name, sizeof(wwn_t));
230 230
231 return (sizeof(struct fc_logi_s)); 231 return sizeof(struct fc_logi_s);
232} 232}
233 233
234u16 234u16
@@ -267,7 +267,7 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
267 flogi->csp.npiv_supp = 1; /* @todo. field name is not correct */ 267 flogi->csp.npiv_supp = 1; /* @todo. field name is not correct */
268 vvl_info[0] = bfa_os_htonl(FLOGI_VVL_BRCD); 268 vvl_info[0] = bfa_os_htonl(FLOGI_VVL_BRCD);
269 269
270 return (sizeof(struct fc_logi_s)); 270 return sizeof(struct fc_logi_s);
271} 271}
272 272
273u16 273u16
@@ -287,7 +287,7 @@ fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
287 287
288 flogi->csp.bbcred = bfa_os_htons(local_bb_credits); 288 flogi->csp.bbcred = bfa_os_htons(local_bb_credits);
289 289
290 return (sizeof(struct fc_logi_s)); 290 return sizeof(struct fc_logi_s);
291} 291}
292 292
293u16 293u16
@@ -306,7 +306,7 @@ fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
306 flogi->port_name = port_name; 306 flogi->port_name = port_name;
307 flogi->node_name = node_name; 307 flogi->node_name = node_name;
308 308
309 return (sizeof(struct fc_logi_s)); 309 return sizeof(struct fc_logi_s);
310} 310}
311 311
312u16 312u16
@@ -338,26 +338,26 @@ fc_plogi_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name)
338 case FC_ELS_LS_RJT: 338 case FC_ELS_LS_RJT:
339 ls_rjt = (struct fc_ls_rjt_s *) (fchs + 1); 339 ls_rjt = (struct fc_ls_rjt_s *) (fchs + 1);
340 if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY) 340 if (ls_rjt->reason_code == FC_LS_RJT_RSN_LOGICAL_BUSY)
341 return (FC_PARSE_BUSY); 341 return FC_PARSE_BUSY;
342 else 342 else
343 return (FC_PARSE_FAILURE); 343 return FC_PARSE_FAILURE;
344 case FC_ELS_ACC: 344 case FC_ELS_ACC:
345 plogi = (struct fc_logi_s *) (fchs + 1); 345 plogi = (struct fc_logi_s *) (fchs + 1);
346 if (len < sizeof(struct fc_logi_s)) 346 if (len < sizeof(struct fc_logi_s))
347 return (FC_PARSE_FAILURE); 347 return FC_PARSE_FAILURE;
348 348
349 if (!wwn_is_equal(plogi->port_name, port_name)) 349 if (!wwn_is_equal(plogi->port_name, port_name))
350 return (FC_PARSE_FAILURE); 350 return FC_PARSE_FAILURE;
351 351
352 if (!plogi->class3.class_valid) 352 if (!plogi->class3.class_valid)
353 return (FC_PARSE_FAILURE); 353 return FC_PARSE_FAILURE;
354 354
355 if (bfa_os_ntohs(plogi->class3.rxsz) < (FC_MIN_PDUSZ)) 355 if (bfa_os_ntohs(plogi->class3.rxsz) < (FC_MIN_PDUSZ))
356 return (FC_PARSE_FAILURE); 356 return FC_PARSE_FAILURE;
357 357
358 return (FC_PARSE_OK); 358 return FC_PARSE_OK;
359 default: 359 default:
360 return (FC_PARSE_FAILURE); 360 return FC_PARSE_FAILURE;
361 } 361 }
362} 362}
363 363
@@ -372,7 +372,7 @@ fc_plogi_parse(struct fchs_s *fchs)
372 if ((bfa_os_ntohs(plogi->class3.rxsz) < FC_MIN_PDUSZ) 372 if ((bfa_os_ntohs(plogi->class3.rxsz) < FC_MIN_PDUSZ)
373 || (bfa_os_ntohs(plogi->class3.rxsz) > FC_MAX_PDUSZ) 373 || (bfa_os_ntohs(plogi->class3.rxsz) > FC_MAX_PDUSZ)
374 || (plogi->class3.rxsz == 0)) 374 || (plogi->class3.rxsz == 0))
375 return (FC_PARSE_FAILURE); 375 return FC_PARSE_FAILURE;
376 376
377 return FC_PARSE_OK; 377 return FC_PARSE_OK;
378} 378}
@@ -393,7 +393,7 @@ fc_prli_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
393 prli->parampage.servparams.task_retry_id = 0; 393 prli->parampage.servparams.task_retry_id = 0;
394 prli->parampage.servparams.confirm = 1; 394 prli->parampage.servparams.confirm = 1;
395 395
396 return (sizeof(struct fc_prli_s)); 396 return sizeof(struct fc_prli_s);
397} 397}
398 398
399u16 399u16
@@ -414,41 +414,41 @@ fc_prli_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
414 414
415 prli->parampage.rspcode = FC_PRLI_ACC_XQTD; 415 prli->parampage.rspcode = FC_PRLI_ACC_XQTD;
416 416
417 return (sizeof(struct fc_prli_s)); 417 return sizeof(struct fc_prli_s);
418} 418}
419 419
420enum fc_parse_status 420enum fc_parse_status
421fc_prli_rsp_parse(struct fc_prli_s *prli, int len) 421fc_prli_rsp_parse(struct fc_prli_s *prli, int len)
422{ 422{
423 if (len < sizeof(struct fc_prli_s)) 423 if (len < sizeof(struct fc_prli_s))
424 return (FC_PARSE_FAILURE); 424 return FC_PARSE_FAILURE;
425 425
426 if (prli->command != FC_ELS_ACC) 426 if (prli->command != FC_ELS_ACC)
427 return (FC_PARSE_FAILURE); 427 return FC_PARSE_FAILURE;
428 428
429 if ((prli->parampage.rspcode != FC_PRLI_ACC_XQTD) 429 if ((prli->parampage.rspcode != FC_PRLI_ACC_XQTD)
430 && (prli->parampage.rspcode != FC_PRLI_ACC_PREDEF_IMG)) 430 && (prli->parampage.rspcode != FC_PRLI_ACC_PREDEF_IMG))
431 return (FC_PARSE_FAILURE); 431 return FC_PARSE_FAILURE;
432 432
433 if (prli->parampage.servparams.target != 1) 433 if (prli->parampage.servparams.target != 1)
434 return (FC_PARSE_FAILURE); 434 return FC_PARSE_FAILURE;
435 435
436 return (FC_PARSE_OK); 436 return FC_PARSE_OK;
437} 437}
438 438
439enum fc_parse_status 439enum fc_parse_status
440fc_prli_parse(struct fc_prli_s *prli) 440fc_prli_parse(struct fc_prli_s *prli)
441{ 441{
442 if (prli->parampage.type != FC_TYPE_FCP) 442 if (prli->parampage.type != FC_TYPE_FCP)
443 return (FC_PARSE_FAILURE); 443 return FC_PARSE_FAILURE;
444 444
445 if (!prli->parampage.imagepair) 445 if (!prli->parampage.imagepair)
446 return (FC_PARSE_FAILURE); 446 return FC_PARSE_FAILURE;
447 447
448 if (!prli->parampage.servparams.initiator) 448 if (!prli->parampage.servparams.initiator)
449 return (FC_PARSE_FAILURE); 449 return FC_PARSE_FAILURE;
450 450
451 return (FC_PARSE_OK); 451 return FC_PARSE_OK;
452} 452}
453 453
454u16 454u16
@@ -462,7 +462,7 @@ fc_logo_build(struct fchs_s *fchs, struct fc_logo_s *logo, u32 d_id,
462 logo->nport_id = (s_id); 462 logo->nport_id = (s_id);
463 logo->orig_port_name = port_name; 463 logo->orig_port_name = port_name;
464 464
465 return (sizeof(struct fc_logo_s)); 465 return sizeof(struct fc_logo_s);
466} 466}
467 467
468static u16 468static u16
@@ -484,7 +484,7 @@ fc_adisc_x_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id,
484 adisc->orig_node_name = node_name; 484 adisc->orig_node_name = node_name;
485 adisc->nport_id = (s_id); 485 adisc->nport_id = (s_id);
486 486
487 return (sizeof(struct fc_adisc_s)); 487 return sizeof(struct fc_adisc_s);
488} 488}
489 489
490u16 490u16
@@ -511,15 +511,15 @@ fc_adisc_rsp_parse(struct fc_adisc_s *adisc, int len, wwn_t port_name,
511{ 511{
512 512
513 if (len < sizeof(struct fc_adisc_s)) 513 if (len < sizeof(struct fc_adisc_s))
514 return (FC_PARSE_FAILURE); 514 return FC_PARSE_FAILURE;
515 515
516 if (adisc->els_cmd.els_code != FC_ELS_ACC) 516 if (adisc->els_cmd.els_code != FC_ELS_ACC)
517 return (FC_PARSE_FAILURE); 517 return FC_PARSE_FAILURE;
518 518
519 if (!wwn_is_equal(adisc->orig_port_name, port_name)) 519 if (!wwn_is_equal(adisc->orig_port_name, port_name))
520 return (FC_PARSE_FAILURE); 520 return FC_PARSE_FAILURE;
521 521
522 return (FC_PARSE_OK); 522 return FC_PARSE_OK;
523} 523}
524 524
525enum fc_parse_status 525enum fc_parse_status
@@ -529,14 +529,14 @@ fc_adisc_parse(struct fchs_s *fchs, void *pld, u32 host_dap,
529 struct fc_adisc_s *adisc = (struct fc_adisc_s *) pld; 529 struct fc_adisc_s *adisc = (struct fc_adisc_s *) pld;
530 530
531 if (adisc->els_cmd.els_code != FC_ELS_ACC) 531 if (adisc->els_cmd.els_code != FC_ELS_ACC)
532 return (FC_PARSE_FAILURE); 532 return FC_PARSE_FAILURE;
533 533
534 if ((adisc->nport_id == (host_dap)) 534 if ((adisc->nport_id == (host_dap))
535 && wwn_is_equal(adisc->orig_port_name, port_name) 535 && wwn_is_equal(adisc->orig_port_name, port_name)
536 && wwn_is_equal(adisc->orig_node_name, node_name)) 536 && wwn_is_equal(adisc->orig_node_name, node_name))
537 return (FC_PARSE_OK); 537 return FC_PARSE_OK;
538 538
539 return (FC_PARSE_FAILURE); 539 return FC_PARSE_FAILURE;
540} 540}
541 541
542enum fc_parse_status 542enum fc_parse_status
@@ -550,13 +550,13 @@ fc_pdisc_parse(struct fchs_s *fchs, wwn_t node_name, wwn_t port_name)
550 if ((bfa_os_ntohs(pdisc->class3.rxsz) < 550 if ((bfa_os_ntohs(pdisc->class3.rxsz) <
551 (FC_MIN_PDUSZ - sizeof(struct fchs_s))) 551 (FC_MIN_PDUSZ - sizeof(struct fchs_s)))
552 || (pdisc->class3.rxsz == 0)) 552 || (pdisc->class3.rxsz == 0))
553 return (FC_PARSE_FAILURE); 553 return FC_PARSE_FAILURE;
554 554
555 if (!wwn_is_equal(pdisc->port_name, port_name)) 555 if (!wwn_is_equal(pdisc->port_name, port_name))
556 return (FC_PARSE_FAILURE); 556 return FC_PARSE_FAILURE;
557 557
558 if (!wwn_is_equal(pdisc->node_name, node_name)) 558 if (!wwn_is_equal(pdisc->node_name, node_name))
559 return (FC_PARSE_FAILURE); 559 return FC_PARSE_FAILURE;
560 560
561 return FC_PARSE_OK; 561 return FC_PARSE_OK;
562} 562}
@@ -570,7 +570,7 @@ fc_abts_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id)
570 fchs->s_id = (s_id); 570 fchs->s_id = (s_id);
571 fchs->ox_id = bfa_os_htons(ox_id); 571 fchs->ox_id = bfa_os_htons(ox_id);
572 572
573 return (sizeof(struct fchs_s)); 573 return sizeof(struct fchs_s);
574} 574}
575 575
576enum fc_parse_status 576enum fc_parse_status
@@ -578,9 +578,9 @@ fc_abts_rsp_parse(struct fchs_s *fchs, int len)
578{ 578{
579 if ((fchs->cat_info == FC_CAT_BA_ACC) 579 if ((fchs->cat_info == FC_CAT_BA_ACC)
580 || (fchs->cat_info == FC_CAT_BA_RJT)) 580 || (fchs->cat_info == FC_CAT_BA_RJT))
581 return (FC_PARSE_OK); 581 return FC_PARSE_OK;
582 582
583 return (FC_PARSE_FAILURE); 583 return FC_PARSE_FAILURE;
584} 584}
585 585
586u16 586u16
@@ -597,7 +597,7 @@ fc_rrq_build(struct fchs_s *fchs, struct fc_rrq_s *rrq, u32 d_id,
597 rrq->ox_id = bfa_os_htons(rrq_oxid); 597 rrq->ox_id = bfa_os_htons(rrq_oxid);
598 rrq->rx_id = FC_RXID_ANY; 598 rrq->rx_id = FC_RXID_ANY;
599 599
600 return (sizeof(struct fc_rrq_s)); 600 return sizeof(struct fc_rrq_s);
601} 601}
602 602
603u16 603u16
@@ -611,7 +611,7 @@ fc_logo_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
611 memset(acc, 0, sizeof(struct fc_els_cmd_s)); 611 memset(acc, 0, sizeof(struct fc_els_cmd_s));
612 acc->els_code = FC_ELS_ACC; 612 acc->els_code = FC_ELS_ACC;
613 613
614 return (sizeof(struct fc_els_cmd_s)); 614 return sizeof(struct fc_els_cmd_s);
615} 615}
616 616
617u16 617u16
@@ -627,7 +627,7 @@ fc_ls_rjt_build(struct fchs_s *fchs, struct fc_ls_rjt_s *ls_rjt, u32 d_id,
627 ls_rjt->reason_code_expl = reason_code_expl; 627 ls_rjt->reason_code_expl = reason_code_expl;
628 ls_rjt->vendor_unique = 0x00; 628 ls_rjt->vendor_unique = 0x00;
629 629
630 return (sizeof(struct fc_ls_rjt_s)); 630 return sizeof(struct fc_ls_rjt_s);
631} 631}
632 632
633u16 633u16
@@ -643,7 +643,7 @@ fc_ba_acc_build(struct fchs_s *fchs, struct fc_ba_acc_s *ba_acc, u32 d_id,
643 ba_acc->ox_id = fchs->ox_id; 643 ba_acc->ox_id = fchs->ox_id;
644 ba_acc->rx_id = fchs->rx_id; 644 ba_acc->rx_id = fchs->rx_id;
645 645
646 return (sizeof(struct fc_ba_acc_s)); 646 return sizeof(struct fc_ba_acc_s);
647} 647}
648 648
649u16 649u16
@@ -654,7 +654,7 @@ fc_ls_acc_build(struct fchs_s *fchs, struct fc_els_cmd_s *els_cmd,
654 memset(els_cmd, 0, sizeof(struct fc_els_cmd_s)); 654 memset(els_cmd, 0, sizeof(struct fc_els_cmd_s));
655 els_cmd->els_code = FC_ELS_ACC; 655 els_cmd->els_code = FC_ELS_ACC;
656 656
657 return (sizeof(struct fc_els_cmd_s)); 657 return sizeof(struct fc_els_cmd_s);
658} 658}
659 659
660int 660int
@@ -696,7 +696,7 @@ fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc,
696 tprlo_acc->tprlo_acc_params[page].orig_process_assc = 0; 696 tprlo_acc->tprlo_acc_params[page].orig_process_assc = 0;
697 tprlo_acc->tprlo_acc_params[page].resp_process_assc = 0; 697 tprlo_acc->tprlo_acc_params[page].resp_process_assc = 0;
698 } 698 }
699 return (bfa_os_ntohs(tprlo_acc->payload_len)); 699 return bfa_os_ntohs(tprlo_acc->payload_len);
700} 700}
701 701
702u16 702u16
@@ -721,7 +721,7 @@ fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc,
721 prlo_acc->prlo_acc_params[page].resp_process_assc = 0; 721 prlo_acc->prlo_acc_params[page].resp_process_assc = 0;
722 } 722 }
723 723
724 return (bfa_os_ntohs(prlo_acc->payload_len)); 724 return bfa_os_ntohs(prlo_acc->payload_len);
725} 725}
726 726
727u16 727u16
@@ -735,7 +735,7 @@ fc_rnid_build(struct fchs_s *fchs, struct fc_rnid_cmd_s *rnid, u32 d_id,
735 rnid->els_cmd.els_code = FC_ELS_RNID; 735 rnid->els_cmd.els_code = FC_ELS_RNID;
736 rnid->node_id_data_format = data_format; 736 rnid->node_id_data_format = data_format;
737 737
738 return (sizeof(struct fc_rnid_cmd_s)); 738 return sizeof(struct fc_rnid_cmd_s);
739} 739}
740 740
741u16 741u16
@@ -759,10 +759,10 @@ fc_rnid_acc_build(struct fchs_s *fchs, struct fc_rnid_acc_s *rnid_acc,
759 rnid_acc->specific_id_data_length = 759 rnid_acc->specific_id_data_length =
760 sizeof(struct fc_rnid_general_topology_data_s); 760 sizeof(struct fc_rnid_general_topology_data_s);
761 bfa_os_assign(rnid_acc->gen_topology_data, *gen_topo_data); 761 bfa_os_assign(rnid_acc->gen_topology_data, *gen_topo_data);
762 return (sizeof(struct fc_rnid_acc_s)); 762 return sizeof(struct fc_rnid_acc_s);
763 } else { 763 } else {
764 return (sizeof(struct fc_rnid_acc_s) - 764 return sizeof(struct fc_rnid_acc_s) -
765 sizeof(struct fc_rnid_general_topology_data_s)); 765 sizeof(struct fc_rnid_general_topology_data_s);
766 } 766 }
767 767
768} 768}
@@ -776,7 +776,7 @@ fc_rpsc_build(struct fchs_s *fchs, struct fc_rpsc_cmd_s *rpsc, u32 d_id,
776 memset(rpsc, 0, sizeof(struct fc_rpsc_cmd_s)); 776 memset(rpsc, 0, sizeof(struct fc_rpsc_cmd_s));
777 777
778 rpsc->els_cmd.els_code = FC_ELS_RPSC; 778 rpsc->els_cmd.els_code = FC_ELS_RPSC;
779 return (sizeof(struct fc_rpsc_cmd_s)); 779 return sizeof(struct fc_rpsc_cmd_s);
780} 780}
781 781
782u16 782u16
@@ -797,8 +797,8 @@ fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2,
797 for (i = 0; i < npids; i++) 797 for (i = 0; i < npids; i++)
798 rpsc2->pid_list[i].pid = pid_list[i]; 798 rpsc2->pid_list[i].pid = pid_list[i];
799 799
800 return (sizeof(struct fc_rpsc2_cmd_s) + ((npids - 1) * 800 return sizeof(struct fc_rpsc2_cmd_s) + ((npids - 1) *
801 (sizeof(u32)))); 801 (sizeof(u32)));
802} 802}
803 803
804u16 804u16
@@ -819,7 +819,7 @@ fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc,
819 rpsc_acc->speed_info[0].port_op_speed = 819 rpsc_acc->speed_info[0].port_op_speed =
820 bfa_os_htons(oper_speed->port_op_speed); 820 bfa_os_htons(oper_speed->port_op_speed);
821 821
822 return (sizeof(struct fc_rpsc_acc_s)); 822 return sizeof(struct fc_rpsc_acc_s);
823 823
824} 824}
825 825
@@ -856,7 +856,7 @@ fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
856 pdisc->port_name = port_name; 856 pdisc->port_name = port_name;
857 pdisc->node_name = node_name; 857 pdisc->node_name = node_name;
858 858
859 return (sizeof(struct fc_logi_s)); 859 return sizeof(struct fc_logi_s);
860} 860}
861 861
862u16 862u16
@@ -865,21 +865,21 @@ fc_pdisc_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name)
865 struct fc_logi_s *pdisc = (struct fc_logi_s *) (fchs + 1); 865 struct fc_logi_s *pdisc = (struct fc_logi_s *) (fchs + 1);
866 866
867 if (len < sizeof(struct fc_logi_s)) 867 if (len < sizeof(struct fc_logi_s))
868 return (FC_PARSE_LEN_INVAL); 868 return FC_PARSE_LEN_INVAL;
869 869
870 if (pdisc->els_cmd.els_code != FC_ELS_ACC) 870 if (pdisc->els_cmd.els_code != FC_ELS_ACC)
871 return (FC_PARSE_ACC_INVAL); 871 return FC_PARSE_ACC_INVAL;
872 872
873 if (!wwn_is_equal(pdisc->port_name, port_name)) 873 if (!wwn_is_equal(pdisc->port_name, port_name))
874 return (FC_PARSE_PWWN_NOT_EQUAL); 874 return FC_PARSE_PWWN_NOT_EQUAL;
875 875
876 if (!pdisc->class3.class_valid) 876 if (!pdisc->class3.class_valid)
877 return (FC_PARSE_NWWN_NOT_EQUAL); 877 return FC_PARSE_NWWN_NOT_EQUAL;
878 878
879 if (bfa_os_ntohs(pdisc->class3.rxsz) < (FC_MIN_PDUSZ)) 879 if (bfa_os_ntohs(pdisc->class3.rxsz) < (FC_MIN_PDUSZ))
880 return (FC_PARSE_RXSZ_INVAL); 880 return FC_PARSE_RXSZ_INVAL;
881 881
882 return (FC_PARSE_OK); 882 return FC_PARSE_OK;
883} 883}
884 884
885u16 885u16
@@ -903,7 +903,7 @@ fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
903 prlo->prlo_params[page].resp_process_assc = 0; 903 prlo->prlo_params[page].resp_process_assc = 0;
904 } 904 }
905 905
906 return (bfa_os_ntohs(prlo->payload_len)); 906 return bfa_os_ntohs(prlo->payload_len);
907} 907}
908 908
909u16 909u16
@@ -916,7 +916,7 @@ fc_prlo_rsp_parse(struct fchs_s *fchs, int len)
916 len = len; 916 len = len;
917 917
918 if (prlo->command != FC_ELS_ACC) 918 if (prlo->command != FC_ELS_ACC)
919 return (FC_PARSE_FAILURE); 919 return FC_PARSE_FAILURE;
920 920
921 num_pages = ((bfa_os_ntohs(prlo->payload_len)) - 4) / 16; 921 num_pages = ((bfa_os_ntohs(prlo->payload_len)) - 4) / 16;
922 922
@@ -936,7 +936,7 @@ fc_prlo_rsp_parse(struct fchs_s *fchs, int len)
936 if (prlo->prlo_acc_params[page].resp_process_assc != 0) 936 if (prlo->prlo_acc_params[page].resp_process_assc != 0)
937 return FC_PARSE_FAILURE; 937 return FC_PARSE_FAILURE;
938 } 938 }
939 return (FC_PARSE_OK); 939 return FC_PARSE_OK;
940 940
941} 941}
942 942
@@ -968,7 +968,7 @@ fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
968 } 968 }
969 } 969 }
970 970
971 return (bfa_os_ntohs(tprlo->payload_len)); 971 return bfa_os_ntohs(tprlo->payload_len);
972} 972}
973 973
974u16 974u16
@@ -981,23 +981,23 @@ fc_tprlo_rsp_parse(struct fchs_s *fchs, int len)
981 len = len; 981 len = len;
982 982
983 if (tprlo->command != FC_ELS_ACC) 983 if (tprlo->command != FC_ELS_ACC)
984 return (FC_PARSE_ACC_INVAL); 984 return FC_PARSE_ACC_INVAL;
985 985
986 num_pages = (bfa_os_ntohs(tprlo->payload_len) - 4) / 16; 986 num_pages = (bfa_os_ntohs(tprlo->payload_len) - 4) / 16;
987 987
988 for (page = 0; page < num_pages; page++) { 988 for (page = 0; page < num_pages; page++) {
989 if (tprlo->tprlo_acc_params[page].type != FC_TYPE_FCP) 989 if (tprlo->tprlo_acc_params[page].type != FC_TYPE_FCP)
990 return (FC_PARSE_NOT_FCP); 990 return FC_PARSE_NOT_FCP;
991 if (tprlo->tprlo_acc_params[page].opa_valid != 0) 991 if (tprlo->tprlo_acc_params[page].opa_valid != 0)
992 return (FC_PARSE_OPAFLAG_INVAL); 992 return FC_PARSE_OPAFLAG_INVAL;
993 if (tprlo->tprlo_acc_params[page].rpa_valid != 0) 993 if (tprlo->tprlo_acc_params[page].rpa_valid != 0)
994 return (FC_PARSE_RPAFLAG_INVAL); 994 return FC_PARSE_RPAFLAG_INVAL;
995 if (tprlo->tprlo_acc_params[page].orig_process_assc != 0) 995 if (tprlo->tprlo_acc_params[page].orig_process_assc != 0)
996 return (FC_PARSE_OPA_INVAL); 996 return FC_PARSE_OPA_INVAL;
997 if (tprlo->tprlo_acc_params[page].resp_process_assc != 0) 997 if (tprlo->tprlo_acc_params[page].resp_process_assc != 0)
998 return (FC_PARSE_RPA_INVAL); 998 return FC_PARSE_RPA_INVAL;
999 } 999 }
1000 return (FC_PARSE_OK); 1000 return FC_PARSE_OK;
1001} 1001}
1002 1002
1003enum fc_parse_status 1003enum fc_parse_status
@@ -1024,7 +1024,7 @@ fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id,
1024 fchs->cat_info = FC_CAT_BA_RJT; 1024 fchs->cat_info = FC_CAT_BA_RJT;
1025 ba_rjt->reason_code = reason_code; 1025 ba_rjt->reason_code = reason_code;
1026 ba_rjt->reason_expl = reason_expl; 1026 ba_rjt->reason_expl = reason_expl;
1027 return (sizeof(struct fc_ba_rjt_s)); 1027 return sizeof(struct fc_ba_rjt_s);
1028} 1028}
1029 1029
1030static void 1030static void
@@ -1073,7 +1073,7 @@ fc_gidpn_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1073 1073
1074 bfa_os_memset(gidpn, 0, sizeof(struct fcgs_gidpn_req_s)); 1074 bfa_os_memset(gidpn, 0, sizeof(struct fcgs_gidpn_req_s));
1075 gidpn->port_name = port_name; 1075 gidpn->port_name = port_name;
1076 return (sizeof(struct fcgs_gidpn_req_s) + sizeof(struct ct_hdr_s)); 1076 return sizeof(struct fcgs_gidpn_req_s) + sizeof(struct ct_hdr_s);
1077} 1077}
1078 1078
1079u16 1079u16
@@ -1090,7 +1090,7 @@ fc_gpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1090 1090
1091 bfa_os_memset(gpnid, 0, sizeof(fcgs_gpnid_req_t)); 1091 bfa_os_memset(gpnid, 0, sizeof(fcgs_gpnid_req_t));
1092 gpnid->dap = port_id; 1092 gpnid->dap = port_id;
1093 return (sizeof(fcgs_gpnid_req_t) + sizeof(struct ct_hdr_s)); 1093 return sizeof(fcgs_gpnid_req_t) + sizeof(struct ct_hdr_s);
1094} 1094}
1095 1095
1096u16 1096u16
@@ -1107,7 +1107,7 @@ fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1107 1107
1108 bfa_os_memset(gnnid, 0, sizeof(fcgs_gnnid_req_t)); 1108 bfa_os_memset(gnnid, 0, sizeof(fcgs_gnnid_req_t));
1109 gnnid->dap = port_id; 1109 gnnid->dap = port_id;
1110 return (sizeof(fcgs_gnnid_req_t) + sizeof(struct ct_hdr_s)); 1110 return sizeof(fcgs_gnnid_req_t) + sizeof(struct ct_hdr_s);
1111} 1111}
1112 1112
1113u16 1113u16
@@ -1137,7 +1137,7 @@ fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr, u8 set_br_reg,
1137 if (set_br_reg) 1137 if (set_br_reg)
1138 scr->vu_reg_func = FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE; 1138 scr->vu_reg_func = FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE;
1139 1139
1140 return (sizeof(struct fc_scr_s)); 1140 return sizeof(struct fc_scr_s);
1141} 1141}
1142 1142
1143u16 1143u16
@@ -1157,7 +1157,7 @@ fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn, u32 s_id,
1157 rscn->event[0].format = FC_RSCN_FORMAT_PORTID; 1157 rscn->event[0].format = FC_RSCN_FORMAT_PORTID;
1158 rscn->event[0].portid = s_id; 1158 rscn->event[0].portid = s_id;
1159 1159
1160 return (sizeof(struct fc_rscn_pl_s)); 1160 return sizeof(struct fc_rscn_pl_s);
1161} 1161}
1162 1162
1163u16 1163u16
@@ -1188,7 +1188,7 @@ fc_rftid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1188 rftid->fc4_type[index] |= bfa_os_htonl(type_value); 1188 rftid->fc4_type[index] |= bfa_os_htonl(type_value);
1189 } 1189 }
1190 1190
1191 return (sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s)); 1191 return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s);
1192} 1192}
1193 1193
1194u16 1194u16
@@ -1210,7 +1210,7 @@ fc_rftid_build_sol(struct fchs_s *fchs, void *pyld, u32 s_id,
1210 bfa_os_memcpy((void *)rftid->fc4_type, (void *)fc4_bitmap, 1210 bfa_os_memcpy((void *)rftid->fc4_type, (void *)fc4_bitmap,
1211 (bitmap_size < 32 ? bitmap_size : 32)); 1211 (bitmap_size < 32 ? bitmap_size : 32));
1212 1212
1213 return (sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s)); 1213 return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s);
1214} 1214}
1215 1215
1216u16 1216u16
@@ -1231,7 +1231,7 @@ fc_rffid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1231 rffid->fc4ftr_bits = fc4_ftrs; 1231 rffid->fc4ftr_bits = fc4_ftrs;
1232 rffid->fc4_type = fc4_type; 1232 rffid->fc4_type = fc4_type;
1233 1233
1234 return (sizeof(struct fcgs_rffid_req_s) + sizeof(struct ct_hdr_s)); 1234 return sizeof(struct fcgs_rffid_req_s) + sizeof(struct ct_hdr_s);
1235} 1235}
1236 1236
1237u16 1237u16
@@ -1253,7 +1253,7 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1253 rspnid->spn_len = (u8) strlen((char *)name); 1253 rspnid->spn_len = (u8) strlen((char *)name);
1254 strncpy((char *)rspnid->spn, (char *)name, rspnid->spn_len); 1254 strncpy((char *)rspnid->spn, (char *)name, rspnid->spn_len);
1255 1255
1256 return (sizeof(struct fcgs_rspnid_req_s) + sizeof(struct ct_hdr_s)); 1256 return sizeof(struct fcgs_rspnid_req_s) + sizeof(struct ct_hdr_s);
1257} 1257}
1258 1258
1259u16 1259u16
@@ -1275,7 +1275,7 @@ fc_gid_ft_build(struct fchs_s *fchs, void *pyld, u32 s_id,
1275 gidft->domain_id = 0; 1275 gidft->domain_id = 0;
1276 gidft->area_id = 0; 1276 gidft->area_id = 0;
1277 1277
1278 return (sizeof(struct fcgs_gidft_req_s) + sizeof(struct ct_hdr_s)); 1278 return sizeof(struct fcgs_gidft_req_s) + sizeof(struct ct_hdr_s);
1279} 1279}
1280 1280
1281u16 1281u16
@@ -1294,7 +1294,7 @@ fc_rpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1294 rpnid->port_id = port_id; 1294 rpnid->port_id = port_id;
1295 rpnid->port_name = port_name; 1295 rpnid->port_name = port_name;
1296 1296
1297 return (sizeof(struct fcgs_rpnid_req_s) + sizeof(struct ct_hdr_s)); 1297 return sizeof(struct fcgs_rpnid_req_s) + sizeof(struct ct_hdr_s);
1298} 1298}
1299 1299
1300u16 1300u16
@@ -1313,7 +1313,7 @@ fc_rnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1313 rnnid->port_id = port_id; 1313 rnnid->port_id = port_id;
1314 rnnid->node_name = node_name; 1314 rnnid->node_name = node_name;
1315 1315
1316 return (sizeof(struct fcgs_rnnid_req_s) + sizeof(struct ct_hdr_s)); 1316 return sizeof(struct fcgs_rnnid_req_s) + sizeof(struct ct_hdr_s);
1317} 1317}
1318 1318
1319u16 1319u16
@@ -1332,7 +1332,7 @@ fc_rcsid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1332 rcsid->port_id = port_id; 1332 rcsid->port_id = port_id;
1333 rcsid->cos = cos; 1333 rcsid->cos = cos;
1334 1334
1335 return (sizeof(struct fcgs_rcsid_req_s) + sizeof(struct ct_hdr_s)); 1335 return sizeof(struct fcgs_rcsid_req_s) + sizeof(struct ct_hdr_s);
1336} 1336}
1337 1337
1338u16 1338u16
@@ -1351,7 +1351,7 @@ fc_rptid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1351 rptid->port_id = port_id; 1351 rptid->port_id = port_id;
1352 rptid->port_type = port_type; 1352 rptid->port_type = port_type;
1353 1353
1354 return (sizeof(struct fcgs_rptid_req_s) + sizeof(struct ct_hdr_s)); 1354 return sizeof(struct fcgs_rptid_req_s) + sizeof(struct ct_hdr_s);
1355} 1355}
1356 1356
1357u16 1357u16
@@ -1368,7 +1368,7 @@ fc_ganxt_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id)
1368 bfa_os_memset(ganxt, 0, sizeof(struct fcgs_ganxt_req_s)); 1368 bfa_os_memset(ganxt, 0, sizeof(struct fcgs_ganxt_req_s));
1369 ganxt->port_id = port_id; 1369 ganxt->port_id = port_id;
1370 1370
1371 return (sizeof(struct ct_hdr_s) + sizeof(struct fcgs_ganxt_req_s)); 1371 return sizeof(struct ct_hdr_s) + sizeof(struct fcgs_ganxt_req_s);
1372} 1372}
1373 1373
1374/* 1374/*
@@ -1385,7 +1385,7 @@ fc_fdmi_reqhdr_build(struct fchs_s *fchs, void *pyld, u32 s_id,
1385 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1385 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1386 fc_gs_fdmi_cthdr_build(cthdr, s_id, cmd_code); 1386 fc_gs_fdmi_cthdr_build(cthdr, s_id, cmd_code);
1387 1387
1388 return (sizeof(struct ct_hdr_s)); 1388 return sizeof(struct ct_hdr_s);
1389} 1389}
1390 1390
1391/* 1391/*
@@ -1425,7 +1425,7 @@ fc_gmal_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn)
1425 bfa_os_memset(gmal, 0, sizeof(fcgs_gmal_req_t)); 1425 bfa_os_memset(gmal, 0, sizeof(fcgs_gmal_req_t));
1426 gmal->wwn = wwn; 1426 gmal->wwn = wwn;
1427 1427
1428 return (sizeof(struct ct_hdr_s) + sizeof(fcgs_gmal_req_t)); 1428 return sizeof(struct ct_hdr_s) + sizeof(fcgs_gmal_req_t);
1429} 1429}
1430 1430
1431/* 1431/*
@@ -1445,5 +1445,5 @@ fc_gfn_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn)
1445 bfa_os_memset(gfn, 0, sizeof(fcgs_gfn_req_t)); 1445 bfa_os_memset(gfn, 0, sizeof(fcgs_gfn_req_t));
1446 gfn->wwn = wwn; 1446 gfn->wwn = wwn;
1447 1447
1448 return (sizeof(struct ct_hdr_s) + sizeof(fcgs_gfn_req_t)); 1448 return sizeof(struct ct_hdr_s) + sizeof(fcgs_gfn_req_t);
1449} 1449}
diff --git a/drivers/scsi/bfa/fcbuild.h b/drivers/scsi/bfa/fcbuild.h
index 4d248424f7b3..8fa7f270ef7b 100644
--- a/drivers/scsi/bfa/fcbuild.h
+++ b/drivers/scsi/bfa/fcbuild.h
@@ -32,8 +32,8 @@
32 * Utility Macros/functions 32 * Utility Macros/functions
33 */ 33 */
34 34
35#define fcif_sof_set(_ifhdr, _sof) (_ifhdr)->sof = FC_ ## _sof 35#define fcif_sof_set(_ifhdr, _sof) ((_ifhdr)->sof = FC_ ## _sof)
36#define fcif_eof_set(_ifhdr, _eof) (_ifhdr)->eof = FC_ ## _eof 36#define fcif_eof_set(_ifhdr, _eof) ((_ifhdr)->eof = FC_ ## _eof)
37 37
38#define wwn_is_equal(_wwn1, _wwn2) \ 38#define wwn_is_equal(_wwn1, _wwn2) \
39 (memcmp(&(_wwn1), &(_wwn2), sizeof(wwn_t)) == 0) 39 (memcmp(&(_wwn1), &(_wwn2), sizeof(wwn_t)) == 0)
@@ -49,7 +49,7 @@
49static inline u32 49static inline u32
50fc_get_ctresp_pyld_len(u32 resp_len) 50fc_get_ctresp_pyld_len(u32 resp_len)
51{ 51{
52 return (resp_len - sizeof(struct ct_hdr_s)); 52 return resp_len - sizeof(struct ct_hdr_s);
53} 53}
54 54
55/* 55/*
diff --git a/drivers/scsi/bfa/fcpim.c b/drivers/scsi/bfa/fcpim.c
index 8ce5d8934677..1f3c06efaa9e 100644
--- a/drivers/scsi/bfa/fcpim.c
+++ b/drivers/scsi/bfa/fcpim.c
@@ -286,11 +286,10 @@ bfa_fcs_itnim_sm_online(struct bfa_fcs_itnim_s *itnim,
286 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_hcb_offline); 286 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_hcb_offline);
287 bfa_fcb_itnim_offline(itnim->itnim_drv); 287 bfa_fcb_itnim_offline(itnim->itnim_drv);
288 bfa_itnim_offline(itnim->bfa_itnim); 288 bfa_itnim_offline(itnim->bfa_itnim);
289 if (bfa_fcs_port_is_online(itnim->rport->port) == BFA_TRUE) { 289 if (bfa_fcs_port_is_online(itnim->rport->port) == BFA_TRUE)
290 bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_DISCONNECT); 290 bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_DISCONNECT);
291 } else { 291 else
292 bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_OFFLINE); 292 bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_OFFLINE);
293 }
294 break; 293 break;
295 294
296 case BFA_FCS_ITNIM_SM_DELETE: 295 case BFA_FCS_ITNIM_SM_DELETE:
@@ -732,7 +731,7 @@ bfa_fcs_itnim_lookup(struct bfa_fcs_port_s *port, wwn_t rpwwn)
732 return NULL; 731 return NULL;
733 732
734 bfa_assert(rport->itnim != NULL); 733 bfa_assert(rport->itnim != NULL);
735 return (rport->itnim); 734 return rport->itnim;
736} 735}
737 736
738bfa_status_t 737bfa_status_t
diff --git a/drivers/scsi/bfa/fcs.h b/drivers/scsi/bfa/fcs.h
index deee685e8478..8d08230e6295 100644
--- a/drivers/scsi/bfa/fcs.h
+++ b/drivers/scsi/bfa/fcs.h
@@ -23,7 +23,7 @@
23#ifndef __FCS_H__ 23#ifndef __FCS_H__
24#define __FCS_H__ 24#define __FCS_H__
25 25
26#define __fcs_min_cfg(__fcs) (__fcs)->min_cfg 26#define __fcs_min_cfg(__fcs) ((__fcs)->min_cfg)
27 27
28void bfa_fcs_modexit_comp(struct bfa_fcs_s *fcs); 28void bfa_fcs_modexit_comp(struct bfa_fcs_s *fcs);
29 29
diff --git a/drivers/scsi/bfa/fdmi.c b/drivers/scsi/bfa/fdmi.c
index b845eb272c78..df2a1e54e16b 100644
--- a/drivers/scsi/bfa/fdmi.c
+++ b/drivers/scsi/bfa/fdmi.c
@@ -72,9 +72,9 @@ static u16 bfa_fcs_port_fdmi_build_rpa_pyld(
72 struct bfa_fcs_port_fdmi_s *fdmi, u8 *pyld); 72 struct bfa_fcs_port_fdmi_s *fdmi, u8 *pyld);
73static u16 bfa_fcs_port_fdmi_build_portattr_block( 73static u16 bfa_fcs_port_fdmi_build_portattr_block(
74 struct bfa_fcs_port_fdmi_s *fdmi, u8 *pyld); 74 struct bfa_fcs_port_fdmi_s *fdmi, u8 *pyld);
75void bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_port_fdmi_s *fdmi, 75static void bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_port_fdmi_s *fdmi,
76 struct bfa_fcs_fdmi_hba_attr_s *hba_attr); 76 struct bfa_fcs_fdmi_hba_attr_s *hba_attr);
77void bfa_fcs_fdmi_get_portattr(struct bfa_fcs_port_fdmi_s *fdmi, 77static void bfa_fcs_fdmi_get_portattr(struct bfa_fcs_port_fdmi_s *fdmi,
78 struct bfa_fcs_fdmi_port_attr_s *port_attr); 78 struct bfa_fcs_fdmi_port_attr_s *port_attr);
79/** 79/**
80 * fcs_fdmi_sm FCS FDMI state machine 80 * fcs_fdmi_sm FCS FDMI state machine
@@ -1091,7 +1091,7 @@ bfa_fcs_port_fdmi_timeout(void *arg)
1091 bfa_sm_send_event(fdmi, FDMISM_EVENT_TIMEOUT); 1091 bfa_sm_send_event(fdmi, FDMISM_EVENT_TIMEOUT);
1092} 1092}
1093 1093
1094void 1094static void
1095bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_port_fdmi_s *fdmi, 1095bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_port_fdmi_s *fdmi,
1096 struct bfa_fcs_fdmi_hba_attr_s *hba_attr) 1096 struct bfa_fcs_fdmi_hba_attr_s *hba_attr)
1097{ 1097{
@@ -1145,7 +1145,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_port_fdmi_s *fdmi,
1145 1145
1146} 1146}
1147 1147
1148void 1148static void
1149bfa_fcs_fdmi_get_portattr(struct bfa_fcs_port_fdmi_s *fdmi, 1149bfa_fcs_fdmi_get_portattr(struct bfa_fcs_port_fdmi_s *fdmi,
1150 struct bfa_fcs_fdmi_port_attr_s *port_attr) 1150 struct bfa_fcs_fdmi_port_attr_s *port_attr)
1151{ 1151{
diff --git a/drivers/scsi/bfa/include/aen/bfa_aen.h b/drivers/scsi/bfa/include/aen/bfa_aen.h
index da8cac093d3d..d9cbc2a783d4 100644
--- a/drivers/scsi/bfa/include/aen/bfa_aen.h
+++ b/drivers/scsi/bfa/include/aen/bfa_aen.h
@@ -54,7 +54,7 @@ bfa_aen_get_max_cfg_entry(void)
54static inline s32 54static inline s32
55bfa_aen_get_meminfo(void) 55bfa_aen_get_meminfo(void)
56{ 56{
57 return (sizeof(struct bfa_aen_entry_s) * bfa_aen_get_max_cfg_entry()); 57 return sizeof(struct bfa_aen_entry_s) * bfa_aen_get_max_cfg_entry();
58} 58}
59 59
60static inline s32 60static inline s32
diff --git a/drivers/scsi/bfa/include/bfa.h b/drivers/scsi/bfa/include/bfa.h
index 64c1412c5703..d4bc0d9fa42c 100644
--- a/drivers/scsi/bfa/include/bfa.h
+++ b/drivers/scsi/bfa/include/bfa.h
@@ -76,11 +76,11 @@ struct bfa_meminfo_s {
76 struct bfa_mem_elem_s meminfo[BFA_MEM_TYPE_MAX]; 76 struct bfa_mem_elem_s meminfo[BFA_MEM_TYPE_MAX];
77}; 77};
78#define bfa_meminfo_kva(_m) \ 78#define bfa_meminfo_kva(_m) \
79 (_m)->meminfo[BFA_MEM_TYPE_KVA - 1].kva_curp 79 ((_m)->meminfo[BFA_MEM_TYPE_KVA - 1].kva_curp)
80#define bfa_meminfo_dma_virt(_m) \ 80#define bfa_meminfo_dma_virt(_m) \
81 (_m)->meminfo[BFA_MEM_TYPE_DMA - 1].kva_curp 81 ((_m)->meminfo[BFA_MEM_TYPE_DMA - 1].kva_curp)
82#define bfa_meminfo_dma_phys(_m) \ 82#define bfa_meminfo_dma_phys(_m) \
83 (_m)->meminfo[BFA_MEM_TYPE_DMA - 1].dma_curp 83 ((_m)->meminfo[BFA_MEM_TYPE_DMA - 1].dma_curp)
84 84
85/** 85/**
86 * Generic Scatter Gather Element used by driver 86 * Generic Scatter Gather Element used by driver
@@ -100,7 +100,7 @@ struct bfa_sge_s {
100/* 100/*
101 * bfa stats interfaces 101 * bfa stats interfaces
102 */ 102 */
103#define bfa_stats(_mod, _stats) (_mod)->stats._stats ++ 103#define bfa_stats(_mod, _stats) ((_mod)->stats._stats++)
104 104
105#define bfa_ioc_get_stats(__bfa, __ioc_stats) \ 105#define bfa_ioc_get_stats(__bfa, __ioc_stats) \
106 bfa_ioc_fetch_stats(&(__bfa)->ioc, __ioc_stats) 106 bfa_ioc_fetch_stats(&(__bfa)->ioc, __ioc_stats)
@@ -136,7 +136,7 @@ void bfa_isr_enable(struct bfa_s *bfa);
136void bfa_isr_disable(struct bfa_s *bfa); 136void bfa_isr_disable(struct bfa_s *bfa);
137void bfa_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap, 137void bfa_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap,
138 u32 *num_vecs, u32 *max_vec_bit); 138 u32 *num_vecs, u32 *max_vec_bit);
139#define bfa_msix(__bfa, __vec) (__bfa)->msix.handler[__vec](__bfa, __vec) 139#define bfa_msix(__bfa, __vec) ((__bfa)->msix.handler[__vec](__bfa, __vec))
140 140
141void bfa_comp_deq(struct bfa_s *bfa, struct list_head *comp_q); 141void bfa_comp_deq(struct bfa_s *bfa, struct list_head *comp_q);
142void bfa_comp_process(struct bfa_s *bfa, struct list_head *comp_q); 142void bfa_comp_process(struct bfa_s *bfa, struct list_head *comp_q);
diff --git a/drivers/scsi/bfa/include/bfa_svc.h b/drivers/scsi/bfa/include/bfa_svc.h
index 0c80b74f72ef..268d956bad89 100644
--- a/drivers/scsi/bfa/include/bfa_svc.h
+++ b/drivers/scsi/bfa/include/bfa_svc.h
@@ -34,10 +34,10 @@ struct bfa_fcxp_s;
34 */ 34 */
35struct bfa_rport_info_s { 35struct bfa_rport_info_s {
36 u16 max_frmsz; /* max rcv pdu size */ 36 u16 max_frmsz; /* max rcv pdu size */
37 u32 pid : 24, /* remote port ID */ 37 u32 pid:24, /* remote port ID */
38 lp_tag : 8; 38 lp_tag:8;
39 u32 local_pid : 24, /* local port ID */ 39 u32 local_pid:24, /* local port ID */
40 cisc : 8; /* CIRO supported */ 40 cisc:8; /* CIRO supported */
41 u8 fc_class; /* supported FC classes. enum fc_cos */ 41 u8 fc_class; /* supported FC classes. enum fc_cos */
42 u8 vf_en; /* virtual fabric enable */ 42 u8 vf_en; /* virtual fabric enable */
43 u16 vf_id; /* virtual fabric ID */ 43 u16 vf_id; /* virtual fabric ID */
diff --git a/drivers/scsi/bfa/include/bfi/bfi.h b/drivers/scsi/bfa/include/bfi/bfi.h
index 6cadfe0d4ba1..7042c18e542d 100644
--- a/drivers/scsi/bfa/include/bfi/bfi.h
+++ b/drivers/scsi/bfa/include/bfi/bfi.h
@@ -93,13 +93,13 @@ union bfi_addr_u {
93 */ 93 */
94struct bfi_sge_s { 94struct bfi_sge_s {
95#ifdef __BIGENDIAN 95#ifdef __BIGENDIAN
96 u32 flags : 2, 96 u32 flags:2,
97 rsvd : 2, 97 rsvd:2,
98 sg_len : 28; 98 sg_len:28;
99#else 99#else
100 u32 sg_len : 28, 100 u32 sg_len:28,
101 rsvd : 2, 101 rsvd:2,
102 flags : 2; 102 flags:2;
103#endif 103#endif
104 union bfi_addr_u sga; 104 union bfi_addr_u sga;
105}; 105};
diff --git a/drivers/scsi/bfa/include/bfi/bfi_ioc.h b/drivers/scsi/bfa/include/bfi/bfi_ioc.h
index 026e9c06ae97..96ef05670659 100644
--- a/drivers/scsi/bfa/include/bfi/bfi_ioc.h
+++ b/drivers/scsi/bfa/include/bfi/bfi_ioc.h
@@ -142,7 +142,7 @@ enum {
142 BFI_ADAPTER_UNSUPP = 0x400000, /* unknown adapter type */ 142 BFI_ADAPTER_UNSUPP = 0x400000, /* unknown adapter type */
143}; 143};
144 144
145#define BFI_ADAPTER_GETP(__prop,__adap_prop) \ 145#define BFI_ADAPTER_GETP(__prop, __adap_prop) \
146 (((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >> \ 146 (((__adap_prop) & BFI_ADAPTER_ ## __prop ## _MK) >> \
147 BFI_ADAPTER_ ## __prop ## _SH) 147 BFI_ADAPTER_ ## __prop ## _SH)
148#define BFI_ADAPTER_SETP(__prop, __val) \ 148#define BFI_ADAPTER_SETP(__prop, __val) \
diff --git a/drivers/scsi/bfa/include/bfi/bfi_lps.h b/drivers/scsi/bfa/include/bfi/bfi_lps.h
index 414b0e30f6ef..c59d47badb4b 100644
--- a/drivers/scsi/bfa/include/bfi/bfi_lps.h
+++ b/drivers/scsi/bfa/include/bfi/bfi_lps.h
@@ -55,8 +55,8 @@ struct bfi_lps_login_rsp_s {
55 u16 bb_credit; 55 u16 bb_credit;
56 u8 f_port; 56 u8 f_port;
57 u8 npiv_en; 57 u8 npiv_en;
58 u32 lp_pid : 24; 58 u32 lp_pid:24;
59 u32 auth_req : 8; 59 u32 auth_req:8;
60 mac_t lp_mac; 60 mac_t lp_mac;
61 mac_t fcf_mac; 61 mac_t fcf_mac;
62 u8 ext_status; 62 u8 ext_status;
diff --git a/drivers/scsi/bfa/include/bfi/bfi_rport.h b/drivers/scsi/bfa/include/bfi/bfi_rport.h
index 3520f55f09d7..e1cd83b56ec6 100644
--- a/drivers/scsi/bfa/include/bfi/bfi_rport.h
+++ b/drivers/scsi/bfa/include/bfi/bfi_rport.h
@@ -38,10 +38,10 @@ struct bfi_rport_create_req_s {
38 struct bfi_mhdr_s mh; /* common msg header */ 38 struct bfi_mhdr_s mh; /* common msg header */
39 u16 bfa_handle; /* host rport handle */ 39 u16 bfa_handle; /* host rport handle */
40 u16 max_frmsz; /* max rcv pdu size */ 40 u16 max_frmsz; /* max rcv pdu size */
41 u32 pid : 24, /* remote port ID */ 41 u32 pid:24, /* remote port ID */
42 lp_tag : 8; /* local port tag */ 42 lp_tag:8; /* local port tag */
43 u32 local_pid : 24, /* local port ID */ 43 u32 local_pid:24, /* local port ID */
44 cisc : 8; 44 cisc:8;
45 u8 fc_class; /* supported FC classes */ 45 u8 fc_class; /* supported FC classes */
46 u8 vf_en; /* virtual fabric enable */ 46 u8 vf_en; /* virtual fabric enable */
47 u16 vf_id; /* virtual fabric ID */ 47 u16 vf_id; /* virtual fabric ID */
diff --git a/drivers/scsi/bfa/include/cs/bfa_checksum.h b/drivers/scsi/bfa/include/cs/bfa_checksum.h
index af8c1d533ba8..650f8d0aaff9 100644
--- a/drivers/scsi/bfa/include/cs/bfa_checksum.h
+++ b/drivers/scsi/bfa/include/cs/bfa_checksum.h
@@ -31,7 +31,7 @@ bfa_checksum_u32(u32 *buf, int sz)
31 for (i = 0; i < m; i++) 31 for (i = 0; i < m; i++)
32 sum ^= buf[i]; 32 sum ^= buf[i];
33 33
34 return (sum); 34 return sum;
35} 35}
36 36
37static inline u16 37static inline u16
@@ -43,7 +43,7 @@ bfa_checksum_u16(u16 *buf, int sz)
43 for (i = 0; i < m; i++) 43 for (i = 0; i < m; i++)
44 sum ^= buf[i]; 44 sum ^= buf[i];
45 45
46 return (sum); 46 return sum;
47} 47}
48 48
49static inline u8 49static inline u8
@@ -55,6 +55,6 @@ bfa_checksum_u8(u8 *buf, int sz)
55 for (i = 0; i < sz; i++) 55 for (i = 0; i < sz; i++)
56 sum ^= buf[i]; 56 sum ^= buf[i];
57 57
58 return (sum); 58 return sum;
59} 59}
60#endif 60#endif
diff --git a/drivers/scsi/bfa/include/cs/bfa_sm.h b/drivers/scsi/bfa/include/cs/bfa_sm.h
index 9877066680a6..b0a92baf6657 100644
--- a/drivers/scsi/bfa/include/cs/bfa_sm.h
+++ b/drivers/scsi/bfa/include/cs/bfa_sm.h
@@ -24,8 +24,8 @@
24 24
25typedef void (*bfa_sm_t)(void *sm, int event); 25typedef void (*bfa_sm_t)(void *sm, int event);
26 26
27#define bfa_sm_set_state(_sm, _state) (_sm)->sm = (bfa_sm_t)(_state) 27#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)) 28#define bfa_sm_send_event(_sm, _event) ((_sm)->sm((_sm), (_event)))
29#define bfa_sm_get_state(_sm) ((_sm)->sm) 29#define bfa_sm_get_state(_sm) ((_sm)->sm)
30#define bfa_sm_cmp_state(_sm, _state) ((_sm)->sm == (bfa_sm_t)(_state)) 30#define bfa_sm_cmp_state(_sm, _state) ((_sm)->sm == (bfa_sm_t)(_state))
31 31
@@ -62,7 +62,7 @@ typedef void (*bfa_fsm_t)(void *fsm, int event);
62} while (0) 62} while (0)
63 63
64#define bfa_fsm_send_event(_fsm, _event) \ 64#define bfa_fsm_send_event(_fsm, _event) \
65 (_fsm)->fsm((_fsm), (_event)) 65 ((_fsm)->fsm((_fsm), (_event)))
66#define bfa_fsm_cmp_state(_fsm, _state) \ 66#define bfa_fsm_cmp_state(_fsm, _state) \
67 ((_fsm)->fsm == (bfa_fsm_t)(_state)) 67 ((_fsm)->fsm == (bfa_fsm_t)(_state))
68 68
diff --git a/drivers/scsi/bfa/include/cs/bfa_trc.h b/drivers/scsi/bfa/include/cs/bfa_trc.h
index 3e743928c74c..310771c888e7 100644
--- a/drivers/scsi/bfa/include/cs/bfa_trc.h
+++ b/drivers/scsi/bfa/include/cs/bfa_trc.h
@@ -24,7 +24,7 @@
24#endif 24#endif
25 25
26#ifndef BFA_TRC_TS 26#ifndef BFA_TRC_TS
27#define BFA_TRC_TS(_trcm) ((_trcm)->ticks ++) 27#define BFA_TRC_TS(_trcm) ((_trcm)->ticks++)
28#endif 28#endif
29 29
30struct bfa_trc_s { 30struct bfa_trc_s {
diff --git a/drivers/scsi/bfa/include/fcs/bfa_fcs_fabric.h b/drivers/scsi/bfa/include/fcs/bfa_fcs_fabric.h
index 4ffd2242d3de..08b79d5e46f3 100644
--- a/drivers/scsi/bfa/include/fcs/bfa_fcs_fabric.h
+++ b/drivers/scsi/bfa/include/fcs/bfa_fcs_fabric.h
@@ -75,7 +75,7 @@ struct bfa_fcs_fabric_s {
75 */ 75 */
76}; 76};
77 77
78#define bfa_fcs_fabric_npiv_capable(__f) (__f)->is_npiv 78#define bfa_fcs_fabric_npiv_capable(__f) ((__f)->is_npiv)
79#define bfa_fcs_fabric_is_switched(__f) \ 79#define bfa_fcs_fabric_is_switched(__f) \
80 ((__f)->fab_type == BFA_FCS_FABRIC_SWITCHED) 80 ((__f)->fab_type == BFA_FCS_FABRIC_SWITCHED)
81 81
diff --git a/drivers/scsi/bfa/include/fcs/bfa_fcs_lport.h b/drivers/scsi/bfa/include/fcs/bfa_fcs_lport.h
index b85cba884b96..967ceb0eb074 100644
--- a/drivers/scsi/bfa/include/fcs/bfa_fcs_lport.h
+++ b/drivers/scsi/bfa/include/fcs/bfa_fcs_lport.h
@@ -125,12 +125,12 @@ union bfa_fcs_port_topo_u {
125struct bfa_fcs_port_s { 125struct bfa_fcs_port_s {
126 struct list_head qe; /* used by port/vport */ 126 struct list_head qe; /* used by port/vport */
127 bfa_sm_t sm; /* state machine */ 127 bfa_sm_t sm; /* state machine */
128 struct bfa_fcs_fabric_s *fabric; /* parent fabric */ 128 struct bfa_fcs_fabric_s *fabric;/* parent fabric */
129 struct bfa_port_cfg_s port_cfg; /* port configuration */ 129 struct bfa_port_cfg_s port_cfg;/* port configuration */
130 struct bfa_timer_s link_timer; /* timer for link offline */ 130 struct bfa_timer_s link_timer; /* timer for link offline */
131 u32 pid : 24; /* FC address */ 131 u32 pid:24; /* FC address */
132 u8 lp_tag; /* lport tag */ 132 u8 lp_tag; /* lport tag */
133 u16 num_rports; /* Num of r-ports */ 133 u16 num_rports; /* Num of r-ports */
134 struct list_head rport_q; /* queue of discovered r-ports */ 134 struct list_head rport_q; /* queue of discovered r-ports */
135 struct bfa_fcs_s *fcs; /* FCS instance */ 135 struct bfa_fcs_s *fcs; /* FCS instance */
136 union bfa_fcs_port_topo_u port_topo; /* fabric/loop/n2n details */ 136 union bfa_fcs_port_topo_u port_topo; /* fabric/loop/n2n details */
@@ -188,13 +188,14 @@ bfa_fcs_port_get_drvport(struct bfa_fcs_port_s *port)
188} 188}
189 189
190 190
191#define bfa_fcs_port_get_opertype(_lport) (_lport)->fabric->oper_type 191#define bfa_fcs_port_get_opertype(_lport) ((_lport)->fabric->oper_type)
192 192
193 193
194#define bfa_fcs_port_get_fabric_name(_lport) (_lport)->fabric->fabric_name 194#define bfa_fcs_port_get_fabric_name(_lport) ((_lport)->fabric->fabric_name)
195 195
196 196
197#define bfa_fcs_port_get_fabric_ipaddr(_lport) (_lport)->fabric->fabric_ip_addr 197#define bfa_fcs_port_get_fabric_ipaddr(_lport) \
198 ((_lport)->fabric->fabric_ip_addr)
198 199
199/** 200/**
200 * bfa fcs port public functions 201 * bfa fcs port public functions
diff --git a/drivers/scsi/bfa/include/protocol/ct.h b/drivers/scsi/bfa/include/protocol/ct.h
index c59d6630b070..c8648bcba41a 100644
--- a/drivers/scsi/bfa/include/protocol/ct.h
+++ b/drivers/scsi/bfa/include/protocol/ct.h
@@ -193,11 +193,11 @@ struct fcgs_rftid_req_s {
193#define FC_GS_FCP_FC4_FEATURE_TARGET 0x01 193#define FC_GS_FCP_FC4_FEATURE_TARGET 0x01
194 194
195struct fcgs_rffid_req_s{ 195struct fcgs_rffid_req_s{
196 u32 rsvd :8; 196 u32 rsvd:8;
197 u32 dap :24; /* port identifier */ 197 u32 dap:24; /* port identifier */
198 u32 rsvd1 :16; 198 u32 rsvd1:16;
199 u32 fc4ftr_bits :8; /* fc4 feature bits */ 199 u32 fc4ftr_bits:8; /* fc4 feature bits */
200 u32 fc4_type :8; /* corresponding FC4 Type */ 200 u32 fc4_type:8; /* corresponding FC4 Type */
201}; 201};
202 202
203/** 203/**
diff --git a/drivers/scsi/bfa/include/protocol/fc.h b/drivers/scsi/bfa/include/protocol/fc.h
index 3e39ba58cfb5..14969eecf6a9 100644
--- a/drivers/scsi/bfa/include/protocol/fc.h
+++ b/drivers/scsi/bfa/include/protocol/fc.h
@@ -486,14 +486,14 @@ struct fc_rsi_s {
486 * see FC-PH-X table 113 & 115 for explanation also FCP table 8 486 * see FC-PH-X table 113 & 115 for explanation also FCP table 8
487 */ 487 */
488struct fc_prli_params_s{ 488struct fc_prli_params_s{
489 u32 reserved: 16; 489 u32 reserved:16;
490#ifdef __BIGENDIAN 490#ifdef __BIGENDIAN
491 u32 reserved1: 5; 491 u32 reserved1:5;
492 u32 rec_support : 1; 492 u32 rec_support:1;
493 u32 task_retry_id : 1; 493 u32 task_retry_id:1;
494 u32 retry : 1; 494 u32 retry:1;
495 495
496 u32 confirm : 1; 496 u32 confirm:1;
497 u32 doverlay:1; 497 u32 doverlay:1;
498 u32 initiator:1; 498 u32 initiator:1;
499 u32 target:1; 499 u32 target:1;
@@ -502,10 +502,10 @@ struct fc_prli_params_s{
502 u32 rxrdisab:1; 502 u32 rxrdisab:1;
503 u32 wxrdisab:1; 503 u32 wxrdisab:1;
504#else 504#else
505 u32 retry : 1; 505 u32 retry:1;
506 u32 task_retry_id : 1; 506 u32 task_retry_id:1;
507 u32 rec_support : 1; 507 u32 rec_support:1;
508 u32 reserved1: 5; 508 u32 reserved1:5;
509 509
510 u32 wxrdisab:1; 510 u32 wxrdisab:1;
511 u32 rxrdisab:1; 511 u32 rxrdisab:1;
@@ -514,7 +514,7 @@ struct fc_prli_params_s{
514 u32 target:1; 514 u32 target:1;
515 u32 initiator:1; 515 u32 initiator:1;
516 u32 doverlay:1; 516 u32 doverlay:1;
517 u32 confirm : 1; 517 u32 confirm:1;
518#endif 518#endif
519}; 519};
520 520
diff --git a/drivers/scsi/bfa/loop.c b/drivers/scsi/bfa/loop.c
index a418dedebe9e..f7c7f4f3c640 100644
--- a/drivers/scsi/bfa/loop.c
+++ b/drivers/scsi/bfa/loop.c
@@ -58,49 +58,16 @@ static const u8 port_loop_alpa_map[] = {
58/* 58/*
59 * Local Functions 59 * Local Functions
60 */ 60 */
61bfa_status_t bfa_fcs_port_loop_send_plogi(struct bfa_fcs_port_s *port, 61static bfa_status_t bfa_fcs_port_loop_send_plogi(struct bfa_fcs_port_s *port,
62 u8 alpa); 62 u8 alpa);
63 63
64void bfa_fcs_port_loop_plogi_response(void *fcsarg, 64static void bfa_fcs_port_loop_plogi_response(void *fcsarg,
65 struct bfa_fcxp_s *fcxp, 65 struct bfa_fcxp_s *fcxp,
66 void *cbarg, 66 void *cbarg,
67 bfa_status_t req_status, 67 bfa_status_t req_status,
68 u32 rsp_len, 68 u32 rsp_len,
69 u32 resid_len, 69 u32 resid_len,
70 struct fchs_s *rsp_fchs); 70 struct fchs_s *rsp_fchs);
71
72bfa_status_t bfa_fcs_port_loop_send_adisc(struct bfa_fcs_port_s *port,
73 u8 alpa);
74
75void bfa_fcs_port_loop_adisc_response(void *fcsarg,
76 struct bfa_fcxp_s *fcxp,
77 void *cbarg,
78 bfa_status_t req_status,
79 u32 rsp_len,
80 u32 resid_len,
81 struct fchs_s *rsp_fchs);
82
83bfa_status_t bfa_fcs_port_loop_send_plogi_acc(struct bfa_fcs_port_s *port,
84 u8 alpa);
85
86void bfa_fcs_port_loop_plogi_acc_response(void *fcsarg,
87 struct bfa_fcxp_s *fcxp,
88 void *cbarg,
89 bfa_status_t req_status,
90 u32 rsp_len,
91 u32 resid_len,
92 struct fchs_s *rsp_fchs);
93
94bfa_status_t bfa_fcs_port_loop_send_adisc_acc(struct bfa_fcs_port_s *port,
95 u8 alpa);
96
97void bfa_fcs_port_loop_adisc_acc_response(void *fcsarg,
98 struct bfa_fcxp_s *fcxp,
99 void *cbarg,
100 bfa_status_t req_status,
101 u32 rsp_len,
102 u32 resid_len,
103 struct fchs_s *rsp_fchs);
104/** 71/**
105 * Called by port to initializar in provate LOOP topology. 72 * Called by port to initializar in provate LOOP topology.
106 */ 73 */
@@ -179,7 +146,7 @@ bfa_fcs_port_loop_lip(struct bfa_fcs_port_s *port)
179/** 146/**
180 * Local Functions. 147 * Local Functions.
181 */ 148 */
182bfa_status_t 149static bfa_status_t
183bfa_fcs_port_loop_send_plogi(struct bfa_fcs_port_s *port, u8 alpa) 150bfa_fcs_port_loop_send_plogi(struct bfa_fcs_port_s *port, u8 alpa)
184{ 151{
185 struct fchs_s fchs; 152 struct fchs_s fchs;
@@ -208,7 +175,7 @@ bfa_fcs_port_loop_send_plogi(struct bfa_fcs_port_s *port, u8 alpa)
208/** 175/**
209 * Called by fcxp to notify the Plogi response 176 * Called by fcxp to notify the Plogi response
210 */ 177 */
211void 178static void
212bfa_fcs_port_loop_plogi_response(void *fcsarg, struct bfa_fcxp_s *fcxp, 179bfa_fcs_port_loop_plogi_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
213 void *cbarg, bfa_status_t req_status, 180 void *cbarg, bfa_status_t req_status,
214 u32 rsp_len, u32 resid_len, 181 u32 rsp_len, u32 resid_len,
@@ -244,179 +211,3 @@ bfa_fcs_port_loop_plogi_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
244 bfa_assert(0); 211 bfa_assert(0);
245 } 212 }
246} 213}
247
248bfa_status_t
249bfa_fcs_port_loop_send_plogi_acc(struct bfa_fcs_port_s *port, u8 alpa)
250{
251 struct fchs_s fchs;
252 struct bfa_fcxp_s *fcxp;
253 int len;
254
255 bfa_trc(port->fcs, alpa);
256
257 fcxp = bfa_fcxp_alloc(NULL, port->fcs->bfa, 0, 0, NULL, NULL, NULL,
258 NULL);
259 bfa_assert(fcxp);
260
261 len = fc_plogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), alpa,
262 bfa_fcs_port_get_fcid(port), 0,
263 port->port_cfg.pwwn, port->port_cfg.nwwn,
264 bfa_pport_get_maxfrsize(port->fcs->bfa));
265
266 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
267 FC_CLASS_3, len, &fchs,
268 bfa_fcs_port_loop_plogi_acc_response,
269 (void *)port, FC_MAX_PDUSZ, 0); /* No response
270 * expected
271 */
272
273 return BFA_STATUS_OK;
274}
275
276/*
277 * Plogi Acc Response
278 * We donot do any processing here.
279 */
280void
281bfa_fcs_port_loop_plogi_acc_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
282 void *cbarg, bfa_status_t req_status,
283 u32 rsp_len, u32 resid_len,
284 struct fchs_s *rsp_fchs)
285{
286
287 struct bfa_fcs_port_s *port = (struct bfa_fcs_port_s *) cbarg;
288
289 bfa_trc(port->fcs, port->pid);
290
291 /*
292 * Sanity Checks
293 */
294 if (req_status != BFA_STATUS_OK) {
295 bfa_trc(port->fcs, req_status);
296 return;
297 }
298}
299
300bfa_status_t
301bfa_fcs_port_loop_send_adisc(struct bfa_fcs_port_s *port, u8 alpa)
302{
303 struct fchs_s fchs;
304 struct bfa_fcxp_s *fcxp;
305 int len;
306
307 bfa_trc(port->fcs, alpa);
308
309 fcxp = bfa_fcxp_alloc(NULL, port->fcs->bfa, 0, 0, NULL, NULL, NULL,
310 NULL);
311 bfa_assert(fcxp);
312
313 len = fc_adisc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), alpa,
314 bfa_fcs_port_get_fcid(port), 0,
315 port->port_cfg.pwwn, port->port_cfg.nwwn);
316
317 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
318 FC_CLASS_3, len, &fchs,
319 bfa_fcs_port_loop_adisc_response, (void *)port,
320 FC_MAX_PDUSZ, FC_RA_TOV);
321
322 return BFA_STATUS_OK;
323}
324
325/**
326 * Called by fcxp to notify the ADISC response
327 */
328void
329bfa_fcs_port_loop_adisc_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
330 void *cbarg, bfa_status_t req_status,
331 u32 rsp_len, u32 resid_len,
332 struct fchs_s *rsp_fchs)
333{
334 struct bfa_fcs_port_s *port = (struct bfa_fcs_port_s *) cbarg;
335 struct bfa_fcs_rport_s *rport;
336 struct fc_adisc_s *adisc_resp;
337 struct fc_els_cmd_s *els_cmd;
338 u32 pid = rsp_fchs->s_id;
339
340 bfa_trc(port->fcs, req_status);
341
342 /*
343 * Sanity Checks
344 */
345 if (req_status != BFA_STATUS_OK) {
346 /*
347 * TBD : we may need to retry certain requests
348 */
349 bfa_fcxp_free(fcxp);
350 return;
351 }
352
353 els_cmd = (struct fc_els_cmd_s *) BFA_FCXP_RSP_PLD(fcxp);
354 adisc_resp = (struct fc_adisc_s *) els_cmd;
355
356 if (els_cmd->els_code == FC_ELS_ACC) {
357 } else {
358 bfa_trc(port->fcs, adisc_resp->els_cmd.els_code);
359
360 /*
361 * TBD: we may need to check for reject codes and retry
362 */
363 rport = bfa_fcs_port_get_rport_by_pid(port, pid);
364 if (rport) {
365 list_del(&rport->qe);
366 bfa_fcs_rport_delete(rport);
367 }
368
369 }
370 return;
371}
372
373bfa_status_t
374bfa_fcs_port_loop_send_adisc_acc(struct bfa_fcs_port_s *port, u8 alpa)
375{
376 struct fchs_s fchs;
377 struct bfa_fcxp_s *fcxp;
378 int len;
379
380 bfa_trc(port->fcs, alpa);
381
382 fcxp = bfa_fcxp_alloc(NULL, port->fcs->bfa, 0, 0, NULL, NULL, NULL,
383 NULL);
384 bfa_assert(fcxp);
385
386 len = fc_adisc_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), alpa,
387 bfa_fcs_port_get_fcid(port), 0,
388 port->port_cfg.pwwn, port->port_cfg.nwwn);
389
390 bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
391 FC_CLASS_3, len, &fchs,
392 bfa_fcs_port_loop_adisc_acc_response,
393 (void *)port, FC_MAX_PDUSZ, 0); /* no reponse
394 * expected
395 */
396
397 return BFA_STATUS_OK;
398}
399
400/*
401 * Adisc Acc Response
402 * We donot do any processing here.
403 */
404void
405bfa_fcs_port_loop_adisc_acc_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
406 void *cbarg, bfa_status_t req_status,
407 u32 rsp_len, u32 resid_len,
408 struct fchs_s *rsp_fchs)
409{
410
411 struct bfa_fcs_port_s *port = (struct bfa_fcs_port_s *) cbarg;
412
413 bfa_trc(port->fcs, port->pid);
414
415 /*
416 * Sanity Checks
417 */
418 if (req_status != BFA_STATUS_OK) {
419 bfa_trc(port->fcs, req_status);
420 return;
421 }
422}
diff --git a/drivers/scsi/bfa/lport_api.c b/drivers/scsi/bfa/lport_api.c
index 8f51a83f1834..1e06792cd4c2 100644
--- a/drivers/scsi/bfa/lport_api.c
+++ b/drivers/scsi/bfa/lport_api.c
@@ -43,7 +43,7 @@ bfa_fcs_cfg_base_port(struct bfa_fcs_s *fcs, struct bfa_port_cfg_s *port_cfg)
43struct bfa_fcs_port_s * 43struct bfa_fcs_port_s *
44bfa_fcs_get_base_port(struct bfa_fcs_s *fcs) 44bfa_fcs_get_base_port(struct bfa_fcs_s *fcs)
45{ 45{
46 return (&fcs->fabric.bport); 46 return &fcs->fabric.bport;
47} 47}
48 48
49wwn_t 49wwn_t
@@ -88,11 +88,10 @@ bfa_fcs_port_get_rport(struct bfa_fcs_port_s *port, wwn_t wwn, int index,
88 } 88 }
89 89
90 bfa_trc(fcs, i); 90 bfa_trc(fcs, i);
91 if (rport) { 91 if (rport)
92 return rport->pwwn; 92 return rport->pwwn;
93 } else { 93 else
94 return (wwn_t) 0; 94 return (wwn_t) 0;
95 }
96} 95}
97 96
98void 97void
@@ -198,17 +197,17 @@ bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, u16 vf_id, wwn_t lpwwn)
198 vf = bfa_fcs_vf_lookup(fcs, vf_id); 197 vf = bfa_fcs_vf_lookup(fcs, vf_id);
199 if (vf == NULL) { 198 if (vf == NULL) {
200 bfa_trc(fcs, vf_id); 199 bfa_trc(fcs, vf_id);
201 return (NULL); 200 return NULL;
202 } 201 }
203 202
204 if (!lpwwn || (vf->bport.port_cfg.pwwn == lpwwn)) 203 if (!lpwwn || (vf->bport.port_cfg.pwwn == lpwwn))
205 return (&vf->bport); 204 return &vf->bport;
206 205
207 vport = bfa_fcs_fabric_vport_lookup(vf, lpwwn); 206 vport = bfa_fcs_fabric_vport_lookup(vf, lpwwn);
208 if (vport) 207 if (vport)
209 return (&vport->lport); 208 return &vport->lport;
210 209
211 return (NULL); 210 return NULL;
212} 211}
213 212
214/* 213/*
diff --git a/drivers/scsi/bfa/ns.c b/drivers/scsi/bfa/ns.c
index 59fea99d67a4..2f8b880060bb 100644
--- a/drivers/scsi/bfa/ns.c
+++ b/drivers/scsi/bfa/ns.c
@@ -932,11 +932,10 @@ bfa_fcs_port_ns_send_rff_id(void *ns_cbarg, struct bfa_fcxp_s *fcxp_alloced)
932 } 932 }
933 ns->fcxp = fcxp; 933 ns->fcxp = fcxp;
934 934
935 if (BFA_FCS_VPORT_IS_INITIATOR_MODE(ns->port)) { 935 if (BFA_FCS_VPORT_IS_INITIATOR_MODE(ns->port))
936 fc4_ftrs = FC_GS_FCP_FC4_FEATURE_INITIATOR; 936 fc4_ftrs = FC_GS_FCP_FC4_FEATURE_INITIATOR;
937 } else if (BFA_FCS_VPORT_IS_TARGET_MODE(ns->port)) { 937 else if (BFA_FCS_VPORT_IS_TARGET_MODE(ns->port))
938 fc4_ftrs = FC_GS_FCP_FC4_FEATURE_TARGET; 938 fc4_ftrs = FC_GS_FCP_FC4_FEATURE_TARGET;
939 }
940 939
941 len = fc_rffid_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), 940 len = fc_rffid_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
942 bfa_fcs_port_get_fcid(port), 0, FC_TYPE_FCP, 941 bfa_fcs_port_get_fcid(port), 0, FC_TYPE_FCP,
diff --git a/drivers/scsi/bfa/plog.c b/drivers/scsi/bfa/plog.c
index 86af818d17bb..fcb8864d3276 100644
--- a/drivers/scsi/bfa/plog.c
+++ b/drivers/scsi/bfa/plog.c
@@ -180,5 +180,5 @@ bfa_plog_disable(struct bfa_plog_s *plog)
180bfa_boolean_t 180bfa_boolean_t
181bfa_plog_get_setting(struct bfa_plog_s *plog) 181bfa_plog_get_setting(struct bfa_plog_s *plog)
182{ 182{
183 return((bfa_boolean_t)plog->plog_enabled); 183 return (bfa_boolean_t)plog->plog_enabled;
184} 184}
diff --git a/drivers/scsi/bfa/rport_ftrs.c b/drivers/scsi/bfa/rport_ftrs.c
index 8a1f59d596c1..e1932c885ac2 100644
--- a/drivers/scsi/bfa/rport_ftrs.c
+++ b/drivers/scsi/bfa/rport_ftrs.c
@@ -79,7 +79,7 @@ bfa_fcs_rpf_sm_uninit(struct bfa_fcs_rpf_s *rpf, enum rpf_event event)
79 bfa_trc(rport->fcs, event); 79 bfa_trc(rport->fcs, event);
80 80
81 switch (event) { 81 switch (event) {
82 case RPFSM_EVENT_RPORT_ONLINE : 82 case RPFSM_EVENT_RPORT_ONLINE:
83 if (!BFA_FCS_PID_IS_WKA(rport->pid)) { 83 if (!BFA_FCS_PID_IS_WKA(rport->pid)) {
84 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending); 84 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending);
85 rpf->rpsc_retries = 0; 85 rpf->rpsc_retries = 0;
@@ -87,7 +87,7 @@ bfa_fcs_rpf_sm_uninit(struct bfa_fcs_rpf_s *rpf, enum rpf_event event)
87 break; 87 break;
88 }; 88 };
89 89
90 case RPFSM_EVENT_RPORT_OFFLINE : 90 case RPFSM_EVENT_RPORT_OFFLINE:
91 break; 91 break;
92 92
93 default: 93 default:
@@ -107,7 +107,7 @@ bfa_fcs_rpf_sm_rpsc_sending(struct bfa_fcs_rpf_s *rpf, enum rpf_event event)
107 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc); 107 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc);
108 break; 108 break;
109 109
110 case RPFSM_EVENT_RPORT_OFFLINE : 110 case RPFSM_EVENT_RPORT_OFFLINE:
111 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_offline); 111 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_offline);
112 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rpf->fcxp_wqe); 112 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rpf->fcxp_wqe);
113 rpf->rpsc_retries = 0; 113 rpf->rpsc_retries = 0;
@@ -130,11 +130,10 @@ bfa_fcs_rpf_sm_rpsc(struct bfa_fcs_rpf_s *rpf, enum rpf_event event)
130 case RPFSM_EVENT_RPSC_COMP: 130 case RPFSM_EVENT_RPSC_COMP:
131 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_online); 131 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_online);
132 /* Update speed info in f/w via BFA */ 132 /* Update speed info in f/w via BFA */
133 if (rpf->rpsc_speed != BFA_PPORT_SPEED_UNKNOWN) { 133 if (rpf->rpsc_speed != BFA_PPORT_SPEED_UNKNOWN)
134 bfa_rport_speed(rport->bfa_rport, rpf->rpsc_speed); 134 bfa_rport_speed(rport->bfa_rport, rpf->rpsc_speed);
135 } else if (rpf->assigned_speed != BFA_PPORT_SPEED_UNKNOWN) { 135 else if (rpf->assigned_speed != BFA_PPORT_SPEED_UNKNOWN)
136 bfa_rport_speed(rport->bfa_rport, rpf->assigned_speed); 136 bfa_rport_speed(rport->bfa_rport, rpf->assigned_speed);
137 }
138 break; 137 break;
139 138
140 case RPFSM_EVENT_RPSC_FAIL: 139 case RPFSM_EVENT_RPSC_FAIL:
@@ -154,7 +153,7 @@ bfa_fcs_rpf_sm_rpsc(struct bfa_fcs_rpf_s *rpf, enum rpf_event event)
154 } 153 }
155 break; 154 break;
156 155
157 case RPFSM_EVENT_RPORT_OFFLINE : 156 case RPFSM_EVENT_RPORT_OFFLINE:
158 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_offline); 157 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_offline);
159 bfa_fcxp_discard(rpf->fcxp); 158 bfa_fcxp_discard(rpf->fcxp);
160 rpf->rpsc_retries = 0; 159 rpf->rpsc_retries = 0;
@@ -174,13 +173,13 @@ bfa_fcs_rpf_sm_rpsc_retry(struct bfa_fcs_rpf_s *rpf, enum rpf_event event)
174 bfa_trc(rport->fcs, event); 173 bfa_trc(rport->fcs, event);
175 174
176 switch (event) { 175 switch (event) {
177 case RPFSM_EVENT_TIMEOUT : 176 case RPFSM_EVENT_TIMEOUT:
178 /* re-send the RPSC */ 177 /* re-send the RPSC */
179 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending); 178 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending);
180 bfa_fcs_rpf_send_rpsc2(rpf, NULL); 179 bfa_fcs_rpf_send_rpsc2(rpf, NULL);
181 break; 180 break;
182 181
183 case RPFSM_EVENT_RPORT_OFFLINE : 182 case RPFSM_EVENT_RPORT_OFFLINE:
184 bfa_timer_stop(&rpf->timer); 183 bfa_timer_stop(&rpf->timer);
185 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_offline); 184 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_offline);
186 rpf->rpsc_retries = 0; 185 rpf->rpsc_retries = 0;
@@ -201,7 +200,7 @@ bfa_fcs_rpf_sm_online(struct bfa_fcs_rpf_s *rpf, enum rpf_event event)
201 bfa_trc(rport->fcs, event); 200 bfa_trc(rport->fcs, event);
202 201
203 switch (event) { 202 switch (event) {
204 case RPFSM_EVENT_RPORT_OFFLINE : 203 case RPFSM_EVENT_RPORT_OFFLINE:
205 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_offline); 204 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_offline);
206 rpf->rpsc_retries = 0; 205 rpf->rpsc_retries = 0;
207 break; 206 break;
@@ -221,12 +220,12 @@ bfa_fcs_rpf_sm_offline(struct bfa_fcs_rpf_s *rpf, enum rpf_event event)
221 bfa_trc(rport->fcs, event); 220 bfa_trc(rport->fcs, event);
222 221
223 switch (event) { 222 switch (event) {
224 case RPFSM_EVENT_RPORT_ONLINE : 223 case RPFSM_EVENT_RPORT_ONLINE:
225 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending); 224 bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending);
226 bfa_fcs_rpf_send_rpsc2(rpf, NULL); 225 bfa_fcs_rpf_send_rpsc2(rpf, NULL);
227 break; 226 break;
228 227
229 case RPFSM_EVENT_RPORT_OFFLINE : 228 case RPFSM_EVENT_RPORT_OFFLINE:
230 break; 229 break;
231 230
232 default: 231 default:
@@ -366,10 +365,9 @@ bfa_fcs_rpf_rpsc2_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
366 bfa_trc(rport->fcs, ls_rjt->reason_code); 365 bfa_trc(rport->fcs, ls_rjt->reason_code);
367 bfa_trc(rport->fcs, ls_rjt->reason_code_expl); 366 bfa_trc(rport->fcs, ls_rjt->reason_code_expl);
368 rport->stats.rpsc_rejects++; 367 rport->stats.rpsc_rejects++;
369 if (ls_rjt->reason_code == FC_LS_RJT_RSN_CMD_NOT_SUPP) { 368 if (ls_rjt->reason_code == FC_LS_RJT_RSN_CMD_NOT_SUPP)
370 bfa_sm_send_event(rpf, RPFSM_EVENT_RPSC_FAIL); 369 bfa_sm_send_event(rpf, RPFSM_EVENT_RPSC_FAIL);
371 } else { 370 else
372 bfa_sm_send_event(rpf, RPFSM_EVENT_RPSC_ERROR); 371 bfa_sm_send_event(rpf, RPFSM_EVENT_RPSC_ERROR);
373 }
374 } 372 }
375} 373}
diff --git a/drivers/scsi/bfa/vfapi.c b/drivers/scsi/bfa/vfapi.c
index 31d81fe2fc48..391a4790bebd 100644
--- a/drivers/scsi/bfa/vfapi.c
+++ b/drivers/scsi/bfa/vfapi.c
@@ -189,7 +189,7 @@ bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id)
189{ 189{
190 bfa_trc(fcs, vf_id); 190 bfa_trc(fcs, vf_id);
191 if (vf_id == FC_VF_ID_NULL) 191 if (vf_id == FC_VF_ID_NULL)
192 return (&fcs->fabric); 192 return &fcs->fabric;
193 193
194 /** 194 /**
195 * @todo vf support 195 * @todo vf support
diff --git a/drivers/scsi/bfa/vport.c b/drivers/scsi/bfa/vport.c
index c10af06c5714..e90f1e38c32d 100644
--- a/drivers/scsi/bfa/vport.c
+++ b/drivers/scsi/bfa/vport.c
@@ -31,13 +31,13 @@
31 31
32BFA_TRC_FILE(FCS, VPORT); 32BFA_TRC_FILE(FCS, VPORT);
33 33
34#define __vport_fcs(__vp) (__vp)->lport.fcs 34#define __vport_fcs(__vp) ((__vp)->lport.fcs)
35#define __vport_pwwn(__vp) (__vp)->lport.port_cfg.pwwn 35#define __vport_pwwn(__vp) ((__vp)->lport.port_cfg.pwwn)
36#define __vport_nwwn(__vp) (__vp)->lport.port_cfg.nwwn 36#define __vport_nwwn(__vp) ((__vp)->lport.port_cfg.nwwn)
37#define __vport_bfa(__vp) (__vp)->lport.fcs->bfa 37#define __vport_bfa(__vp) ((__vp)->lport.fcs->bfa)
38#define __vport_fcid(__vp) (__vp)->lport.pid 38#define __vport_fcid(__vp) ((__vp)->lport.pid)
39#define __vport_fabric(__vp) (__vp)->lport.fabric 39#define __vport_fabric(__vp) ((__vp)->lport.fabric)
40#define __vport_vfid(__vp) (__vp)->lport.fabric->vf_id 40#define __vport_vfid(__vp) ((__vp)->lport.fabric->vf_id)
41 41
42#define BFA_FCS_VPORT_MAX_RETRIES 5 42#define BFA_FCS_VPORT_MAX_RETRIES 5
43/* 43/*
@@ -641,9 +641,9 @@ bfa_fcs_vport_get_max(struct bfa_fcs_s *fcs)
641 bfa_get_attr(fcs->bfa, &ioc_attr); 641 bfa_get_attr(fcs->bfa, &ioc_attr);
642 642
643 if (ioc_attr.pci_attr.device_id == BFA_PCI_DEVICE_ID_CT) 643 if (ioc_attr.pci_attr.device_id == BFA_PCI_DEVICE_ID_CT)
644 return (BFA_FCS_MAX_VPORTS_SUPP_CT); 644 return BFA_FCS_MAX_VPORTS_SUPP_CT;
645 else 645 else
646 return (BFA_FCS_MAX_VPORTS_SUPP_CB); 646 return BFA_FCS_MAX_VPORTS_SUPP_CB;
647} 647}
648 648
649 649
@@ -675,7 +675,7 @@ bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport, struct bfa_fcs_s *fcs,
675 struct bfad_vport_s *vport_drv) 675 struct bfad_vport_s *vport_drv)
676{ 676{
677 if (vport_cfg->pwwn == 0) 677 if (vport_cfg->pwwn == 0)
678 return (BFA_STATUS_INVALID_WWN); 678 return BFA_STATUS_INVALID_WWN;
679 679
680 if (bfa_fcs_port_get_pwwn(&fcs->fabric.bport) == vport_cfg->pwwn) 680 if (bfa_fcs_port_get_pwwn(&fcs->fabric.bport) == vport_cfg->pwwn)
681 return BFA_STATUS_VPORT_WWN_BP; 681 return BFA_STATUS_VPORT_WWN_BP;