aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfa_svc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/bfa_svc.c')
-rw-r--r--drivers/scsi/bfa/bfa_svc.c504
1 files changed, 251 insertions, 253 deletions
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index aa1dc749b281..c768143f4805 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -29,7 +29,7 @@ BFA_MODULE(fcport);
29BFA_MODULE(rport); 29BFA_MODULE(rport);
30BFA_MODULE(uf); 30BFA_MODULE(uf);
31 31
32/** 32/*
33 * LPS related definitions 33 * LPS related definitions
34 */ 34 */
35#define BFA_LPS_MIN_LPORTS (1) 35#define BFA_LPS_MIN_LPORTS (1)
@@ -41,7 +41,7 @@ BFA_MODULE(uf);
41#define BFA_LPS_MAX_VPORTS_SUPP_CB 255 41#define BFA_LPS_MAX_VPORTS_SUPP_CB 255
42#define BFA_LPS_MAX_VPORTS_SUPP_CT 190 42#define BFA_LPS_MAX_VPORTS_SUPP_CT 190
43 43
44/** 44/*
45 * lps_pvt BFA LPS private functions 45 * lps_pvt BFA LPS private functions
46 */ 46 */
47 47
@@ -55,7 +55,7 @@ enum bfa_lps_event {
55 BFA_LPS_SM_RX_CVL = 7, /* Rx clear virtual link */ 55 BFA_LPS_SM_RX_CVL = 7, /* Rx clear virtual link */
56}; 56};
57 57
58/** 58/*
59 * FC PORT related definitions 59 * FC PORT related definitions
60 */ 60 */
61/* 61/*
@@ -67,7 +67,7 @@ enum bfa_lps_event {
67 (bfa_ioc_is_disabled(&bfa->ioc) == BFA_TRUE)) 67 (bfa_ioc_is_disabled(&bfa->ioc) == BFA_TRUE))
68 68
69 69
70/** 70/*
71 * BFA port state machine events 71 * BFA port state machine events
72 */ 72 */
73enum bfa_fcport_sm_event { 73enum bfa_fcport_sm_event {
@@ -82,7 +82,7 @@ enum bfa_fcport_sm_event {
82 BFA_FCPORT_SM_HWFAIL = 9, /* IOC h/w failure */ 82 BFA_FCPORT_SM_HWFAIL = 9, /* IOC h/w failure */
83}; 83};
84 84
85/** 85/*
86 * BFA port link notification state machine events 86 * BFA port link notification state machine events
87 */ 87 */
88 88
@@ -92,7 +92,7 @@ enum bfa_fcport_ln_sm_event {
92 BFA_FCPORT_LN_SM_NOTIFICATION = 3 /* done notification */ 92 BFA_FCPORT_LN_SM_NOTIFICATION = 3 /* done notification */
93}; 93};
94 94
95/** 95/*
96 * RPORT related definitions 96 * RPORT related definitions
97 */ 97 */
98#define bfa_rport_offline_cb(__rp) do { \ 98#define bfa_rport_offline_cb(__rp) do { \
@@ -126,7 +126,7 @@ enum bfa_rport_event {
126 BFA_RPORT_SM_QRESUME = 9, /* space in requeue queue */ 126 BFA_RPORT_SM_QRESUME = 9, /* space in requeue queue */
127}; 127};
128 128
129/** 129/*
130 * forward declarations FCXP related functions 130 * forward declarations FCXP related functions
131 */ 131 */
132static void __bfa_fcxp_send_cbfn(void *cbarg, bfa_boolean_t complete); 132static void __bfa_fcxp_send_cbfn(void *cbarg, bfa_boolean_t complete);
@@ -138,7 +138,7 @@ static void bfa_fcxp_qresume(void *cbarg);
138static void bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, 138static void bfa_fcxp_queue(struct bfa_fcxp_s *fcxp,
139 struct bfi_fcxp_send_req_s *send_req); 139 struct bfi_fcxp_send_req_s *send_req);
140 140
141/** 141/*
142 * forward declarations for LPS functions 142 * forward declarations for LPS functions
143 */ 143 */
144static void bfa_lps_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len, 144static void bfa_lps_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len,
@@ -163,7 +163,7 @@ static void bfa_lps_login_comp(struct bfa_lps_s *lps);
163static void bfa_lps_logout_comp(struct bfa_lps_s *lps); 163static void bfa_lps_logout_comp(struct bfa_lps_s *lps);
164static void bfa_lps_cvl_event(struct bfa_lps_s *lps); 164static void bfa_lps_cvl_event(struct bfa_lps_s *lps);
165 165
166/** 166/*
167 * forward declaration for LPS state machine 167 * forward declaration for LPS state machine
168 */ 168 */
169static void bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event); 169static void bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event);
@@ -175,7 +175,7 @@ static void bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event);
175static void bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event 175static void bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event
176 event); 176 event);
177 177
178/** 178/*
179 * forward declaration for FC Port functions 179 * forward declaration for FC Port functions
180 */ 180 */
181static bfa_boolean_t bfa_fcport_send_enable(struct bfa_fcport_s *fcport); 181static bfa_boolean_t bfa_fcport_send_enable(struct bfa_fcport_s *fcport);
@@ -193,7 +193,7 @@ static void bfa_fcport_stats_get_timeout(void *cbarg);
193static void bfa_fcport_stats_clr_timeout(void *cbarg); 193static void bfa_fcport_stats_clr_timeout(void *cbarg);
194static void bfa_trunk_iocdisable(struct bfa_s *bfa); 194static void bfa_trunk_iocdisable(struct bfa_s *bfa);
195 195
196/** 196/*
197 * forward declaration for FC PORT state machine 197 * forward declaration for FC PORT state machine
198 */ 198 */
199static void bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport, 199static void bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
@@ -252,7 +252,7 @@ static struct bfa_sm_table_s hal_port_sm_table[] = {
252}; 252};
253 253
254 254
255/** 255/*
256 * forward declaration for RPORT related functions 256 * forward declaration for RPORT related functions
257 */ 257 */
258static struct bfa_rport_s *bfa_rport_alloc(struct bfa_rport_mod_s *rp_mod); 258static struct bfa_rport_s *bfa_rport_alloc(struct bfa_rport_mod_s *rp_mod);
@@ -265,7 +265,7 @@ static void __bfa_cb_rport_online(void *cbarg,
265static void __bfa_cb_rport_offline(void *cbarg, 265static void __bfa_cb_rport_offline(void *cbarg,
266 bfa_boolean_t complete); 266 bfa_boolean_t complete);
267 267
268/** 268/*
269 * forward declaration for RPORT state machine 269 * forward declaration for RPORT state machine
270 */ 270 */
271static void bfa_rport_sm_uninit(struct bfa_rport_s *rp, 271static void bfa_rport_sm_uninit(struct bfa_rport_s *rp,
@@ -295,7 +295,7 @@ static void bfa_rport_sm_fwdelete_qfull(struct bfa_rport_s *rp,
295static void bfa_rport_sm_deleting_qfull(struct bfa_rport_s *rp, 295static void bfa_rport_sm_deleting_qfull(struct bfa_rport_s *rp,
296 enum bfa_rport_event event); 296 enum bfa_rport_event event);
297 297
298/** 298/*
299 * PLOG related definitions 299 * PLOG related definitions
300 */ 300 */
301static int 301static int
@@ -330,7 +330,7 @@ bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec)
330 330
331 pl_recp = &(plog->plog_recs[tail]); 331 pl_recp = &(plog->plog_recs[tail]);
332 332
333 bfa_os_memcpy(pl_recp, pl_rec, sizeof(struct bfa_plog_rec_s)); 333 memcpy(pl_recp, pl_rec, sizeof(struct bfa_plog_rec_s));
334 334
335 pl_recp->tv = bfa_os_get_log_time(); 335 pl_recp->tv = bfa_os_get_log_time();
336 BFA_PL_LOG_REC_INCR(plog->tail); 336 BFA_PL_LOG_REC_INCR(plog->tail);
@@ -342,9 +342,9 @@ bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec)
342void 342void
343bfa_plog_init(struct bfa_plog_s *plog) 343bfa_plog_init(struct bfa_plog_s *plog)
344{ 344{
345 bfa_os_memset((char *)plog, 0, sizeof(struct bfa_plog_s)); 345 memset((char *)plog, 0, sizeof(struct bfa_plog_s));
346 346
347 bfa_os_memcpy(plog->plog_sig, BFA_PL_SIG_STR, BFA_PL_SIG_LEN); 347 memcpy(plog->plog_sig, BFA_PL_SIG_STR, BFA_PL_SIG_LEN);
348 plog->head = plog->tail = 0; 348 plog->head = plog->tail = 0;
349 plog->plog_enabled = 1; 349 plog->plog_enabled = 1;
350} 350}
@@ -357,7 +357,7 @@ bfa_plog_str(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
357 struct bfa_plog_rec_s lp; 357 struct bfa_plog_rec_s lp;
358 358
359 if (plog->plog_enabled) { 359 if (plog->plog_enabled) {
360 bfa_os_memset(&lp, 0, sizeof(struct bfa_plog_rec_s)); 360 memset(&lp, 0, sizeof(struct bfa_plog_rec_s));
361 lp.mid = mid; 361 lp.mid = mid;
362 lp.eid = event; 362 lp.eid = event;
363 lp.log_type = BFA_PL_LOG_TYPE_STRING; 363 lp.log_type = BFA_PL_LOG_TYPE_STRING;
@@ -381,15 +381,14 @@ bfa_plog_intarr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
381 num_ints = BFA_PL_INT_LOG_SZ; 381 num_ints = BFA_PL_INT_LOG_SZ;
382 382
383 if (plog->plog_enabled) { 383 if (plog->plog_enabled) {
384 bfa_os_memset(&lp, 0, sizeof(struct bfa_plog_rec_s)); 384 memset(&lp, 0, sizeof(struct bfa_plog_rec_s));
385 lp.mid = mid; 385 lp.mid = mid;
386 lp.eid = event; 386 lp.eid = event;
387 lp.log_type = BFA_PL_LOG_TYPE_INT; 387 lp.log_type = BFA_PL_LOG_TYPE_INT;
388 lp.misc = misc; 388 lp.misc = misc;
389 389
390 for (i = 0; i < num_ints; i++) 390 for (i = 0; i < num_ints; i++)
391 bfa_os_assign(lp.log_entry.int_log[i], 391 lp.log_entry.int_log[i] = intarr[i];
392 intarr[i]);
393 392
394 lp.log_num_ints = (u8) num_ints; 393 lp.log_num_ints = (u8) num_ints;
395 394
@@ -407,7 +406,7 @@ bfa_plog_fchdr(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
407 u32 ints[BFA_PL_INT_LOG_SZ]; 406 u32 ints[BFA_PL_INT_LOG_SZ];
408 407
409 if (plog->plog_enabled) { 408 if (plog->plog_enabled) {
410 bfa_os_memset(&lp, 0, sizeof(struct bfa_plog_rec_s)); 409 memset(&lp, 0, sizeof(struct bfa_plog_rec_s));
411 410
412 ints[0] = tmp_int[0]; 411 ints[0] = tmp_int[0];
413 ints[1] = tmp_int[1]; 412 ints[1] = tmp_int[1];
@@ -427,7 +426,7 @@ bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
427 u32 ints[BFA_PL_INT_LOG_SZ]; 426 u32 ints[BFA_PL_INT_LOG_SZ];
428 427
429 if (plog->plog_enabled) { 428 if (plog->plog_enabled) {
430 bfa_os_memset(&lp, 0, sizeof(struct bfa_plog_rec_s)); 429 memset(&lp, 0, sizeof(struct bfa_plog_rec_s));
431 430
432 ints[0] = tmp_int[0]; 431 ints[0] = tmp_int[0];
433 ints[1] = tmp_int[1]; 432 ints[1] = tmp_int[1];
@@ -462,7 +461,7 @@ bfa_plog_get_setting(struct bfa_plog_s *plog)
462 return (bfa_boolean_t)plog->plog_enabled; 461 return (bfa_boolean_t)plog->plog_enabled;
463} 462}
464 463
465/** 464/*
466 * fcxp_pvt BFA FCXP private functions 465 * fcxp_pvt BFA FCXP private functions
467 */ 466 */
468 467
@@ -485,7 +484,7 @@ claim_fcxp_req_rsp_mem(struct bfa_fcxp_mod_s *mod, struct bfa_meminfo_s *mi)
485 mod->req_pld_list_pa = dm_pa; 484 mod->req_pld_list_pa = dm_pa;
486 dm_kva += buf_pool_sz; 485 dm_kva += buf_pool_sz;
487 dm_pa += buf_pool_sz; 486 dm_pa += buf_pool_sz;
488 bfa_os_memset(mod->req_pld_list_kva, 0, buf_pool_sz); 487 memset(mod->req_pld_list_kva, 0, buf_pool_sz);
489 488
490 /* 489 /*
491 * Initialize the fcxp rsp payload list 490 * Initialize the fcxp rsp payload list
@@ -495,7 +494,7 @@ claim_fcxp_req_rsp_mem(struct bfa_fcxp_mod_s *mod, struct bfa_meminfo_s *mi)
495 mod->rsp_pld_list_pa = dm_pa; 494 mod->rsp_pld_list_pa = dm_pa;
496 dm_kva += buf_pool_sz; 495 dm_kva += buf_pool_sz;
497 dm_pa += buf_pool_sz; 496 dm_pa += buf_pool_sz;
498 bfa_os_memset(mod->rsp_pld_list_kva, 0, buf_pool_sz); 497 memset(mod->rsp_pld_list_kva, 0, buf_pool_sz);
499 498
500 bfa_meminfo_dma_virt(mi) = dm_kva; 499 bfa_meminfo_dma_virt(mi) = dm_kva;
501 bfa_meminfo_dma_phys(mi) = dm_pa; 500 bfa_meminfo_dma_phys(mi) = dm_pa;
@@ -508,7 +507,7 @@ claim_fcxps_mem(struct bfa_fcxp_mod_s *mod, struct bfa_meminfo_s *mi)
508 struct bfa_fcxp_s *fcxp; 507 struct bfa_fcxp_s *fcxp;
509 508
510 fcxp = (struct bfa_fcxp_s *) bfa_meminfo_kva(mi); 509 fcxp = (struct bfa_fcxp_s *) bfa_meminfo_kva(mi);
511 bfa_os_memset(fcxp, 0, sizeof(struct bfa_fcxp_s) * mod->num_fcxps); 510 memset(fcxp, 0, sizeof(struct bfa_fcxp_s) * mod->num_fcxps);
512 511
513 INIT_LIST_HEAD(&mod->fcxp_free_q); 512 INIT_LIST_HEAD(&mod->fcxp_free_q);
514 INIT_LIST_HEAD(&mod->fcxp_active_q); 513 INIT_LIST_HEAD(&mod->fcxp_active_q);
@@ -559,11 +558,11 @@ bfa_fcxp_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
559{ 558{
560 struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa); 559 struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa);
561 560
562 bfa_os_memset(mod, 0, sizeof(struct bfa_fcxp_mod_s)); 561 memset(mod, 0, sizeof(struct bfa_fcxp_mod_s));
563 mod->bfa = bfa; 562 mod->bfa = bfa;
564 mod->num_fcxps = cfg->fwcfg.num_fcxp_reqs; 563 mod->num_fcxps = cfg->fwcfg.num_fcxp_reqs;
565 564
566 /** 565 /*
567 * Initialize FCXP request and response payload sizes. 566 * Initialize FCXP request and response payload sizes.
568 */ 567 */
569 mod->req_pld_sz = mod->rsp_pld_sz = BFA_FCXP_MAX_IBUF_SZ; 568 mod->req_pld_sz = mod->rsp_pld_sz = BFA_FCXP_MAX_IBUF_SZ;
@@ -741,20 +740,20 @@ hal_fcxp_send_comp(struct bfa_s *bfa, struct bfi_fcxp_send_rsp_s *fcxp_rsp)
741{ 740{
742 struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa); 741 struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa);
743 struct bfa_fcxp_s *fcxp; 742 struct bfa_fcxp_s *fcxp;
744 u16 fcxp_tag = bfa_os_ntohs(fcxp_rsp->fcxp_tag); 743 u16 fcxp_tag = be16_to_cpu(fcxp_rsp->fcxp_tag);
745 744
746 bfa_trc(bfa, fcxp_tag); 745 bfa_trc(bfa, fcxp_tag);
747 746
748 fcxp_rsp->rsp_len = bfa_os_ntohl(fcxp_rsp->rsp_len); 747 fcxp_rsp->rsp_len = be32_to_cpu(fcxp_rsp->rsp_len);
749 748
750 /** 749 /*
751 * @todo f/w should not set residue to non-0 when everything 750 * @todo f/w should not set residue to non-0 when everything
752 * is received. 751 * is received.
753 */ 752 */
754 if (fcxp_rsp->req_status == BFA_STATUS_OK) 753 if (fcxp_rsp->req_status == BFA_STATUS_OK)
755 fcxp_rsp->residue_len = 0; 754 fcxp_rsp->residue_len = 0;
756 else 755 else
757 fcxp_rsp->residue_len = bfa_os_ntohl(fcxp_rsp->residue_len); 756 fcxp_rsp->residue_len = be32_to_cpu(fcxp_rsp->residue_len);
758 757
759 fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag); 758 fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag);
760 759
@@ -856,7 +855,7 @@ hal_fcxp_rx_plog(struct bfa_s *bfa, struct bfa_fcxp_s *fcxp,
856 } 855 }
857} 856}
858 857
859/** 858/*
860 * Handler to resume sending fcxp when space in available in cpe queue. 859 * Handler to resume sending fcxp when space in available in cpe queue.
861 */ 860 */
862static void 861static void
@@ -871,7 +870,7 @@ bfa_fcxp_qresume(void *cbarg)
871 bfa_fcxp_queue(fcxp, send_req); 870 bfa_fcxp_queue(fcxp, send_req);
872} 871}
873 872
874/** 873/*
875 * Queue fcxp send request to foimrware. 874 * Queue fcxp send request to foimrware.
876 */ 875 */
877static void 876static void
@@ -885,26 +884,26 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req)
885 bfi_h2i_set(send_req->mh, BFI_MC_FCXP, BFI_FCXP_H2I_SEND_REQ, 884 bfi_h2i_set(send_req->mh, BFI_MC_FCXP, BFI_FCXP_H2I_SEND_REQ,
886 bfa_lpuid(bfa)); 885 bfa_lpuid(bfa));
887 886
888 send_req->fcxp_tag = bfa_os_htons(fcxp->fcxp_tag); 887 send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag);
889 if (rport) { 888 if (rport) {
890 send_req->rport_fw_hndl = rport->fw_handle; 889 send_req->rport_fw_hndl = rport->fw_handle;
891 send_req->max_frmsz = bfa_os_htons(rport->rport_info.max_frmsz); 890 send_req->max_frmsz = cpu_to_be16(rport->rport_info.max_frmsz);
892 if (send_req->max_frmsz == 0) 891 if (send_req->max_frmsz == 0)
893 send_req->max_frmsz = bfa_os_htons(FC_MAX_PDUSZ); 892 send_req->max_frmsz = cpu_to_be16(FC_MAX_PDUSZ);
894 } else { 893 } else {
895 send_req->rport_fw_hndl = 0; 894 send_req->rport_fw_hndl = 0;
896 send_req->max_frmsz = bfa_os_htons(FC_MAX_PDUSZ); 895 send_req->max_frmsz = cpu_to_be16(FC_MAX_PDUSZ);
897 } 896 }
898 897
899 send_req->vf_id = bfa_os_htons(reqi->vf_id); 898 send_req->vf_id = cpu_to_be16(reqi->vf_id);
900 send_req->lp_tag = reqi->lp_tag; 899 send_req->lp_tag = reqi->lp_tag;
901 send_req->class = reqi->class; 900 send_req->class = reqi->class;
902 send_req->rsp_timeout = rspi->rsp_timeout; 901 send_req->rsp_timeout = rspi->rsp_timeout;
903 send_req->cts = reqi->cts; 902 send_req->cts = reqi->cts;
904 send_req->fchs = reqi->fchs; 903 send_req->fchs = reqi->fchs;
905 904
906 send_req->req_len = bfa_os_htonl(reqi->req_tot_len); 905 send_req->req_len = cpu_to_be32(reqi->req_tot_len);
907 send_req->rsp_maxlen = bfa_os_htonl(rspi->rsp_maxlen); 906 send_req->rsp_maxlen = cpu_to_be32(rspi->rsp_maxlen);
908 907
909 /* 908 /*
910 * setup req sgles 909 * setup req sgles
@@ -955,11 +954,11 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req)
955 bfa_trc(bfa, bfa_reqq_ci(bfa, BFA_REQQ_FCXP)); 954 bfa_trc(bfa, bfa_reqq_ci(bfa, BFA_REQQ_FCXP));
956} 955}
957 956
958/** 957/*
959 * hal_fcxp_api BFA FCXP API 958 * hal_fcxp_api BFA FCXP API
960 */ 959 */
961 960
962/** 961/*
963 * Allocate an FCXP instance to send a response or to send a request 962 * Allocate an FCXP instance to send a response or to send a request
964 * that has a response. Request/response buffers are allocated by caller. 963 * that has a response. Request/response buffers are allocated by caller.
965 * 964 *
@@ -1005,7 +1004,7 @@ bfa_fcxp_alloc(void *caller, struct bfa_s *bfa, int nreq_sgles,
1005 return fcxp; 1004 return fcxp;
1006} 1005}
1007 1006
1008/** 1007/*
1009 * Get the internal request buffer pointer 1008 * Get the internal request buffer pointer
1010 * 1009 *
1011 * @param[in] fcxp BFA fcxp pointer 1010 * @param[in] fcxp BFA fcxp pointer
@@ -1032,7 +1031,7 @@ bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp)
1032 return mod->req_pld_sz; 1031 return mod->req_pld_sz;
1033} 1032}
1034 1033
1035/** 1034/*
1036 * Get the internal response buffer pointer 1035 * Get the internal response buffer pointer
1037 * 1036 *
1038 * @param[in] fcxp BFA fcxp pointer 1037 * @param[in] fcxp BFA fcxp pointer
@@ -1052,7 +1051,7 @@ bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp)
1052 return rspbuf; 1051 return rspbuf;
1053} 1052}
1054 1053
1055/** 1054/*
1056 * Free the BFA FCXP 1055 * Free the BFA FCXP
1057 * 1056 *
1058 * @param[in] fcxp BFA fcxp pointer 1057 * @param[in] fcxp BFA fcxp pointer
@@ -1069,7 +1068,7 @@ bfa_fcxp_free(struct bfa_fcxp_s *fcxp)
1069 bfa_fcxp_put(fcxp); 1068 bfa_fcxp_put(fcxp);
1070} 1069}
1071 1070
1072/** 1071/*
1073 * Send a FCXP request 1072 * Send a FCXP request
1074 * 1073 *
1075 * @param[in] fcxp BFA fcxp pointer 1074 * @param[in] fcxp BFA fcxp pointer
@@ -1103,7 +1102,7 @@ bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport,
1103 1102
1104 bfa_trc(bfa, fcxp->fcxp_tag); 1103 bfa_trc(bfa, fcxp->fcxp_tag);
1105 1104
1106 /** 1105 /*
1107 * setup request/response info 1106 * setup request/response info
1108 */ 1107 */
1109 reqi->bfa_rport = rport; 1108 reqi->bfa_rport = rport;
@@ -1118,7 +1117,7 @@ bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport,
1118 fcxp->send_cbfn = cbfn ? cbfn : bfa_fcxp_null_comp; 1117 fcxp->send_cbfn = cbfn ? cbfn : bfa_fcxp_null_comp;
1119 fcxp->send_cbarg = cbarg; 1118 fcxp->send_cbarg = cbarg;
1120 1119
1121 /** 1120 /*
1122 * If no room in CPE queue, wait for space in request queue 1121 * If no room in CPE queue, wait for space in request queue
1123 */ 1122 */
1124 send_req = bfa_reqq_next(bfa, BFA_REQQ_FCXP); 1123 send_req = bfa_reqq_next(bfa, BFA_REQQ_FCXP);
@@ -1132,7 +1131,7 @@ bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport,
1132 bfa_fcxp_queue(fcxp, send_req); 1131 bfa_fcxp_queue(fcxp, send_req);
1133} 1132}
1134 1133
1135/** 1134/*
1136 * Abort a BFA FCXP 1135 * Abort a BFA FCXP
1137 * 1136 *
1138 * @param[in] fcxp BFA fcxp pointer 1137 * @param[in] fcxp BFA fcxp pointer
@@ -1186,7 +1185,7 @@ bfa_fcxp_walloc_cancel(struct bfa_s *bfa, struct bfa_fcxp_wqe_s *wqe)
1186void 1185void
1187bfa_fcxp_discard(struct bfa_fcxp_s *fcxp) 1186bfa_fcxp_discard(struct bfa_fcxp_s *fcxp)
1188{ 1187{
1189 /** 1188 /*
1190 * If waiting for room in request queue, cancel reqq wait 1189 * If waiting for room in request queue, cancel reqq wait
1191 * and free fcxp. 1190 * and free fcxp.
1192 */ 1191 */
@@ -1202,7 +1201,7 @@ bfa_fcxp_discard(struct bfa_fcxp_s *fcxp)
1202 1201
1203 1202
1204 1203
1205/** 1204/*
1206 * hal_fcxp_public BFA FCXP public functions 1205 * hal_fcxp_public BFA FCXP public functions
1207 */ 1206 */
1208 1207
@@ -1229,11 +1228,11 @@ bfa_fcxp_get_maxrsp(struct bfa_s *bfa)
1229} 1228}
1230 1229
1231 1230
1232/** 1231/*
1233 * BFA LPS state machine functions 1232 * BFA LPS state machine functions
1234 */ 1233 */
1235 1234
1236/** 1235/*
1237 * Init state -- no login 1236 * Init state -- no login
1238 */ 1237 */
1239static void 1238static void
@@ -1285,7 +1284,7 @@ bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event)
1285 } 1284 }
1286} 1285}
1287 1286
1288/** 1287/*
1289 * login is in progress -- awaiting response from firmware 1288 * login is in progress -- awaiting response from firmware
1290 */ 1289 */
1291static void 1290static void
@@ -1327,7 +1326,7 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event)
1327 } 1326 }
1328} 1327}
1329 1328
1330/** 1329/*
1331 * login pending - awaiting space in request queue 1330 * login pending - awaiting space in request queue
1332 */ 1331 */
1333static void 1332static void
@@ -1359,7 +1358,7 @@ bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event event)
1359 } 1358 }
1360} 1359}
1361 1360
1362/** 1361/*
1363 * login complete 1362 * login complete
1364 */ 1363 */
1365static void 1364static void
@@ -1400,7 +1399,7 @@ bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event)
1400 } 1399 }
1401} 1400}
1402 1401
1403/** 1402/*
1404 * logout in progress - awaiting firmware response 1403 * logout in progress - awaiting firmware response
1405 */ 1404 */
1406static void 1405static void
@@ -1424,7 +1423,7 @@ bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event)
1424 } 1423 }
1425} 1424}
1426 1425
1427/** 1426/*
1428 * logout pending -- awaiting space in request queue 1427 * logout pending -- awaiting space in request queue
1429 */ 1428 */
1430static void 1429static void
@@ -1451,11 +1450,11 @@ bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event event)
1451 1450
1452 1451
1453 1452
1454/** 1453/*
1455 * lps_pvt BFA LPS private functions 1454 * lps_pvt BFA LPS private functions
1456 */ 1455 */
1457 1456
1458/** 1457/*
1459 * return memory requirement 1458 * return memory requirement
1460 */ 1459 */
1461static void 1460static void
@@ -1468,7 +1467,7 @@ bfa_lps_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len,
1468 *ndm_len += sizeof(struct bfa_lps_s) * BFA_LPS_MAX_LPORTS; 1467 *ndm_len += sizeof(struct bfa_lps_s) * BFA_LPS_MAX_LPORTS;
1469} 1468}
1470 1469
1471/** 1470/*
1472 * bfa module attach at initialization time 1471 * bfa module attach at initialization time
1473 */ 1472 */
1474static void 1473static void
@@ -1479,7 +1478,7 @@ bfa_lps_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
1479 struct bfa_lps_s *lps; 1478 struct bfa_lps_s *lps;
1480 int i; 1479 int i;
1481 1480
1482 bfa_os_memset(mod, 0, sizeof(struct bfa_lps_mod_s)); 1481 memset(mod, 0, sizeof(struct bfa_lps_mod_s));
1483 mod->num_lps = BFA_LPS_MAX_LPORTS; 1482 mod->num_lps = BFA_LPS_MAX_LPORTS;
1484 if (cfg->drvcfg.min_cfg) 1483 if (cfg->drvcfg.min_cfg)
1485 mod->num_lps = BFA_LPS_MIN_LPORTS; 1484 mod->num_lps = BFA_LPS_MIN_LPORTS;
@@ -1516,7 +1515,7 @@ bfa_lps_stop(struct bfa_s *bfa)
1516{ 1515{
1517} 1516}
1518 1517
1519/** 1518/*
1520 * IOC in disabled state -- consider all lps offline 1519 * IOC in disabled state -- consider all lps offline
1521 */ 1520 */
1522static void 1521static void
@@ -1532,7 +1531,7 @@ bfa_lps_iocdisable(struct bfa_s *bfa)
1532 } 1531 }
1533} 1532}
1534 1533
1535/** 1534/*
1536 * Firmware login response 1535 * Firmware login response
1537 */ 1536 */
1538static void 1537static void
@@ -1550,7 +1549,7 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp)
1550 lps->fport = rsp->f_port; 1549 lps->fport = rsp->f_port;
1551 lps->npiv_en = rsp->npiv_en; 1550 lps->npiv_en = rsp->npiv_en;
1552 lps->lp_pid = rsp->lp_pid; 1551 lps->lp_pid = rsp->lp_pid;
1553 lps->pr_bbcred = bfa_os_ntohs(rsp->bb_credit); 1552 lps->pr_bbcred = be16_to_cpu(rsp->bb_credit);
1554 lps->pr_pwwn = rsp->port_name; 1553 lps->pr_pwwn = rsp->port_name;
1555 lps->pr_nwwn = rsp->node_name; 1554 lps->pr_nwwn = rsp->node_name;
1556 lps->auth_req = rsp->auth_req; 1555 lps->auth_req = rsp->auth_req;
@@ -1579,7 +1578,7 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp)
1579 bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); 1578 bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP);
1580} 1579}
1581 1580
1582/** 1581/*
1583 * Firmware logout response 1582 * Firmware logout response
1584 */ 1583 */
1585static void 1584static void
@@ -1594,7 +1593,7 @@ bfa_lps_logout_rsp(struct bfa_s *bfa, struct bfi_lps_logout_rsp_s *rsp)
1594 bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); 1593 bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP);
1595} 1594}
1596 1595
1597/** 1596/*
1598 * Firmware received a Clear virtual link request (for FCoE) 1597 * Firmware received a Clear virtual link request (for FCoE)
1599 */ 1598 */
1600static void 1599static void
@@ -1608,7 +1607,7 @@ bfa_lps_rx_cvl_event(struct bfa_s *bfa, struct bfi_lps_cvl_event_s *cvl)
1608 bfa_sm_send_event(lps, BFA_LPS_SM_RX_CVL); 1607 bfa_sm_send_event(lps, BFA_LPS_SM_RX_CVL);
1609} 1608}
1610 1609
1611/** 1610/*
1612 * Space is available in request queue, resume queueing request to firmware. 1611 * Space is available in request queue, resume queueing request to firmware.
1613 */ 1612 */
1614static void 1613static void
@@ -1619,7 +1618,7 @@ bfa_lps_reqq_resume(void *lps_arg)
1619 bfa_sm_send_event(lps, BFA_LPS_SM_RESUME); 1618 bfa_sm_send_event(lps, BFA_LPS_SM_RESUME);
1620} 1619}
1621 1620
1622/** 1621/*
1623 * lps is freed -- triggered by vport delete 1622 * lps is freed -- triggered by vport delete
1624 */ 1623 */
1625static void 1624static void
@@ -1632,7 +1631,7 @@ bfa_lps_free(struct bfa_lps_s *lps)
1632 list_add_tail(&lps->qe, &mod->lps_free_q); 1631 list_add_tail(&lps->qe, &mod->lps_free_q);
1633} 1632}
1634 1633
1635/** 1634/*
1636 * send login request to firmware 1635 * send login request to firmware
1637 */ 1636 */
1638static void 1637static void
@@ -1648,7 +1647,7 @@ bfa_lps_send_login(struct bfa_lps_s *lps)
1648 1647
1649 m->lp_tag = lps->lp_tag; 1648 m->lp_tag = lps->lp_tag;
1650 m->alpa = lps->alpa; 1649 m->alpa = lps->alpa;
1651 m->pdu_size = bfa_os_htons(lps->pdusz); 1650 m->pdu_size = cpu_to_be16(lps->pdusz);
1652 m->pwwn = lps->pwwn; 1651 m->pwwn = lps->pwwn;
1653 m->nwwn = lps->nwwn; 1652 m->nwwn = lps->nwwn;
1654 m->fdisc = lps->fdisc; 1653 m->fdisc = lps->fdisc;
@@ -1657,7 +1656,7 @@ bfa_lps_send_login(struct bfa_lps_s *lps)
1657 bfa_reqq_produce(lps->bfa, lps->reqq); 1656 bfa_reqq_produce(lps->bfa, lps->reqq);
1658} 1657}
1659 1658
1660/** 1659/*
1661 * send logout request to firmware 1660 * send logout request to firmware
1662 */ 1661 */
1663static void 1662static void
@@ -1676,7 +1675,7 @@ bfa_lps_send_logout(struct bfa_lps_s *lps)
1676 bfa_reqq_produce(lps->bfa, lps->reqq); 1675 bfa_reqq_produce(lps->bfa, lps->reqq);
1677} 1676}
1678 1677
1679/** 1678/*
1680 * Indirect login completion handler for non-fcs 1679 * Indirect login completion handler for non-fcs
1681 */ 1680 */
1682static void 1681static void
@@ -1693,7 +1692,7 @@ bfa_lps_login_comp_cb(void *arg, bfa_boolean_t complete)
1693 bfa_cb_lps_flogi_comp(lps->bfa->bfad, lps->uarg, lps->status); 1692 bfa_cb_lps_flogi_comp(lps->bfa->bfad, lps->uarg, lps->status);
1694} 1693}
1695 1694
1696/** 1695/*
1697 * Login completion handler -- direct call for fcs, queue for others 1696 * Login completion handler -- direct call for fcs, queue for others
1698 */ 1697 */
1699static void 1698static void
@@ -1711,7 +1710,7 @@ bfa_lps_login_comp(struct bfa_lps_s *lps)
1711 bfa_cb_lps_flogi_comp(lps->bfa->bfad, lps->uarg, lps->status); 1710 bfa_cb_lps_flogi_comp(lps->bfa->bfad, lps->uarg, lps->status);
1712} 1711}
1713 1712
1714/** 1713/*
1715 * Indirect logout completion handler for non-fcs 1714 * Indirect logout completion handler for non-fcs
1716 */ 1715 */
1717static void 1716static void
@@ -1726,7 +1725,7 @@ bfa_lps_logout_comp_cb(void *arg, bfa_boolean_t complete)
1726 bfa_cb_lps_fdisclogo_comp(lps->bfa->bfad, lps->uarg); 1725 bfa_cb_lps_fdisclogo_comp(lps->bfa->bfad, lps->uarg);
1727} 1726}
1728 1727
1729/** 1728/*
1730 * Logout completion handler -- direct call for fcs, queue for others 1729 * Logout completion handler -- direct call for fcs, queue for others
1731 */ 1730 */
1732static void 1731static void
@@ -1741,7 +1740,7 @@ bfa_lps_logout_comp(struct bfa_lps_s *lps)
1741 bfa_cb_lps_fdisclogo_comp(lps->bfa->bfad, lps->uarg); 1740 bfa_cb_lps_fdisclogo_comp(lps->bfa->bfad, lps->uarg);
1742} 1741}
1743 1742
1744/** 1743/*
1745 * Clear virtual link completion handler for non-fcs 1744 * Clear virtual link completion handler for non-fcs
1746 */ 1745 */
1747static void 1746static void
@@ -1757,7 +1756,7 @@ bfa_lps_cvl_event_cb(void *arg, bfa_boolean_t complete)
1757 bfa_cb_lps_cvl_event(lps->bfa->bfad, lps->uarg); 1756 bfa_cb_lps_cvl_event(lps->bfa->bfad, lps->uarg);
1758} 1757}
1759 1758
1760/** 1759/*
1761 * Received Clear virtual link event --direct call for fcs, 1760 * Received Clear virtual link event --direct call for fcs,
1762 * queue for others 1761 * queue for others
1763 */ 1762 */
@@ -1777,7 +1776,7 @@ bfa_lps_cvl_event(struct bfa_lps_s *lps)
1777 1776
1778 1777
1779 1778
1780/** 1779/*
1781 * lps_public BFA LPS public functions 1780 * lps_public BFA LPS public functions
1782 */ 1781 */
1783 1782
@@ -1790,7 +1789,7 @@ bfa_lps_get_max_vport(struct bfa_s *bfa)
1790 return BFA_LPS_MAX_VPORTS_SUPP_CB; 1789 return BFA_LPS_MAX_VPORTS_SUPP_CB;
1791} 1790}
1792 1791
1793/** 1792/*
1794 * Allocate a lport srvice tag. 1793 * Allocate a lport srvice tag.
1795 */ 1794 */
1796struct bfa_lps_s * 1795struct bfa_lps_s *
@@ -1810,7 +1809,7 @@ bfa_lps_alloc(struct bfa_s *bfa)
1810 return lps; 1809 return lps;
1811} 1810}
1812 1811
1813/** 1812/*
1814 * Free lport service tag. This can be called anytime after an alloc. 1813 * Free lport service tag. This can be called anytime after an alloc.
1815 * No need to wait for any pending login/logout completions. 1814 * No need to wait for any pending login/logout completions.
1816 */ 1815 */
@@ -1820,7 +1819,7 @@ bfa_lps_delete(struct bfa_lps_s *lps)
1820 bfa_sm_send_event(lps, BFA_LPS_SM_DELETE); 1819 bfa_sm_send_event(lps, BFA_LPS_SM_DELETE);
1821} 1820}
1822 1821
1823/** 1822/*
1824 * Initiate a lport login. 1823 * Initiate a lport login.
1825 */ 1824 */
1826void 1825void
@@ -1837,7 +1836,7 @@ bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, u16 pdusz,
1837 bfa_sm_send_event(lps, BFA_LPS_SM_LOGIN); 1836 bfa_sm_send_event(lps, BFA_LPS_SM_LOGIN);
1838} 1837}
1839 1838
1840/** 1839/*
1841 * Initiate a lport fdisc login. 1840 * Initiate a lport fdisc login.
1842 */ 1841 */
1843void 1842void
@@ -1854,7 +1853,7 @@ bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz, wwn_t pwwn,
1854 bfa_sm_send_event(lps, BFA_LPS_SM_LOGIN); 1853 bfa_sm_send_event(lps, BFA_LPS_SM_LOGIN);
1855} 1854}
1856 1855
1857/** 1856/*
1858 * Initiate a lport logout (flogi). 1857 * Initiate a lport logout (flogi).
1859 */ 1858 */
1860void 1859void
@@ -1863,7 +1862,7 @@ bfa_lps_flogo(struct bfa_lps_s *lps)
1863 bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT); 1862 bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT);
1864} 1863}
1865 1864
1866/** 1865/*
1867 * Initiate a lport FDSIC logout. 1866 * Initiate a lport FDSIC logout.
1868 */ 1867 */
1869void 1868void
@@ -1872,7 +1871,7 @@ bfa_lps_fdisclogo(struct bfa_lps_s *lps)
1872 bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT); 1871 bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT);
1873} 1872}
1874 1873
1875/** 1874/*
1876 * Discard a pending login request -- should be called only for 1875 * Discard a pending login request -- should be called only for
1877 * link down handling. 1876 * link down handling.
1878 */ 1877 */
@@ -1882,7 +1881,7 @@ bfa_lps_discard(struct bfa_lps_s *lps)
1882 bfa_sm_send_event(lps, BFA_LPS_SM_OFFLINE); 1881 bfa_sm_send_event(lps, BFA_LPS_SM_OFFLINE);
1883} 1882}
1884 1883
1885/** 1884/*
1886 * Return lport services tag 1885 * Return lport services tag
1887 */ 1886 */
1888u8 1887u8
@@ -1891,7 +1890,7 @@ bfa_lps_get_tag(struct bfa_lps_s *lps)
1891 return lps->lp_tag; 1890 return lps->lp_tag;
1892} 1891}
1893 1892
1894/** 1893/*
1895 * Return lport services tag given the pid 1894 * Return lport services tag given the pid
1896 */ 1895 */
1897u8 1896u8
@@ -1910,7 +1909,7 @@ bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid)
1910 return 0; 1909 return 0;
1911} 1910}
1912 1911
1913/** 1912/*
1914 * return if fabric login indicates support for NPIV 1913 * return if fabric login indicates support for NPIV
1915 */ 1914 */
1916bfa_boolean_t 1915bfa_boolean_t
@@ -1919,7 +1918,7 @@ bfa_lps_is_npiv_en(struct bfa_lps_s *lps)
1919 return lps->npiv_en; 1918 return lps->npiv_en;
1920} 1919}
1921 1920
1922/** 1921/*
1923 * Return TRUE if attached to F-Port, else return FALSE 1922 * Return TRUE if attached to F-Port, else return FALSE
1924 */ 1923 */
1925bfa_boolean_t 1924bfa_boolean_t
@@ -1928,7 +1927,7 @@ bfa_lps_is_fport(struct bfa_lps_s *lps)
1928 return lps->fport; 1927 return lps->fport;
1929} 1928}
1930 1929
1931/** 1930/*
1932 * Return TRUE if attached to a Brocade Fabric 1931 * Return TRUE if attached to a Brocade Fabric
1933 */ 1932 */
1934bfa_boolean_t 1933bfa_boolean_t
@@ -1936,7 +1935,7 @@ bfa_lps_is_brcd_fabric(struct bfa_lps_s *lps)
1936{ 1935{
1937 return lps->brcd_switch; 1936 return lps->brcd_switch;
1938} 1937}
1939/** 1938/*
1940 * return TRUE if authentication is required 1939 * return TRUE if authentication is required
1941 */ 1940 */
1942bfa_boolean_t 1941bfa_boolean_t
@@ -1951,7 +1950,7 @@ bfa_lps_get_extstatus(struct bfa_lps_s *lps)
1951 return lps->ext_status; 1950 return lps->ext_status;
1952} 1951}
1953 1952
1954/** 1953/*
1955 * return port id assigned to the lport 1954 * return port id assigned to the lport
1956 */ 1955 */
1957u32 1956u32
@@ -1960,7 +1959,7 @@ bfa_lps_get_pid(struct bfa_lps_s *lps)
1960 return lps->lp_pid; 1959 return lps->lp_pid;
1961} 1960}
1962 1961
1963/** 1962/*
1964 * return port id assigned to the base lport 1963 * return port id assigned to the base lport
1965 */ 1964 */
1966u32 1965u32
@@ -1971,7 +1970,7 @@ bfa_lps_get_base_pid(struct bfa_s *bfa)
1971 return BFA_LPS_FROM_TAG(mod, 0)->lp_pid; 1970 return BFA_LPS_FROM_TAG(mod, 0)->lp_pid;
1972} 1971}
1973 1972
1974/** 1973/*
1975 * Return bb_credit assigned in FLOGI response 1974 * Return bb_credit assigned in FLOGI response
1976 */ 1975 */
1977u16 1976u16
@@ -1980,7 +1979,7 @@ bfa_lps_get_peer_bbcredit(struct bfa_lps_s *lps)
1980 return lps->pr_bbcred; 1979 return lps->pr_bbcred;
1981} 1980}
1982 1981
1983/** 1982/*
1984 * Return peer port name 1983 * Return peer port name
1985 */ 1984 */
1986wwn_t 1985wwn_t
@@ -1989,7 +1988,7 @@ bfa_lps_get_peer_pwwn(struct bfa_lps_s *lps)
1989 return lps->pr_pwwn; 1988 return lps->pr_pwwn;
1990} 1989}
1991 1990
1992/** 1991/*
1993 * Return peer node name 1992 * Return peer node name
1994 */ 1993 */
1995wwn_t 1994wwn_t
@@ -1998,7 +1997,7 @@ bfa_lps_get_peer_nwwn(struct bfa_lps_s *lps)
1998 return lps->pr_nwwn; 1997 return lps->pr_nwwn;
1999} 1998}
2000 1999
2001/** 2000/*
2002 * return reason code if login request is rejected 2001 * return reason code if login request is rejected
2003 */ 2002 */
2004u8 2003u8
@@ -2007,7 +2006,7 @@ bfa_lps_get_lsrjt_rsn(struct bfa_lps_s *lps)
2007 return lps->lsrjt_rsn; 2006 return lps->lsrjt_rsn;
2008} 2007}
2009 2008
2010/** 2009/*
2011 * return explanation code if login request is rejected 2010 * return explanation code if login request is rejected
2012 */ 2011 */
2013u8 2012u8
@@ -2016,7 +2015,7 @@ bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps)
2016 return lps->lsrjt_expl; 2015 return lps->lsrjt_expl;
2017} 2016}
2018 2017
2019/** 2018/*
2020 * Return fpma/spma MAC for lport 2019 * Return fpma/spma MAC for lport
2021 */ 2020 */
2022mac_t 2021mac_t
@@ -2025,7 +2024,7 @@ bfa_lps_get_lp_mac(struct bfa_lps_s *lps)
2025 return lps->lp_mac; 2024 return lps->lp_mac;
2026} 2025}
2027 2026
2028/** 2027/*
2029 * LPS firmware message class handler. 2028 * LPS firmware message class handler.
2030 */ 2029 */
2031void 2030void
@@ -2055,7 +2054,7 @@ bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
2055 } 2054 }
2056} 2055}
2057 2056
2058/** 2057/*
2059 * FC PORT state machine functions 2058 * FC PORT state machine functions
2060 */ 2059 */
2061static void 2060static void
@@ -2066,7 +2065,7 @@ bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
2066 2065
2067 switch (event) { 2066 switch (event) {
2068 case BFA_FCPORT_SM_START: 2067 case BFA_FCPORT_SM_START:
2069 /** 2068 /*
2070 * Start event after IOC is configured and BFA is started. 2069 * Start event after IOC is configured and BFA is started.
2071 */ 2070 */
2072 if (bfa_fcport_send_enable(fcport)) { 2071 if (bfa_fcport_send_enable(fcport)) {
@@ -2080,7 +2079,7 @@ bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
2080 break; 2079 break;
2081 2080
2082 case BFA_FCPORT_SM_ENABLE: 2081 case BFA_FCPORT_SM_ENABLE:
2083 /** 2082 /*
2084 * Port is persistently configured to be in enabled state. Do 2083 * Port is persistently configured to be in enabled state. Do
2085 * not change state. Port enabling is done when START event is 2084 * not change state. Port enabling is done when START event is
2086 * received. 2085 * received.
@@ -2088,7 +2087,7 @@ bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
2088 break; 2087 break;
2089 2088
2090 case BFA_FCPORT_SM_DISABLE: 2089 case BFA_FCPORT_SM_DISABLE:
2091 /** 2090 /*
2092 * If a port is persistently configured to be disabled, the 2091 * If a port is persistently configured to be disabled, the
2093 * first event will a port disable request. 2092 * first event will a port disable request.
2094 */ 2093 */
@@ -2124,13 +2123,13 @@ bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport,
2124 break; 2123 break;
2125 2124
2126 case BFA_FCPORT_SM_ENABLE: 2125 case BFA_FCPORT_SM_ENABLE:
2127 /** 2126 /*
2128 * Already enable is in progress. 2127 * Already enable is in progress.
2129 */ 2128 */
2130 break; 2129 break;
2131 2130
2132 case BFA_FCPORT_SM_DISABLE: 2131 case BFA_FCPORT_SM_DISABLE:
2133 /** 2132 /*
2134 * Just send disable request to firmware when room becomes 2133 * Just send disable request to firmware when room becomes
2135 * available in request queue. 2134 * available in request queue.
2136 */ 2135 */
@@ -2145,7 +2144,7 @@ bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport,
2145 2144
2146 case BFA_FCPORT_SM_LINKUP: 2145 case BFA_FCPORT_SM_LINKUP:
2147 case BFA_FCPORT_SM_LINKDOWN: 2146 case BFA_FCPORT_SM_LINKDOWN:
2148 /** 2147 /*
2149 * Possible to get link events when doing back-to-back 2148 * Possible to get link events when doing back-to-back
2150 * enable/disables. 2149 * enable/disables.
2151 */ 2150 */
@@ -2184,7 +2183,7 @@ bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport,
2184 break; 2183 break;
2185 2184
2186 case BFA_FCPORT_SM_ENABLE: 2185 case BFA_FCPORT_SM_ENABLE:
2187 /** 2186 /*
2188 * Already being enabled. 2187 * Already being enabled.
2189 */ 2188 */
2190 break; 2189 break;
@@ -2257,13 +2256,13 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
2257 break; 2256 break;
2258 2257
2259 case BFA_FCPORT_SM_LINKDOWN: 2258 case BFA_FCPORT_SM_LINKDOWN:
2260 /** 2259 /*
2261 * Possible to get link down event. 2260 * Possible to get link down event.
2262 */ 2261 */
2263 break; 2262 break;
2264 2263
2265 case BFA_FCPORT_SM_ENABLE: 2264 case BFA_FCPORT_SM_ENABLE:
2266 /** 2265 /*
2267 * Already enabled. 2266 * Already enabled.
2268 */ 2267 */
2269 break; 2268 break;
@@ -2306,7 +2305,7 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
2306 2305
2307 switch (event) { 2306 switch (event) {
2308 case BFA_FCPORT_SM_ENABLE: 2307 case BFA_FCPORT_SM_ENABLE:
2309 /** 2308 /*
2310 * Already enabled. 2309 * Already enabled.
2311 */ 2310 */
2312 break; 2311 break;
@@ -2399,14 +2398,14 @@ bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport,
2399 break; 2398 break;
2400 2399
2401 case BFA_FCPORT_SM_DISABLE: 2400 case BFA_FCPORT_SM_DISABLE:
2402 /** 2401 /*
2403 * Already being disabled. 2402 * Already being disabled.
2404 */ 2403 */
2405 break; 2404 break;
2406 2405
2407 case BFA_FCPORT_SM_LINKUP: 2406 case BFA_FCPORT_SM_LINKUP:
2408 case BFA_FCPORT_SM_LINKDOWN: 2407 case BFA_FCPORT_SM_LINKDOWN:
2409 /** 2408 /*
2410 * Possible to get link events when doing back-to-back 2409 * Possible to get link events when doing back-to-back
2411 * enable/disables. 2410 * enable/disables.
2412 */ 2411 */
@@ -2453,7 +2452,7 @@ bfa_fcport_sm_toggling_qwait(struct bfa_fcport_s *fcport,
2453 2452
2454 case BFA_FCPORT_SM_LINKUP: 2453 case BFA_FCPORT_SM_LINKUP:
2455 case BFA_FCPORT_SM_LINKDOWN: 2454 case BFA_FCPORT_SM_LINKDOWN:
2456 /** 2455 /*
2457 * Possible to get link events when doing back-to-back 2456 * Possible to get link events when doing back-to-back
2458 * enable/disables. 2457 * enable/disables.
2459 */ 2458 */
@@ -2483,7 +2482,7 @@ bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport,
2483 break; 2482 break;
2484 2483
2485 case BFA_FCPORT_SM_DISABLE: 2484 case BFA_FCPORT_SM_DISABLE:
2486 /** 2485 /*
2487 * Already being disabled. 2486 * Already being disabled.
2488 */ 2487 */
2489 break; 2488 break;
@@ -2508,7 +2507,7 @@ bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport,
2508 2507
2509 case BFA_FCPORT_SM_LINKUP: 2508 case BFA_FCPORT_SM_LINKUP:
2510 case BFA_FCPORT_SM_LINKDOWN: 2509 case BFA_FCPORT_SM_LINKDOWN:
2511 /** 2510 /*
2512 * Possible to get link events when doing back-to-back 2511 * Possible to get link events when doing back-to-back
2513 * enable/disables. 2512 * enable/disables.
2514 */ 2513 */
@@ -2533,7 +2532,7 @@ bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport,
2533 2532
2534 switch (event) { 2533 switch (event) {
2535 case BFA_FCPORT_SM_START: 2534 case BFA_FCPORT_SM_START:
2536 /** 2535 /*
2537 * Ignore start event for a port that is disabled. 2536 * Ignore start event for a port that is disabled.
2538 */ 2537 */
2539 break; 2538 break;
@@ -2557,7 +2556,7 @@ bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport,
2557 break; 2556 break;
2558 2557
2559 case BFA_FCPORT_SM_DISABLE: 2558 case BFA_FCPORT_SM_DISABLE:
2560 /** 2559 /*
2561 * Already disabled. 2560 * Already disabled.
2562 */ 2561 */
2563 break; 2562 break;
@@ -2587,14 +2586,14 @@ bfa_fcport_sm_stopped(struct bfa_fcport_s *fcport,
2587 break; 2586 break;
2588 2587
2589 default: 2588 default:
2590 /** 2589 /*
2591 * Ignore all other events. 2590 * Ignore all other events.
2592 */ 2591 */
2593 ; 2592 ;
2594 } 2593 }
2595} 2594}
2596 2595
2597/** 2596/*
2598 * Port is enabled. IOC is down/failed. 2597 * Port is enabled. IOC is down/failed.
2599 */ 2598 */
2600static void 2599static void
@@ -2613,14 +2612,14 @@ bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport,
2613 break; 2612 break;
2614 2613
2615 default: 2614 default:
2616 /** 2615 /*
2617 * Ignore all events. 2616 * Ignore all events.
2618 */ 2617 */
2619 ; 2618 ;
2620 } 2619 }
2621} 2620}
2622 2621
2623/** 2622/*
2624 * Port is disabled. IOC is down/failed. 2623 * Port is disabled. IOC is down/failed.
2625 */ 2624 */
2626static void 2625static void
@@ -2639,14 +2638,14 @@ bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport,
2639 break; 2638 break;
2640 2639
2641 default: 2640 default:
2642 /** 2641 /*
2643 * Ignore all events. 2642 * Ignore all events.
2644 */ 2643 */
2645 ; 2644 ;
2646 } 2645 }
2647} 2646}
2648 2647
2649/** 2648/*
2650 * Link state is down 2649 * Link state is down
2651 */ 2650 */
2652static void 2651static void
@@ -2666,7 +2665,7 @@ bfa_fcport_ln_sm_dn(struct bfa_fcport_ln_s *ln,
2666 } 2665 }
2667} 2666}
2668 2667
2669/** 2668/*
2670 * Link state is waiting for down notification 2669 * Link state is waiting for down notification
2671 */ 2670 */
2672static void 2671static void
@@ -2689,7 +2688,7 @@ bfa_fcport_ln_sm_dn_nf(struct bfa_fcport_ln_s *ln,
2689 } 2688 }
2690} 2689}
2691 2690
2692/** 2691/*
2693 * Link state is waiting for down notification and there is a pending up 2692 * Link state is waiting for down notification and there is a pending up
2694 */ 2693 */
2695static void 2694static void
@@ -2713,7 +2712,7 @@ bfa_fcport_ln_sm_dn_up_nf(struct bfa_fcport_ln_s *ln,
2713 } 2712 }
2714} 2713}
2715 2714
2716/** 2715/*
2717 * Link state is up 2716 * Link state is up
2718 */ 2717 */
2719static void 2718static void
@@ -2733,7 +2732,7 @@ bfa_fcport_ln_sm_up(struct bfa_fcport_ln_s *ln,
2733 } 2732 }
2734} 2733}
2735 2734
2736/** 2735/*
2737 * Link state is waiting for up notification 2736 * Link state is waiting for up notification
2738 */ 2737 */
2739static void 2738static void
@@ -2756,7 +2755,7 @@ bfa_fcport_ln_sm_up_nf(struct bfa_fcport_ln_s *ln,
2756 } 2755 }
2757} 2756}
2758 2757
2759/** 2758/*
2760 * Link state is waiting for up notification and there is a pending down 2759 * Link state is waiting for up notification and there is a pending down
2761 */ 2760 */
2762static void 2761static void
@@ -2780,7 +2779,7 @@ bfa_fcport_ln_sm_up_dn_nf(struct bfa_fcport_ln_s *ln,
2780 } 2779 }
2781} 2780}
2782 2781
2783/** 2782/*
2784 * Link state is waiting for up notification and there are pending down and up 2783 * Link state is waiting for up notification and there are pending down and up
2785 */ 2784 */
2786static void 2785static void
@@ -2806,7 +2805,7 @@ bfa_fcport_ln_sm_up_dn_up_nf(struct bfa_fcport_ln_s *ln,
2806 2805
2807 2806
2808 2807
2809/** 2808/*
2810 * hal_port_private 2809 * hal_port_private
2811 */ 2810 */
2812 2811
@@ -2821,7 +2820,7 @@ __bfa_cb_fcport_event(void *cbarg, bfa_boolean_t complete)
2821 bfa_sm_send_event(ln, BFA_FCPORT_LN_SM_NOTIFICATION); 2820 bfa_sm_send_event(ln, BFA_FCPORT_LN_SM_NOTIFICATION);
2822} 2821}
2823 2822
2824/** 2823/*
2825 * Send SCN notification to upper layers. 2824 * Send SCN notification to upper layers.
2826 * trunk - false if caller is fcport to ignore fcport event in trunked mode 2825 * trunk - false if caller is fcport to ignore fcport event in trunked mode
2827 */ 2826 */
@@ -2897,7 +2896,7 @@ bfa_fcport_mem_claim(struct bfa_fcport_s *fcport, struct bfa_meminfo_s *meminfo)
2897 bfa_meminfo_dma_phys(meminfo) = dm_pa; 2896 bfa_meminfo_dma_phys(meminfo) = dm_pa;
2898} 2897}
2899 2898
2900/** 2899/*
2901 * Memory initialization. 2900 * Memory initialization.
2902 */ 2901 */
2903static void 2902static void
@@ -2909,7 +2908,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
2909 struct bfa_fcport_ln_s *ln = &fcport->ln; 2908 struct bfa_fcport_ln_s *ln = &fcport->ln;
2910 struct bfa_timeval_s tv; 2909 struct bfa_timeval_s tv;
2911 2910
2912 bfa_os_memset(fcport, 0, sizeof(struct bfa_fcport_s)); 2911 memset(fcport, 0, sizeof(struct bfa_fcport_s));
2913 fcport->bfa = bfa; 2912 fcport->bfa = bfa;
2914 ln->fcport = fcport; 2913 ln->fcport = fcport;
2915 2914
@@ -2918,13 +2917,13 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
2918 bfa_sm_set_state(fcport, bfa_fcport_sm_uninit); 2917 bfa_sm_set_state(fcport, bfa_fcport_sm_uninit);
2919 bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn); 2918 bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn);
2920 2919
2921 /** 2920 /*
2922 * initialize time stamp for stats reset 2921 * initialize time stamp for stats reset
2923 */ 2922 */
2924 bfa_os_gettimeofday(&tv); 2923 bfa_os_gettimeofday(&tv);
2925 fcport->stats_reset_time = tv.tv_sec; 2924 fcport->stats_reset_time = tv.tv_sec;
2926 2925
2927 /** 2926 /*
2928 * initialize and set default configuration 2927 * initialize and set default configuration
2929 */ 2928 */
2930 port_cfg->topology = BFA_PORT_TOPOLOGY_P2P; 2929 port_cfg->topology = BFA_PORT_TOPOLOGY_P2P;
@@ -2942,7 +2941,7 @@ bfa_fcport_detach(struct bfa_s *bfa)
2942{ 2941{
2943} 2942}
2944 2943
2945/** 2944/*
2946 * Called when IOC is ready. 2945 * Called when IOC is ready.
2947 */ 2946 */
2948static void 2947static void
@@ -2951,7 +2950,7 @@ bfa_fcport_start(struct bfa_s *bfa)
2951 bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_START); 2950 bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_START);
2952} 2951}
2953 2952
2954/** 2953/*
2955 * Called before IOC is stopped. 2954 * Called before IOC is stopped.
2956 */ 2955 */
2957static void 2956static void
@@ -2961,7 +2960,7 @@ bfa_fcport_stop(struct bfa_s *bfa)
2961 bfa_trunk_iocdisable(bfa); 2960 bfa_trunk_iocdisable(bfa);
2962} 2961}
2963 2962
2964/** 2963/*
2965 * Called when IOC failure is detected. 2964 * Called when IOC failure is detected.
2966 */ 2965 */
2967static void 2966static void
@@ -2986,18 +2985,17 @@ bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport)
2986 fcport->myalpa = 0; 2985 fcport->myalpa = 0;
2987 2986
2988 /* QoS Details */ 2987 /* QoS Details */
2989 bfa_os_assign(fcport->qos_attr, pevent->link_state.qos_attr); 2988 fcport->qos_attr = pevent->link_state.qos_attr;
2990 bfa_os_assign(fcport->qos_vc_attr, 2989 fcport->qos_vc_attr = pevent->link_state.vc_fcf.qos_vc_attr;
2991 pevent->link_state.vc_fcf.qos_vc_attr);
2992 2990
2993 /** 2991 /*
2994 * update trunk state if applicable 2992 * update trunk state if applicable
2995 */ 2993 */
2996 if (!fcport->cfg.trunked) 2994 if (!fcport->cfg.trunked)
2997 trunk->attr.state = BFA_TRUNK_DISABLED; 2995 trunk->attr.state = BFA_TRUNK_DISABLED;
2998 2996
2999 /* update FCoE specific */ 2997 /* update FCoE specific */
3000 fcport->fcoe_vlan = bfa_os_ntohs(pevent->link_state.vc_fcf.fcf.vlan); 2998 fcport->fcoe_vlan = be16_to_cpu(pevent->link_state.vc_fcf.fcf.vlan);
3001 2999
3002 bfa_trc(fcport->bfa, fcport->speed); 3000 bfa_trc(fcport->bfa, fcport->speed);
3003 bfa_trc(fcport->bfa, fcport->topology); 3001 bfa_trc(fcport->bfa, fcport->topology);
@@ -3010,7 +3008,7 @@ bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport)
3010 fcport->topology = BFA_PORT_TOPOLOGY_NONE; 3008 fcport->topology = BFA_PORT_TOPOLOGY_NONE;
3011} 3009}
3012 3010
3013/** 3011/*
3014 * Send port enable message to firmware. 3012 * Send port enable message to firmware.
3015 */ 3013 */
3016static bfa_boolean_t 3014static bfa_boolean_t
@@ -3018,13 +3016,13 @@ bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
3018{ 3016{
3019 struct bfi_fcport_enable_req_s *m; 3017 struct bfi_fcport_enable_req_s *m;
3020 3018
3021 /** 3019 /*
3022 * Increment message tag before queue check, so that responses to old 3020 * Increment message tag before queue check, so that responses to old
3023 * requests are discarded. 3021 * requests are discarded.
3024 */ 3022 */
3025 fcport->msgtag++; 3023 fcport->msgtag++;
3026 3024
3027 /** 3025 /*
3028 * check for room in queue to send request now 3026 * check for room in queue to send request now
3029 */ 3027 */
3030 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); 3028 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
@@ -3040,19 +3038,19 @@ bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
3040 m->pwwn = fcport->pwwn; 3038 m->pwwn = fcport->pwwn;
3041 m->port_cfg = fcport->cfg; 3039 m->port_cfg = fcport->cfg;
3042 m->msgtag = fcport->msgtag; 3040 m->msgtag = fcport->msgtag;
3043 m->port_cfg.maxfrsize = bfa_os_htons(fcport->cfg.maxfrsize); 3041 m->port_cfg.maxfrsize = cpu_to_be16(fcport->cfg.maxfrsize);
3044 bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa); 3042 bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa);
3045 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo); 3043 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo);
3046 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi); 3044 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi);
3047 3045
3048 /** 3046 /*
3049 * queue I/O message to firmware 3047 * queue I/O message to firmware
3050 */ 3048 */
3051 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 3049 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
3052 return BFA_TRUE; 3050 return BFA_TRUE;
3053} 3051}
3054 3052
3055/** 3053/*
3056 * Send port disable message to firmware. 3054 * Send port disable message to firmware.
3057 */ 3055 */
3058static bfa_boolean_t 3056static bfa_boolean_t
@@ -3060,13 +3058,13 @@ bfa_fcport_send_disable(struct bfa_fcport_s *fcport)
3060{ 3058{
3061 struct bfi_fcport_req_s *m; 3059 struct bfi_fcport_req_s *m;
3062 3060
3063 /** 3061 /*
3064 * Increment message tag before queue check, so that responses to old 3062 * Increment message tag before queue check, so that responses to old
3065 * requests are discarded. 3063 * requests are discarded.
3066 */ 3064 */
3067 fcport->msgtag++; 3065 fcport->msgtag++;
3068 3066
3069 /** 3067 /*
3070 * check for room in queue to send request now 3068 * check for room in queue to send request now
3071 */ 3069 */
3072 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); 3070 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
@@ -3080,7 +3078,7 @@ bfa_fcport_send_disable(struct bfa_fcport_s *fcport)
3080 bfa_lpuid(fcport->bfa)); 3078 bfa_lpuid(fcport->bfa));
3081 m->msgtag = fcport->msgtag; 3079 m->msgtag = fcport->msgtag;
3082 3080
3083 /** 3081 /*
3084 * queue I/O message to firmware 3082 * queue I/O message to firmware
3085 */ 3083 */
3086 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 3084 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
@@ -3105,7 +3103,7 @@ bfa_fcport_send_txcredit(void *port_cbarg)
3105 struct bfa_fcport_s *fcport = port_cbarg; 3103 struct bfa_fcport_s *fcport = port_cbarg;
3106 struct bfi_fcport_set_svc_params_req_s *m; 3104 struct bfi_fcport_set_svc_params_req_s *m;
3107 3105
3108 /** 3106 /*
3109 * check for room in queue to send request now 3107 * check for room in queue to send request now
3110 */ 3108 */
3111 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); 3109 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
@@ -3116,9 +3114,9 @@ bfa_fcport_send_txcredit(void *port_cbarg)
3116 3114
3117 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ, 3115 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ,
3118 bfa_lpuid(fcport->bfa)); 3116 bfa_lpuid(fcport->bfa));
3119 m->tx_bbcredit = bfa_os_htons((u16)fcport->cfg.tx_bbcredit); 3117 m->tx_bbcredit = cpu_to_be16((u16)fcport->cfg.tx_bbcredit);
3120 3118
3121 /** 3119 /*
3122 * queue I/O message to firmware 3120 * queue I/O message to firmware
3123 */ 3121 */
3124 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 3122 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
@@ -3134,7 +3132,7 @@ bfa_fcport_qos_stats_swap(struct bfa_qos_stats_s *d,
3134 3132
3135 /* Now swap the 32 bit fields */ 3133 /* Now swap the 32 bit fields */
3136 for (i = 0; i < (sizeof(struct bfa_qos_stats_s)/sizeof(u32)); ++i) 3134 for (i = 0; i < (sizeof(struct bfa_qos_stats_s)/sizeof(u32)); ++i)
3137 dip[i] = bfa_os_ntohl(sip[i]); 3135 dip[i] = be32_to_cpu(sip[i]);
3138} 3136}
3139 3137
3140static void 3138static void
@@ -3148,11 +3146,11 @@ bfa_fcport_fcoe_stats_swap(struct bfa_fcoe_stats_s *d,
3148 for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32)); 3146 for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32));
3149 i = i + 2) { 3147 i = i + 2) {
3150#ifdef __BIGENDIAN 3148#ifdef __BIGENDIAN
3151 dip[i] = bfa_os_ntohl(sip[i]); 3149 dip[i] = be32_to_cpu(sip[i]);
3152 dip[i + 1] = bfa_os_ntohl(sip[i + 1]); 3150 dip[i + 1] = be32_to_cpu(sip[i + 1]);
3153#else 3151#else
3154 dip[i] = bfa_os_ntohl(sip[i + 1]); 3152 dip[i] = be32_to_cpu(sip[i + 1]);
3155 dip[i + 1] = bfa_os_ntohl(sip[i]); 3153 dip[i + 1] = be32_to_cpu(sip[i]);
3156#endif 3154#endif
3157 } 3155 }
3158} 3156}
@@ -3223,7 +3221,7 @@ bfa_fcport_send_stats_get(void *cbarg)
3223 } 3221 }
3224 fcport->stats_qfull = BFA_FALSE; 3222 fcport->stats_qfull = BFA_FALSE;
3225 3223
3226 bfa_os_memset(msg, 0, sizeof(struct bfi_fcport_req_s)); 3224 memset(msg, 0, sizeof(struct bfi_fcport_req_s));
3227 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_GET_REQ, 3225 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_GET_REQ,
3228 bfa_lpuid(fcport->bfa)); 3226 bfa_lpuid(fcport->bfa));
3229 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 3227 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
@@ -3237,7 +3235,7 @@ __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete)
3237 if (complete) { 3235 if (complete) {
3238 struct bfa_timeval_s tv; 3236 struct bfa_timeval_s tv;
3239 3237
3240 /** 3238 /*
3241 * re-initialize time stamp for stats reset 3239 * re-initialize time stamp for stats reset
3242 */ 3240 */
3243 bfa_os_gettimeofday(&tv); 3241 bfa_os_gettimeofday(&tv);
@@ -3285,13 +3283,13 @@ bfa_fcport_send_stats_clear(void *cbarg)
3285 } 3283 }
3286 fcport->stats_qfull = BFA_FALSE; 3284 fcport->stats_qfull = BFA_FALSE;
3287 3285
3288 bfa_os_memset(msg, 0, sizeof(struct bfi_fcport_req_s)); 3286 memset(msg, 0, sizeof(struct bfi_fcport_req_s));
3289 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_CLEAR_REQ, 3287 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_CLEAR_REQ,
3290 bfa_lpuid(fcport->bfa)); 3288 bfa_lpuid(fcport->bfa));
3291 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 3289 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
3292} 3290}
3293 3291
3294/** 3292/*
3295 * Handle trunk SCN event from firmware. 3293 * Handle trunk SCN event from firmware.
3296 */ 3294 */
3297static void 3295static void
@@ -3312,7 +3310,7 @@ bfa_trunk_scn(struct bfa_fcport_s *fcport, struct bfi_fcport_trunk_scn_s *scn)
3312 bfa_trc(fcport->bfa, scn->trunk_state); 3310 bfa_trc(fcport->bfa, scn->trunk_state);
3313 bfa_trc(fcport->bfa, scn->trunk_speed); 3311 bfa_trc(fcport->bfa, scn->trunk_speed);
3314 3312
3315 /** 3313 /*
3316 * Save off new state for trunk attribute query 3314 * Save off new state for trunk attribute query
3317 */ 3315 */
3318 state_prev = trunk->attr.state; 3316 state_prev = trunk->attr.state;
@@ -3327,7 +3325,7 @@ bfa_trunk_scn(struct bfa_fcport_s *fcport, struct bfi_fcport_trunk_scn_s *scn)
3327 lattr->trunk_wwn = tlink->trunk_wwn; 3325 lattr->trunk_wwn = tlink->trunk_wwn;
3328 lattr->fctl = tlink->fctl; 3326 lattr->fctl = tlink->fctl;
3329 lattr->speed = tlink->speed; 3327 lattr->speed = tlink->speed;
3330 lattr->deskew = bfa_os_ntohl(tlink->deskew); 3328 lattr->deskew = be32_to_cpu(tlink->deskew);
3331 3329
3332 if (tlink->state == BFA_TRUNK_LINK_STATE_UP) { 3330 if (tlink->state == BFA_TRUNK_LINK_STATE_UP) {
3333 fcport->speed = tlink->speed; 3331 fcport->speed = tlink->speed;
@@ -3360,7 +3358,7 @@ bfa_trunk_scn(struct bfa_fcport_s *fcport, struct bfi_fcport_trunk_scn_s *scn)
3360 BFA_PL_EID_TRUNK_SCN, 0, "Trunk down"); 3358 BFA_PL_EID_TRUNK_SCN, 0, "Trunk down");
3361 } 3359 }
3362 3360
3363 /** 3361 /*
3364 * Notify upper layers if trunk state changed. 3362 * Notify upper layers if trunk state changed.
3365 */ 3363 */
3366 if ((state_prev != trunk->attr.state) || 3364 if ((state_prev != trunk->attr.state) ||
@@ -3376,7 +3374,7 @@ bfa_trunk_iocdisable(struct bfa_s *bfa)
3376 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 3374 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3377 int i = 0; 3375 int i = 0;
3378 3376
3379 /** 3377 /*
3380 * In trunked mode, notify upper layers that link is down 3378 * In trunked mode, notify upper layers that link is down
3381 */ 3379 */
3382 if (fcport->cfg.trunked) { 3380 if (fcport->cfg.trunked) {
@@ -3400,11 +3398,11 @@ bfa_trunk_iocdisable(struct bfa_s *bfa)
3400 3398
3401 3399
3402 3400
3403/** 3401/*
3404 * hal_port_public 3402 * hal_port_public
3405 */ 3403 */
3406 3404
3407/** 3405/*
3408 * Called to initialize port attributes 3406 * Called to initialize port attributes
3409 */ 3407 */
3410void 3408void
@@ -3412,7 +3410,7 @@ bfa_fcport_init(struct bfa_s *bfa)
3412{ 3410{
3413 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 3411 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3414 3412
3415 /** 3413 /*
3416 * Initialize port attributes from IOC hardware data. 3414 * Initialize port attributes from IOC hardware data.
3417 */ 3415 */
3418 bfa_fcport_set_wwns(fcport); 3416 bfa_fcport_set_wwns(fcport);
@@ -3426,7 +3424,7 @@ bfa_fcport_init(struct bfa_s *bfa)
3426 bfa_assert(fcport->speed_sup); 3424 bfa_assert(fcport->speed_sup);
3427} 3425}
3428 3426
3429/** 3427/*
3430 * Firmware message handler. 3428 * Firmware message handler.
3431 */ 3429 */
3432void 3430void
@@ -3507,11 +3505,11 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
3507 3505
3508 3506
3509 3507
3510/** 3508/*
3511 * hal_port_api 3509 * hal_port_api
3512 */ 3510 */
3513 3511
3514/** 3512/*
3515 * Registered callback for port events. 3513 * Registered callback for port events.
3516 */ 3514 */
3517void 3515void
@@ -3552,7 +3550,7 @@ bfa_fcport_disable(struct bfa_s *bfa)
3552 return BFA_STATUS_OK; 3550 return BFA_STATUS_OK;
3553} 3551}
3554 3552
3555/** 3553/*
3556 * Configure port speed. 3554 * Configure port speed.
3557 */ 3555 */
3558bfa_status_t 3556bfa_status_t
@@ -3574,7 +3572,7 @@ bfa_fcport_cfg_speed(struct bfa_s *bfa, enum bfa_port_speed speed)
3574 return BFA_STATUS_OK; 3572 return BFA_STATUS_OK;
3575} 3573}
3576 3574
3577/** 3575/*
3578 * Get current speed. 3576 * Get current speed.
3579 */ 3577 */
3580enum bfa_port_speed 3578enum bfa_port_speed
@@ -3585,7 +3583,7 @@ bfa_fcport_get_speed(struct bfa_s *bfa)
3585 return fcport->speed; 3583 return fcport->speed;
3586} 3584}
3587 3585
3588/** 3586/*
3589 * Configure port topology. 3587 * Configure port topology.
3590 */ 3588 */
3591bfa_status_t 3589bfa_status_t
@@ -3610,7 +3608,7 @@ bfa_fcport_cfg_topology(struct bfa_s *bfa, enum bfa_port_topology topology)
3610 return BFA_STATUS_OK; 3608 return BFA_STATUS_OK;
3611} 3609}
3612 3610
3613/** 3611/*
3614 * Get current topology. 3612 * Get current topology.
3615 */ 3613 */
3616enum bfa_port_topology 3614enum bfa_port_topology
@@ -3710,7 +3708,7 @@ bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit)
3710 bfa_fcport_send_txcredit(fcport); 3708 bfa_fcport_send_txcredit(fcport);
3711} 3709}
3712 3710
3713/** 3711/*
3714 * Get port attributes. 3712 * Get port attributes.
3715 */ 3713 */
3716 3714
@@ -3729,7 +3727,7 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr)
3729{ 3727{
3730 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 3728 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3731 3729
3732 bfa_os_memset(attr, 0, sizeof(struct bfa_port_attr_s)); 3730 memset(attr, 0, sizeof(struct bfa_port_attr_s));
3733 3731
3734 attr->nwwn = fcport->nwwn; 3732 attr->nwwn = fcport->nwwn;
3735 attr->pwwn = fcport->pwwn; 3733 attr->pwwn = fcport->pwwn;
@@ -3737,7 +3735,7 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr)
3737 attr->factorypwwn = bfa_ioc_get_mfg_pwwn(&bfa->ioc); 3735 attr->factorypwwn = bfa_ioc_get_mfg_pwwn(&bfa->ioc);
3738 attr->factorynwwn = bfa_ioc_get_mfg_nwwn(&bfa->ioc); 3736 attr->factorynwwn = bfa_ioc_get_mfg_nwwn(&bfa->ioc);
3739 3737
3740 bfa_os_memcpy(&attr->pport_cfg, &fcport->cfg, 3738 memcpy(&attr->pport_cfg, &fcport->cfg,
3741 sizeof(struct bfa_port_cfg_s)); 3739 sizeof(struct bfa_port_cfg_s));
3742 /* speed attributes */ 3740 /* speed attributes */
3743 attr->pport_cfg.speed = fcport->cfg.speed; 3741 attr->pport_cfg.speed = fcport->cfg.speed;
@@ -3770,7 +3768,7 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr)
3770 3768
3771#define BFA_FCPORT_STATS_TOV 1000 3769#define BFA_FCPORT_STATS_TOV 1000
3772 3770
3773/** 3771/*
3774 * Fetch port statistics (FCQoS or FCoE). 3772 * Fetch port statistics (FCQoS or FCoE).
3775 */ 3773 */
3776bfa_status_t 3774bfa_status_t
@@ -3796,7 +3794,7 @@ bfa_fcport_get_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats,
3796 return BFA_STATUS_OK; 3794 return BFA_STATUS_OK;
3797} 3795}
3798 3796
3799/** 3797/*
3800 * Reset port statistics (FCQoS or FCoE). 3798 * Reset port statistics (FCQoS or FCoE).
3801 */ 3799 */
3802bfa_status_t 3800bfa_status_t
@@ -3820,7 +3818,7 @@ bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn, void *cbarg)
3820 return BFA_STATUS_OK; 3818 return BFA_STATUS_OK;
3821} 3819}
3822 3820
3823/** 3821/*
3824 * Fetch FCQoS port statistics 3822 * Fetch FCQoS port statistics
3825 */ 3823 */
3826bfa_status_t 3824bfa_status_t
@@ -3833,7 +3831,7 @@ bfa_fcport_get_qos_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats,
3833 return bfa_fcport_get_stats(bfa, stats, cbfn, cbarg); 3831 return bfa_fcport_get_stats(bfa, stats, cbfn, cbarg);
3834} 3832}
3835 3833
3836/** 3834/*
3837 * Reset FCoE port statistics 3835 * Reset FCoE port statistics
3838 */ 3836 */
3839bfa_status_t 3837bfa_status_t
@@ -3845,7 +3843,7 @@ bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn, void *cbarg)
3845 return bfa_fcport_clear_stats(bfa, cbfn, cbarg); 3843 return bfa_fcport_clear_stats(bfa, cbfn, cbarg);
3846} 3844}
3847 3845
3848/** 3846/*
3849 * Fetch FCQoS port statistics 3847 * Fetch FCQoS port statistics
3850 */ 3848 */
3851bfa_status_t 3849bfa_status_t
@@ -3858,7 +3856,7 @@ bfa_fcport_get_fcoe_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats,
3858 return bfa_fcport_get_stats(bfa, stats, cbfn, cbarg); 3856 return bfa_fcport_get_stats(bfa, stats, cbfn, cbarg);
3859} 3857}
3860 3858
3861/** 3859/*
3862 * Reset FCoE port statistics 3860 * Reset FCoE port statistics
3863 */ 3861 */
3864bfa_status_t 3862bfa_status_t
@@ -3876,7 +3874,7 @@ bfa_fcport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr)
3876 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 3874 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3877 3875
3878 qos_attr->state = fcport->qos_attr.state; 3876 qos_attr->state = fcport->qos_attr.state;
3879 qos_attr->total_bb_cr = bfa_os_ntohl(fcport->qos_attr.total_bb_cr); 3877 qos_attr->total_bb_cr = be32_to_cpu(fcport->qos_attr.total_bb_cr);
3880} 3878}
3881 3879
3882void 3880void
@@ -3887,10 +3885,10 @@ bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa,
3887 struct bfa_qos_vc_attr_s *bfa_vc_attr = &fcport->qos_vc_attr; 3885 struct bfa_qos_vc_attr_s *bfa_vc_attr = &fcport->qos_vc_attr;
3888 u32 i = 0; 3886 u32 i = 0;
3889 3887
3890 qos_vc_attr->total_vc_count = bfa_os_ntohs(bfa_vc_attr->total_vc_count); 3888 qos_vc_attr->total_vc_count = be16_to_cpu(bfa_vc_attr->total_vc_count);
3891 qos_vc_attr->shared_credit = bfa_os_ntohs(bfa_vc_attr->shared_credit); 3889 qos_vc_attr->shared_credit = be16_to_cpu(bfa_vc_attr->shared_credit);
3892 qos_vc_attr->elp_opmode_flags = 3890 qos_vc_attr->elp_opmode_flags =
3893 bfa_os_ntohl(bfa_vc_attr->elp_opmode_flags); 3891 be32_to_cpu(bfa_vc_attr->elp_opmode_flags);
3894 3892
3895 /* Individual VC info */ 3893 /* Individual VC info */
3896 while (i < qos_vc_attr->total_vc_count) { 3894 while (i < qos_vc_attr->total_vc_count) {
@@ -3904,7 +3902,7 @@ bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa,
3904 } 3902 }
3905} 3903}
3906 3904
3907/** 3905/*
3908 * Fetch port attributes. 3906 * Fetch port attributes.
3909 */ 3907 */
3910bfa_boolean_t 3908bfa_boolean_t
@@ -3939,7 +3937,7 @@ bfa_fcport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off)
3939 3937
3940 if (ioc_type == BFA_IOC_TYPE_FC) { 3938 if (ioc_type == BFA_IOC_TYPE_FC) {
3941 fcport->cfg.qos_enabled = on_off; 3939 fcport->cfg.qos_enabled = on_off;
3942 /** 3940 /*
3943 * Notify fcpim of the change in QoS state 3941 * Notify fcpim of the change in QoS state
3944 */ 3942 */
3945 bfa_fcpim_update_ioredirect(bfa); 3943 bfa_fcpim_update_ioredirect(bfa);
@@ -3959,7 +3957,7 @@ bfa_fcport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off)
3959 fcport->cfg.trl_def_speed = BFA_PORT_SPEED_1GBPS; 3957 fcport->cfg.trl_def_speed = BFA_PORT_SPEED_1GBPS;
3960} 3958}
3961 3959
3962/** 3960/*
3963 * Configure default minimum ratelim speed 3961 * Configure default minimum ratelim speed
3964 */ 3962 */
3965bfa_status_t 3963bfa_status_t
@@ -3980,7 +3978,7 @@ bfa_fcport_cfg_ratelim_speed(struct bfa_s *bfa, enum bfa_port_speed speed)
3980 return BFA_STATUS_OK; 3978 return BFA_STATUS_OK;
3981} 3979}
3982 3980
3983/** 3981/*
3984 * Get default minimum ratelim speed 3982 * Get default minimum ratelim speed
3985 */ 3983 */
3986enum bfa_port_speed 3984enum bfa_port_speed
@@ -4095,10 +4093,10 @@ bfa_trunk_disable(struct bfa_s *bfa)
4095} 4093}
4096 4094
4097 4095
4098/** 4096/*
4099 * Rport State machine functions 4097 * Rport State machine functions
4100 */ 4098 */
4101/** 4099/*
4102 * Beginning state, only online event expected. 4100 * Beginning state, only online event expected.
4103 */ 4101 */
4104static void 4102static void
@@ -4151,7 +4149,7 @@ bfa_rport_sm_created(struct bfa_rport_s *rp, enum bfa_rport_event event)
4151 } 4149 }
4152} 4150}
4153 4151
4154/** 4152/*
4155 * Waiting for rport create response from firmware. 4153 * Waiting for rport create response from firmware.
4156 */ 4154 */
4157static void 4155static void
@@ -4188,7 +4186,7 @@ bfa_rport_sm_fwcreate(struct bfa_rport_s *rp, enum bfa_rport_event event)
4188 } 4186 }
4189} 4187}
4190 4188
4191/** 4189/*
4192 * Request queue is full, awaiting queue resume to send create request. 4190 * Request queue is full, awaiting queue resume to send create request.
4193 */ 4191 */
4194static void 4192static void
@@ -4229,7 +4227,7 @@ bfa_rport_sm_fwcreate_qfull(struct bfa_rport_s *rp, enum bfa_rport_event event)
4229 } 4227 }
4230} 4228}
4231 4229
4232/** 4230/*
4233 * Online state - normal parking state. 4231 * Online state - normal parking state.
4234 */ 4232 */
4235static void 4233static void
@@ -4275,9 +4273,9 @@ bfa_rport_sm_online(struct bfa_rport_s *rp, enum bfa_rport_event event)
4275 bfa_trc(rp->bfa, qos_scn->new_qos_attr.qos_priority); 4273 bfa_trc(rp->bfa, qos_scn->new_qos_attr.qos_priority);
4276 4274
4277 qos_scn->old_qos_attr.qos_flow_id = 4275 qos_scn->old_qos_attr.qos_flow_id =
4278 bfa_os_ntohl(qos_scn->old_qos_attr.qos_flow_id); 4276 be32_to_cpu(qos_scn->old_qos_attr.qos_flow_id);
4279 qos_scn->new_qos_attr.qos_flow_id = 4277 qos_scn->new_qos_attr.qos_flow_id =
4280 bfa_os_ntohl(qos_scn->new_qos_attr.qos_flow_id); 4278 be32_to_cpu(qos_scn->new_qos_attr.qos_flow_id);
4281 4279
4282 if (qos_scn->old_qos_attr.qos_flow_id != 4280 if (qos_scn->old_qos_attr.qos_flow_id !=
4283 qos_scn->new_qos_attr.qos_flow_id) 4281 qos_scn->new_qos_attr.qos_flow_id)
@@ -4297,7 +4295,7 @@ bfa_rport_sm_online(struct bfa_rport_s *rp, enum bfa_rport_event event)
4297 } 4295 }
4298} 4296}
4299 4297
4300/** 4298/*
4301 * Firmware rport is being deleted - awaiting f/w response. 4299 * Firmware rport is being deleted - awaiting f/w response.
4302 */ 4300 */
4303static void 4301static void
@@ -4360,7 +4358,7 @@ bfa_rport_sm_fwdelete_qfull(struct bfa_rport_s *rp, enum bfa_rport_event event)
4360 } 4358 }
4361} 4359}
4362 4360
4363/** 4361/*
4364 * Offline state. 4362 * Offline state.
4365 */ 4363 */
4366static void 4364static void
@@ -4395,7 +4393,7 @@ bfa_rport_sm_offline(struct bfa_rport_s *rp, enum bfa_rport_event event)
4395 } 4393 }
4396} 4394}
4397 4395
4398/** 4396/*
4399 * Rport is deleted, waiting for firmware response to delete. 4397 * Rport is deleted, waiting for firmware response to delete.
4400 */ 4398 */
4401static void 4399static void
@@ -4447,7 +4445,7 @@ bfa_rport_sm_deleting_qfull(struct bfa_rport_s *rp, enum bfa_rport_event event)
4447 } 4445 }
4448} 4446}
4449 4447
4450/** 4448/*
4451 * Waiting for rport create response from firmware. A delete is pending. 4449 * Waiting for rport create response from firmware. A delete is pending.
4452 */ 4450 */
4453static void 4451static void
@@ -4478,7 +4476,7 @@ bfa_rport_sm_delete_pending(struct bfa_rport_s *rp,
4478 } 4476 }
4479} 4477}
4480 4478
4481/** 4479/*
4482 * Waiting for rport create response from firmware. Rport offline is pending. 4480 * Waiting for rport create response from firmware. Rport offline is pending.
4483 */ 4481 */
4484static void 4482static void
@@ -4513,7 +4511,7 @@ bfa_rport_sm_offline_pending(struct bfa_rport_s *rp,
4513 } 4511 }
4514} 4512}
4515 4513
4516/** 4514/*
4517 * IOC h/w failed. 4515 * IOC h/w failed.
4518 */ 4516 */
4519static void 4517static void
@@ -4553,7 +4551,7 @@ bfa_rport_sm_iocdisable(struct bfa_rport_s *rp, enum bfa_rport_event event)
4553 4551
4554 4552
4555 4553
4556/** 4554/*
4557 * bfa_rport_private BFA rport private functions 4555 * bfa_rport_private BFA rport private functions
4558 */ 4556 */
4559 4557
@@ -4612,12 +4610,12 @@ bfa_rport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
4612 !(mod->num_rports & (mod->num_rports - 1))); 4610 !(mod->num_rports & (mod->num_rports - 1)));
4613 4611
4614 for (i = 0; i < mod->num_rports; i++, rp++) { 4612 for (i = 0; i < mod->num_rports; i++, rp++) {
4615 bfa_os_memset(rp, 0, sizeof(struct bfa_rport_s)); 4613 memset(rp, 0, sizeof(struct bfa_rport_s));
4616 rp->bfa = bfa; 4614 rp->bfa = bfa;
4617 rp->rport_tag = i; 4615 rp->rport_tag = i;
4618 bfa_sm_set_state(rp, bfa_rport_sm_uninit); 4616 bfa_sm_set_state(rp, bfa_rport_sm_uninit);
4619 4617
4620 /** 4618 /*
4621 * - is unused 4619 * - is unused
4622 */ 4620 */
4623 if (i) 4621 if (i)
@@ -4626,7 +4624,7 @@ bfa_rport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
4626 bfa_reqq_winit(&rp->reqq_wait, bfa_rport_qresume, rp); 4624 bfa_reqq_winit(&rp->reqq_wait, bfa_rport_qresume, rp);
4627 } 4625 }
4628 4626
4629 /** 4627 /*
4630 * consume memory 4628 * consume memory
4631 */ 4629 */
4632 bfa_meminfo_kva(meminfo) = (u8 *) rp; 4630 bfa_meminfo_kva(meminfo) = (u8 *) rp;
@@ -4687,7 +4685,7 @@ bfa_rport_send_fwcreate(struct bfa_rport_s *rp)
4687{ 4685{
4688 struct bfi_rport_create_req_s *m; 4686 struct bfi_rport_create_req_s *m;
4689 4687
4690 /** 4688 /*
4691 * check for room in queue to send request now 4689 * check for room in queue to send request now
4692 */ 4690 */
4693 m = bfa_reqq_next(rp->bfa, BFA_REQQ_RPORT); 4691 m = bfa_reqq_next(rp->bfa, BFA_REQQ_RPORT);
@@ -4699,7 +4697,7 @@ bfa_rport_send_fwcreate(struct bfa_rport_s *rp)
4699 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_CREATE_REQ, 4697 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_CREATE_REQ,
4700 bfa_lpuid(rp->bfa)); 4698 bfa_lpuid(rp->bfa));
4701 m->bfa_handle = rp->rport_tag; 4699 m->bfa_handle = rp->rport_tag;
4702 m->max_frmsz = bfa_os_htons(rp->rport_info.max_frmsz); 4700 m->max_frmsz = cpu_to_be16(rp->rport_info.max_frmsz);
4703 m->pid = rp->rport_info.pid; 4701 m->pid = rp->rport_info.pid;
4704 m->lp_tag = rp->rport_info.lp_tag; 4702 m->lp_tag = rp->rport_info.lp_tag;
4705 m->local_pid = rp->rport_info.local_pid; 4703 m->local_pid = rp->rport_info.local_pid;
@@ -4708,7 +4706,7 @@ bfa_rport_send_fwcreate(struct bfa_rport_s *rp)
4708 m->vf_id = rp->rport_info.vf_id; 4706 m->vf_id = rp->rport_info.vf_id;
4709 m->cisc = rp->rport_info.cisc; 4707 m->cisc = rp->rport_info.cisc;
4710 4708
4711 /** 4709 /*
4712 * queue I/O message to firmware 4710 * queue I/O message to firmware
4713 */ 4711 */
4714 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT); 4712 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT);
@@ -4720,7 +4718,7 @@ bfa_rport_send_fwdelete(struct bfa_rport_s *rp)
4720{ 4718{
4721 struct bfi_rport_delete_req_s *m; 4719 struct bfi_rport_delete_req_s *m;
4722 4720
4723 /** 4721 /*
4724 * check for room in queue to send request now 4722 * check for room in queue to send request now
4725 */ 4723 */
4726 m = bfa_reqq_next(rp->bfa, BFA_REQQ_RPORT); 4724 m = bfa_reqq_next(rp->bfa, BFA_REQQ_RPORT);
@@ -4733,7 +4731,7 @@ bfa_rport_send_fwdelete(struct bfa_rport_s *rp)
4733 bfa_lpuid(rp->bfa)); 4731 bfa_lpuid(rp->bfa));
4734 m->fw_handle = rp->fw_handle; 4732 m->fw_handle = rp->fw_handle;
4735 4733
4736 /** 4734 /*
4737 * queue I/O message to firmware 4735 * queue I/O message to firmware
4738 */ 4736 */
4739 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT); 4737 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT);
@@ -4745,7 +4743,7 @@ bfa_rport_send_fwspeed(struct bfa_rport_s *rp)
4745{ 4743{
4746 struct bfa_rport_speed_req_s *m; 4744 struct bfa_rport_speed_req_s *m;
4747 4745
4748 /** 4746 /*
4749 * check for room in queue to send request now 4747 * check for room in queue to send request now
4750 */ 4748 */
4751 m = bfa_reqq_next(rp->bfa, BFA_REQQ_RPORT); 4749 m = bfa_reqq_next(rp->bfa, BFA_REQQ_RPORT);
@@ -4759,7 +4757,7 @@ bfa_rport_send_fwspeed(struct bfa_rport_s *rp)
4759 m->fw_handle = rp->fw_handle; 4757 m->fw_handle = rp->fw_handle;
4760 m->speed = (u8)rp->rport_info.speed; 4758 m->speed = (u8)rp->rport_info.speed;
4761 4759
4762 /** 4760 /*
4763 * queue I/O message to firmware 4761 * queue I/O message to firmware
4764 */ 4762 */
4765 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT); 4763 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT);
@@ -4768,11 +4766,11 @@ bfa_rport_send_fwspeed(struct bfa_rport_s *rp)
4768 4766
4769 4767
4770 4768
4771/** 4769/*
4772 * bfa_rport_public 4770 * bfa_rport_public
4773 */ 4771 */
4774 4772
4775/** 4773/*
4776 * Rport interrupt processing. 4774 * Rport interrupt processing.
4777 */ 4775 */
4778void 4776void
@@ -4814,7 +4812,7 @@ bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
4814 4812
4815 4813
4816 4814
4817/** 4815/*
4818 * bfa_rport_api 4816 * bfa_rport_api
4819 */ 4817 */
4820 4818
@@ -4849,7 +4847,7 @@ bfa_rport_online(struct bfa_rport_s *rport, struct bfa_rport_info_s *rport_info)
4849{ 4847{
4850 bfa_assert(rport_info->max_frmsz != 0); 4848 bfa_assert(rport_info->max_frmsz != 0);
4851 4849
4852 /** 4850 /*
4853 * Some JBODs are seen to be not setting PDU size correctly in PLOGI 4851 * Some JBODs are seen to be not setting PDU size correctly in PLOGI
4854 * responses. Default to minimum size. 4852 * responses. Default to minimum size.
4855 */ 4853 */
@@ -4858,7 +4856,7 @@ bfa_rport_online(struct bfa_rport_s *rport, struct bfa_rport_info_s *rport_info)
4858 rport_info->max_frmsz = FC_MIN_PDUSZ; 4856 rport_info->max_frmsz = FC_MIN_PDUSZ;
4859 } 4857 }
4860 4858
4861 bfa_os_assign(rport->rport_info, *rport_info); 4859 rport->rport_info = *rport_info;
4862 bfa_sm_send_event(rport, BFA_RPORT_SM_ONLINE); 4860 bfa_sm_send_event(rport, BFA_RPORT_SM_ONLINE);
4863} 4861}
4864 4862
@@ -4890,22 +4888,22 @@ bfa_rport_get_qos_attr(struct bfa_rport_s *rport,
4890 struct bfa_rport_qos_attr_s *qos_attr) 4888 struct bfa_rport_qos_attr_s *qos_attr)
4891{ 4889{
4892 qos_attr->qos_priority = rport->qos_attr.qos_priority; 4890 qos_attr->qos_priority = rport->qos_attr.qos_priority;
4893 qos_attr->qos_flow_id = bfa_os_ntohl(rport->qos_attr.qos_flow_id); 4891 qos_attr->qos_flow_id = be32_to_cpu(rport->qos_attr.qos_flow_id);
4894 4892
4895} 4893}
4896 4894
4897void 4895void
4898bfa_rport_clear_stats(struct bfa_rport_s *rport) 4896bfa_rport_clear_stats(struct bfa_rport_s *rport)
4899{ 4897{
4900 bfa_os_memset(&rport->stats, 0, sizeof(rport->stats)); 4898 memset(&rport->stats, 0, sizeof(rport->stats));
4901} 4899}
4902 4900
4903 4901
4904/** 4902/*
4905 * SGPG related functions 4903 * SGPG related functions
4906 */ 4904 */
4907 4905
4908/** 4906/*
4909 * Compute and return memory needed by FCP(im) module. 4907 * Compute and return memory needed by FCP(im) module.
4910 */ 4908 */
4911static void 4909static void
@@ -4957,8 +4955,8 @@ bfa_sgpg_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
4957 bfa_assert(!(sgpg_pa.pa & (sizeof(struct bfi_sgpg_s) - 1))); 4955 bfa_assert(!(sgpg_pa.pa & (sizeof(struct bfi_sgpg_s) - 1)));
4958 4956
4959 for (i = 0; i < mod->num_sgpgs; i++) { 4957 for (i = 0; i < mod->num_sgpgs; i++) {
4960 bfa_os_memset(hsgpg, 0, sizeof(*hsgpg)); 4958 memset(hsgpg, 0, sizeof(*hsgpg));
4961 bfa_os_memset(sgpg, 0, sizeof(*sgpg)); 4959 memset(sgpg, 0, sizeof(*sgpg));
4962 4960
4963 hsgpg->sgpg = sgpg; 4961 hsgpg->sgpg = sgpg;
4964 sgpg_pa_tmp.pa = bfa_sgaddr_le(sgpg_pa.pa); 4962 sgpg_pa_tmp.pa = bfa_sgaddr_le(sgpg_pa.pa);
@@ -4997,7 +4995,7 @@ bfa_sgpg_iocdisable(struct bfa_s *bfa)
4997 4995
4998 4996
4999 4997
5000/** 4998/*
5001 * hal_sgpg_public BFA SGPG public functions 4999 * hal_sgpg_public BFA SGPG public functions
5002 */ 5000 */
5003 5001
@@ -5039,7 +5037,7 @@ bfa_sgpg_mfree(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpg)
5039 if (list_empty(&mod->sgpg_wait_q)) 5037 if (list_empty(&mod->sgpg_wait_q))
5040 return; 5038 return;
5041 5039
5042 /** 5040 /*
5043 * satisfy as many waiting requests as possible 5041 * satisfy as many waiting requests as possible
5044 */ 5042 */
5045 do { 5043 do {
@@ -5067,11 +5065,11 @@ bfa_sgpg_wait(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe, int nsgpg)
5067 5065
5068 wqe->nsgpg_total = wqe->nsgpg = nsgpg; 5066 wqe->nsgpg_total = wqe->nsgpg = nsgpg;
5069 5067
5070 /** 5068 /*
5071 * allocate any left to this one first 5069 * allocate any left to this one first
5072 */ 5070 */
5073 if (mod->free_sgpgs) { 5071 if (mod->free_sgpgs) {
5074 /** 5072 /*
5075 * no one else is waiting for SGPG 5073 * no one else is waiting for SGPG
5076 */ 5074 */
5077 bfa_assert(list_empty(&mod->sgpg_wait_q)); 5075 bfa_assert(list_empty(&mod->sgpg_wait_q));
@@ -5105,7 +5103,7 @@ bfa_sgpg_winit(struct bfa_sgpg_wqe_s *wqe, void (*cbfn) (void *cbarg),
5105 wqe->cbarg = cbarg; 5103 wqe->cbarg = cbarg;
5106} 5104}
5107 5105
5108/** 5106/*
5109 * UF related functions 5107 * UF related functions
5110 */ 5108 */
5111/* 5109/*
@@ -5136,7 +5134,7 @@ claim_uf_pbs(struct bfa_uf_mod_s *ufm, struct bfa_meminfo_s *mi)
5136 bfa_meminfo_dma_virt(mi) += uf_pb_tot_sz; 5134 bfa_meminfo_dma_virt(mi) += uf_pb_tot_sz;
5137 bfa_meminfo_dma_phys(mi) += uf_pb_tot_sz; 5135 bfa_meminfo_dma_phys(mi) += uf_pb_tot_sz;
5138 5136
5139 bfa_os_memset((void *)ufm->uf_pbs_kva, 0, uf_pb_tot_sz); 5137 memset((void *)ufm->uf_pbs_kva, 0, uf_pb_tot_sz);
5140} 5138}
5141 5139
5142static void 5140static void
@@ -5153,11 +5151,11 @@ claim_uf_post_msgs(struct bfa_uf_mod_s *ufm, struct bfa_meminfo_s *mi)
5153 5151
5154 for (i = 0, uf_bp_msg = ufm->uf_buf_posts; i < ufm->num_ufs; 5152 for (i = 0, uf_bp_msg = ufm->uf_buf_posts; i < ufm->num_ufs;
5155 i++, uf_bp_msg++) { 5153 i++, uf_bp_msg++) {
5156 bfa_os_memset(uf_bp_msg, 0, sizeof(struct bfi_uf_buf_post_s)); 5154 memset(uf_bp_msg, 0, sizeof(struct bfi_uf_buf_post_s));
5157 5155
5158 uf_bp_msg->buf_tag = i; 5156 uf_bp_msg->buf_tag = i;
5159 buf_len = sizeof(struct bfa_uf_buf_s); 5157 buf_len = sizeof(struct bfa_uf_buf_s);
5160 uf_bp_msg->buf_len = bfa_os_htons(buf_len); 5158 uf_bp_msg->buf_len = cpu_to_be16(buf_len);
5161 bfi_h2i_set(uf_bp_msg->mh, BFI_MC_UF, BFI_UF_H2I_BUF_POST, 5159 bfi_h2i_set(uf_bp_msg->mh, BFI_MC_UF, BFI_UF_H2I_BUF_POST,
5162 bfa_lpuid(ufm->bfa)); 5160 bfa_lpuid(ufm->bfa));
5163 5161
@@ -5173,7 +5171,7 @@ claim_uf_post_msgs(struct bfa_uf_mod_s *ufm, struct bfa_meminfo_s *mi)
5173 bfa_sge_to_be(&sge[1]); 5171 bfa_sge_to_be(&sge[1]);
5174 } 5172 }
5175 5173
5176 /** 5174 /*
5177 * advance pointer beyond consumed memory 5175 * advance pointer beyond consumed memory
5178 */ 5176 */
5179 bfa_meminfo_kva(mi) = (u8 *) uf_bp_msg; 5177 bfa_meminfo_kva(mi) = (u8 *) uf_bp_msg;
@@ -5194,7 +5192,7 @@ claim_ufs(struct bfa_uf_mod_s *ufm, struct bfa_meminfo_s *mi)
5194 * Initialize UFs and queue it in UF free queue 5192 * Initialize UFs and queue it in UF free queue
5195 */ 5193 */
5196 for (i = 0, uf = ufm->uf_list; i < ufm->num_ufs; i++, uf++) { 5194 for (i = 0, uf = ufm->uf_list; i < ufm->num_ufs; i++, uf++) {
5197 bfa_os_memset(uf, 0, sizeof(struct bfa_uf_s)); 5195 memset(uf, 0, sizeof(struct bfa_uf_s));
5198 uf->bfa = ufm->bfa; 5196 uf->bfa = ufm->bfa;
5199 uf->uf_tag = i; 5197 uf->uf_tag = i;
5200 uf->pb_len = sizeof(struct bfa_uf_buf_s); 5198 uf->pb_len = sizeof(struct bfa_uf_buf_s);
@@ -5203,7 +5201,7 @@ claim_ufs(struct bfa_uf_mod_s *ufm, struct bfa_meminfo_s *mi)
5203 list_add_tail(&uf->qe, &ufm->uf_free_q); 5201 list_add_tail(&uf->qe, &ufm->uf_free_q);
5204 } 5202 }
5205 5203
5206 /** 5204 /*
5207 * advance memory pointer 5205 * advance memory pointer
5208 */ 5206 */
5209 bfa_meminfo_kva(mi) = (u8 *) uf; 5207 bfa_meminfo_kva(mi) = (u8 *) uf;
@@ -5241,7 +5239,7 @@ bfa_uf_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
5241{ 5239{
5242 struct bfa_uf_mod_s *ufm = BFA_UF_MOD(bfa); 5240 struct bfa_uf_mod_s *ufm = BFA_UF_MOD(bfa);
5243 5241
5244 bfa_os_memset(ufm, 0, sizeof(struct bfa_uf_mod_s)); 5242 memset(ufm, 0, sizeof(struct bfa_uf_mod_s));
5245 ufm->bfa = bfa; 5243 ufm->bfa = bfa;
5246 ufm->num_ufs = cfg->fwcfg.num_uf_bufs; 5244 ufm->num_ufs = cfg->fwcfg.num_uf_bufs;
5247 INIT_LIST_HEAD(&ufm->uf_free_q); 5245 INIT_LIST_HEAD(&ufm->uf_free_q);
@@ -5279,7 +5277,7 @@ bfa_uf_post(struct bfa_uf_mod_s *ufm, struct bfa_uf_s *uf)
5279 if (!uf_post_msg) 5277 if (!uf_post_msg)
5280 return BFA_STATUS_FAILED; 5278 return BFA_STATUS_FAILED;
5281 5279
5282 bfa_os_memcpy(uf_post_msg, &ufm->uf_buf_posts[uf->uf_tag], 5280 memcpy(uf_post_msg, &ufm->uf_buf_posts[uf->uf_tag],
5283 sizeof(struct bfi_uf_buf_post_s)); 5281 sizeof(struct bfi_uf_buf_post_s));
5284 bfa_reqq_produce(ufm->bfa, BFA_REQQ_FCXP); 5282 bfa_reqq_produce(ufm->bfa, BFA_REQQ_FCXP);
5285 5283
@@ -5310,8 +5308,8 @@ uf_recv(struct bfa_s *bfa, struct bfi_uf_frm_rcvd_s *m)
5310 u8 *buf = &uf_buf->d[0]; 5308 u8 *buf = &uf_buf->d[0];
5311 struct fchs_s *fchs; 5309 struct fchs_s *fchs;
5312 5310
5313 m->frm_len = bfa_os_ntohs(m->frm_len); 5311 m->frm_len = be16_to_cpu(m->frm_len);
5314 m->xfr_len = bfa_os_ntohs(m->xfr_len); 5312 m->xfr_len = be16_to_cpu(m->xfr_len);
5315 5313
5316 fchs = (struct fchs_s *)uf_buf; 5314 fchs = (struct fchs_s *)uf_buf;
5317 5315
@@ -5365,11 +5363,11 @@ bfa_uf_start(struct bfa_s *bfa)
5365 5363
5366 5364
5367 5365
5368/** 5366/*
5369 * hal_uf_api 5367 * hal_uf_api
5370 */ 5368 */
5371 5369
5372/** 5370/*
5373 * Register handler for all unsolicted recieve frames. 5371 * Register handler for all unsolicted recieve frames.
5374 * 5372 *
5375 * @param[in] bfa BFA instance 5373 * @param[in] bfa BFA instance
@@ -5385,7 +5383,7 @@ bfa_uf_recv_register(struct bfa_s *bfa, bfa_cb_uf_recv_t ufrecv, void *cbarg)
5385 ufm->cbarg = cbarg; 5383 ufm->cbarg = cbarg;
5386} 5384}
5387 5385
5388/** 5386/*
5389 * Free an unsolicited frame back to BFA. 5387 * Free an unsolicited frame back to BFA.
5390 * 5388 *
5391 * @param[in] uf unsolicited frame to be freed 5389 * @param[in] uf unsolicited frame to be freed
@@ -5401,7 +5399,7 @@ bfa_uf_free(struct bfa_uf_s *uf)
5401 5399
5402 5400
5403 5401
5404/** 5402/*
5405 * uf_pub BFA uf module public functions 5403 * uf_pub BFA uf module public functions
5406 */ 5404 */
5407void 5405void