aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa
diff options
context:
space:
mode:
authorJing Huang <huangj@brocade.com>2010-10-18 20:10:50 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-10-25 17:17:14 -0400
commitba816ea8e2eacbf3d198ad1859f413c2d6213434 (patch)
tree92399b02434b350fe4c767c0cb4f1790b7fee763 /drivers/scsi/bfa
parent6a18b1675fdf08a6dc861e39c3f94309a03e7f16 (diff)
[SCSI] bfa: replace endian swap macros with the ones provided by linux
Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r--drivers/scsi/bfa/bfa_cb_ioim.h2
-rw-r--r--drivers/scsi/bfa/bfa_core.c26
-rw-r--r--drivers/scsi/bfa/bfa_fcbuild.c92
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.c22
-rw-r--r--drivers/scsi/bfa/bfa_fcs.c2
-rw-r--r--drivers/scsi/bfa/bfa_fcs_lport.c108
-rw-r--r--drivers/scsi/bfa/bfa_fcs_rport.c24
-rw-r--r--drivers/scsi/bfa/bfa_ioc.c14
-rw-r--r--drivers/scsi/bfa/bfa_ioc.h4
-rw-r--r--drivers/scsi/bfa/bfa_os_inc.h27
-rw-r--r--drivers/scsi/bfa/bfa_port.c8
-rw-r--r--drivers/scsi/bfa/bfa_svc.c64
-rw-r--r--drivers/scsi/bfa/bfad_attr.c8
-rw-r--r--drivers/scsi/bfa/bfad_im.c8
14 files changed, 191 insertions, 218 deletions
diff --git a/drivers/scsi/bfa/bfa_cb_ioim.h b/drivers/scsi/bfa/bfa_cb_ioim.h
index a989a94c38da..78c5ba2a66e8 100644
--- a/drivers/scsi/bfa/bfa_cb_ioim.h
+++ b/drivers/scsi/bfa/bfa_cb_ioim.h
@@ -37,7 +37,7 @@ bfad_int_to_lun(u32 luno)
37 } lun; 37 } lun;
38 38
39 lun.bfa_lun = 0; 39 lun.bfa_lun = 0;
40 lun.scsi_lun[0] = bfa_os_htons(luno); 40 lun.scsi_lun[0] = cpu_to_be16(luno);
41 41
42 return lun.bfa_lun; 42 return lun.bfa_lun;
43} 43}
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c
index 4d0530b9633c..73669245c2cf 100644
--- a/drivers/scsi/bfa/bfa_core.c
+++ b/drivers/scsi/bfa/bfa_core.c
@@ -400,14 +400,14 @@ bfa_iocfc_send_cfg(void *bfa_arg)
400 bfa_dma_be_addr_set(cfg_info->req_shadow_ci[i], 400 bfa_dma_be_addr_set(cfg_info->req_shadow_ci[i],
401 iocfc->req_cq_shadow_ci[i].pa); 401 iocfc->req_cq_shadow_ci[i].pa);
402 cfg_info->req_cq_elems[i] = 402 cfg_info->req_cq_elems[i] =
403 bfa_os_htons(cfg->drvcfg.num_reqq_elems); 403 cpu_to_be16(cfg->drvcfg.num_reqq_elems);
404 404
405 bfa_dma_be_addr_set(cfg_info->rsp_cq_ba[i], 405 bfa_dma_be_addr_set(cfg_info->rsp_cq_ba[i],
406 iocfc->rsp_cq_ba[i].pa); 406 iocfc->rsp_cq_ba[i].pa);
407 bfa_dma_be_addr_set(cfg_info->rsp_shadow_pi[i], 407 bfa_dma_be_addr_set(cfg_info->rsp_shadow_pi[i],
408 iocfc->rsp_cq_shadow_pi[i].pa); 408 iocfc->rsp_cq_shadow_pi[i].pa);
409 cfg_info->rsp_cq_elems[i] = 409 cfg_info->rsp_cq_elems[i] =
410 bfa_os_htons(cfg->drvcfg.num_rspq_elems); 410 cpu_to_be16(cfg->drvcfg.num_rspq_elems);
411 } 411 }
412 412
413 /** 413 /**
@@ -634,11 +634,11 @@ bfa_iocfc_cfgrsp(struct bfa_s *bfa)
634 struct bfa_iocfc_fwcfg_s *fwcfg = &cfgrsp->fwcfg; 634 struct bfa_iocfc_fwcfg_s *fwcfg = &cfgrsp->fwcfg;
635 635
636 fwcfg->num_cqs = fwcfg->num_cqs; 636 fwcfg->num_cqs = fwcfg->num_cqs;
637 fwcfg->num_ioim_reqs = bfa_os_ntohs(fwcfg->num_ioim_reqs); 637 fwcfg->num_ioim_reqs = be16_to_cpu(fwcfg->num_ioim_reqs);
638 fwcfg->num_tskim_reqs = bfa_os_ntohs(fwcfg->num_tskim_reqs); 638 fwcfg->num_tskim_reqs = be16_to_cpu(fwcfg->num_tskim_reqs);
639 fwcfg->num_fcxp_reqs = bfa_os_ntohs(fwcfg->num_fcxp_reqs); 639 fwcfg->num_fcxp_reqs = be16_to_cpu(fwcfg->num_fcxp_reqs);
640 fwcfg->num_uf_bufs = bfa_os_ntohs(fwcfg->num_uf_bufs); 640 fwcfg->num_uf_bufs = be16_to_cpu(fwcfg->num_uf_bufs);
641 fwcfg->num_rports = bfa_os_ntohs(fwcfg->num_rports); 641 fwcfg->num_rports = be16_to_cpu(fwcfg->num_rports);
642 642
643 iocfc->cfgdone = BFA_TRUE; 643 iocfc->cfgdone = BFA_TRUE;
644 644
@@ -876,12 +876,12 @@ bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr)
876 attr->intr_attr.coalesce = iocfc->cfginfo->intr_attr.coalesce; 876 attr->intr_attr.coalesce = iocfc->cfginfo->intr_attr.coalesce;
877 877
878 attr->intr_attr.delay = iocfc->cfginfo->intr_attr.delay ? 878 attr->intr_attr.delay = iocfc->cfginfo->intr_attr.delay ?
879 bfa_os_ntohs(iocfc->cfginfo->intr_attr.delay) : 879 be16_to_cpu(iocfc->cfginfo->intr_attr.delay) :
880 bfa_os_ntohs(iocfc->cfgrsp->intr_attr.delay); 880 be16_to_cpu(iocfc->cfgrsp->intr_attr.delay);
881 881
882 attr->intr_attr.latency = iocfc->cfginfo->intr_attr.latency ? 882 attr->intr_attr.latency = iocfc->cfginfo->intr_attr.latency ?
883 bfa_os_ntohs(iocfc->cfginfo->intr_attr.latency) : 883 be16_to_cpu(iocfc->cfginfo->intr_attr.latency) :
884 bfa_os_ntohs(iocfc->cfgrsp->intr_attr.latency); 884 be16_to_cpu(iocfc->cfgrsp->intr_attr.latency);
885 885
886 attr->config = iocfc->cfg; 886 attr->config = iocfc->cfg;
887} 887}
@@ -893,8 +893,8 @@ bfa_iocfc_israttr_set(struct bfa_s *bfa, struct bfa_iocfc_intr_attr_s *attr)
893 struct bfi_iocfc_set_intr_req_s *m; 893 struct bfi_iocfc_set_intr_req_s *m;
894 894
895 iocfc->cfginfo->intr_attr.coalesce = attr->coalesce; 895 iocfc->cfginfo->intr_attr.coalesce = attr->coalesce;
896 iocfc->cfginfo->intr_attr.delay = bfa_os_htons(attr->delay); 896 iocfc->cfginfo->intr_attr.delay = cpu_to_be16(attr->delay);
897 iocfc->cfginfo->intr_attr.latency = bfa_os_htons(attr->latency); 897 iocfc->cfginfo->intr_attr.latency = cpu_to_be16(attr->latency);
898 898
899 if (!bfa_iocfc_is_operational(bfa)) 899 if (!bfa_iocfc_is_operational(bfa))
900 return BFA_STATUS_OK; 900 return BFA_STATUS_OK;
diff --git a/drivers/scsi/bfa/bfa_fcbuild.c b/drivers/scsi/bfa/bfa_fcbuild.c
index 7e7c14bd552a..85b005093da9 100644
--- a/drivers/scsi/bfa/bfa_fcbuild.c
+++ b/drivers/scsi/bfa/bfa_fcbuild.c
@@ -94,13 +94,13 @@ fcbuild_init(void)
94 */ 94 */
95 plogi_tmpl.csp.verhi = FC_PH_VER_PH_3; 95 plogi_tmpl.csp.verhi = FC_PH_VER_PH_3;
96 plogi_tmpl.csp.verlo = FC_PH_VER_4_3; 96 plogi_tmpl.csp.verlo = FC_PH_VER_4_3;
97 plogi_tmpl.csp.bbcred = bfa_os_htons(0x0004); 97 plogi_tmpl.csp.bbcred = cpu_to_be16(0x0004);
98 plogi_tmpl.csp.ciro = 0x1; 98 plogi_tmpl.csp.ciro = 0x1;
99 plogi_tmpl.csp.cisc = 0x0; 99 plogi_tmpl.csp.cisc = 0x0;
100 plogi_tmpl.csp.altbbcred = 0x0; 100 plogi_tmpl.csp.altbbcred = 0x0;
101 plogi_tmpl.csp.conseq = bfa_os_htons(0x00FF); 101 plogi_tmpl.csp.conseq = cpu_to_be16(0x00FF);
102 plogi_tmpl.csp.ro_bitmap = bfa_os_htons(0x0002); 102 plogi_tmpl.csp.ro_bitmap = cpu_to_be16(0x0002);
103 plogi_tmpl.csp.e_d_tov = bfa_os_htonl(2000); 103 plogi_tmpl.csp.e_d_tov = cpu_to_be32(2000);
104 104
105 plogi_tmpl.class3.class_valid = 1; 105 plogi_tmpl.class3.class_valid = 1;
106 plogi_tmpl.class3.sequential = 1; 106 plogi_tmpl.class3.sequential = 1;
@@ -112,7 +112,7 @@ fcbuild_init(void)
112 */ 112 */
113 prli_tmpl.command = FC_ELS_PRLI; 113 prli_tmpl.command = FC_ELS_PRLI;
114 prli_tmpl.pglen = 0x10; 114 prli_tmpl.pglen = 0x10;
115 prli_tmpl.pagebytes = bfa_os_htons(0x0014); 115 prli_tmpl.pagebytes = cpu_to_be16(0x0014);
116 prli_tmpl.parampage.type = FC_TYPE_FCP; 116 prli_tmpl.parampage.type = FC_TYPE_FCP;
117 prli_tmpl.parampage.imagepair = 1; 117 prli_tmpl.parampage.imagepair = 1;
118 prli_tmpl.parampage.servparams.rxrdisab = 1; 118 prli_tmpl.parampage.servparams.rxrdisab = 1;
@@ -148,7 +148,7 @@ fc_gs_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u32 ox_id)
148 fchs->rx_id = FC_RXID_ANY; 148 fchs->rx_id = FC_RXID_ANY;
149 fchs->d_id = (d_id); 149 fchs->d_id = (d_id);
150 fchs->s_id = (s_id); 150 fchs->s_id = (s_id);
151 fchs->ox_id = bfa_os_htons(ox_id); 151 fchs->ox_id = cpu_to_be16(ox_id);
152 152
153 /** 153 /**
154 * @todo no need to set ox_id for request 154 * @todo no need to set ox_id for request
@@ -162,7 +162,7 @@ fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id)
162 memcpy(fchs, &fc_els_req_tmpl, sizeof(struct fchs_s)); 162 memcpy(fchs, &fc_els_req_tmpl, sizeof(struct fchs_s));
163 fchs->d_id = (d_id); 163 fchs->d_id = (d_id);
164 fchs->s_id = (s_id); 164 fchs->s_id = (s_id);
165 fchs->ox_id = bfa_os_htons(ox_id); 165 fchs->ox_id = cpu_to_be16(ox_id);
166} 166}
167 167
168static void 168static void
@@ -219,7 +219,7 @@ fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
219 else 219 else
220 fc_els_rsp_build(fchs, d_id, s_id, ox_id); 220 fc_els_rsp_build(fchs, d_id, s_id, ox_id);
221 221
222 plogi->csp.rxsz = plogi->class3.rxsz = bfa_os_htons(pdu_size); 222 plogi->csp.rxsz = plogi->class3.rxsz = cpu_to_be16(pdu_size);
223 223
224 memcpy(&plogi->port_name, &port_name, sizeof(wwn_t)); 224 memcpy(&plogi->port_name, &port_name, sizeof(wwn_t));
225 memcpy(&plogi->node_name, &node_name, sizeof(wwn_t)); 225 memcpy(&plogi->node_name, &node_name, sizeof(wwn_t));
@@ -240,7 +240,7 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
240 flogi->els_cmd.els_code = FC_ELS_FLOGI; 240 flogi->els_cmd.els_code = FC_ELS_FLOGI;
241 fc_els_req_build(fchs, d_id, s_id, ox_id); 241 fc_els_req_build(fchs, d_id, s_id, ox_id);
242 242
243 flogi->csp.rxsz = flogi->class3.rxsz = bfa_os_htons(pdu_size); 243 flogi->csp.rxsz = flogi->class3.rxsz = cpu_to_be16(pdu_size);
244 flogi->port_name = port_name; 244 flogi->port_name = port_name;
245 flogi->node_name = node_name; 245 flogi->node_name = node_name;
246 246
@@ -253,14 +253,14 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
253 /* set AUTH capability */ 253 /* set AUTH capability */
254 flogi->csp.security = set_auth; 254 flogi->csp.security = set_auth;
255 255
256 flogi->csp.bbcred = bfa_os_htons(local_bb_credits); 256 flogi->csp.bbcred = cpu_to_be16(local_bb_credits);
257 257
258 /* Set brcd token in VVL */ 258 /* Set brcd token in VVL */
259 vvl_info = (u32 *)&flogi->vvl[0]; 259 vvl_info = (u32 *)&flogi->vvl[0];
260 260
261 /* set the flag to indicate the presence of VVL */ 261 /* set the flag to indicate the presence of VVL */
262 flogi->csp.npiv_supp = 1; /* @todo. field name is not correct */ 262 flogi->csp.npiv_supp = 1; /* @todo. field name is not correct */
263 vvl_info[0] = bfa_os_htonl(FLOGI_VVL_BRCD); 263 vvl_info[0] = cpu_to_be32(FLOGI_VVL_BRCD);
264 264
265 return sizeof(struct fc_logi_s); 265 return sizeof(struct fc_logi_s);
266} 266}
@@ -276,11 +276,11 @@ fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
276 fc_els_rsp_build(fchs, d_id, s_id, ox_id); 276 fc_els_rsp_build(fchs, d_id, s_id, ox_id);
277 277
278 flogi->els_cmd.els_code = FC_ELS_ACC; 278 flogi->els_cmd.els_code = FC_ELS_ACC;
279 flogi->csp.rxsz = flogi->class3.rxsz = bfa_os_htons(pdu_size); 279 flogi->csp.rxsz = flogi->class3.rxsz = cpu_to_be16(pdu_size);
280 flogi->port_name = port_name; 280 flogi->port_name = port_name;
281 flogi->node_name = node_name; 281 flogi->node_name = node_name;
282 282
283 flogi->csp.bbcred = bfa_os_htons(local_bb_credits); 283 flogi->csp.bbcred = cpu_to_be16(local_bb_credits);
284 284
285 return sizeof(struct fc_logi_s); 285 return sizeof(struct fc_logi_s);
286} 286}
@@ -296,7 +296,7 @@ fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
296 flogi->els_cmd.els_code = FC_ELS_FDISC; 296 flogi->els_cmd.els_code = FC_ELS_FDISC;
297 fc_els_req_build(fchs, d_id, s_id, ox_id); 297 fc_els_req_build(fchs, d_id, s_id, ox_id);
298 298
299 flogi->csp.rxsz = flogi->class3.rxsz = bfa_os_htons(pdu_size); 299 flogi->csp.rxsz = flogi->class3.rxsz = cpu_to_be16(pdu_size);
300 flogi->port_name = port_name; 300 flogi->port_name = port_name;
301 flogi->node_name = node_name; 301 flogi->node_name = node_name;
302 302
@@ -346,7 +346,7 @@ fc_plogi_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name)
346 if (!plogi->class3.class_valid) 346 if (!plogi->class3.class_valid)
347 return FC_PARSE_FAILURE; 347 return FC_PARSE_FAILURE;
348 348
349 if (bfa_os_ntohs(plogi->class3.rxsz) < (FC_MIN_PDUSZ)) 349 if (be16_to_cpu(plogi->class3.rxsz) < (FC_MIN_PDUSZ))
350 return FC_PARSE_FAILURE; 350 return FC_PARSE_FAILURE;
351 351
352 return FC_PARSE_OK; 352 return FC_PARSE_OK;
@@ -363,8 +363,8 @@ fc_plogi_parse(struct fchs_s *fchs)
363 if (plogi->class3.class_valid != 1) 363 if (plogi->class3.class_valid != 1)
364 return FC_PARSE_FAILURE; 364 return FC_PARSE_FAILURE;
365 365
366 if ((bfa_os_ntohs(plogi->class3.rxsz) < FC_MIN_PDUSZ) 366 if ((be16_to_cpu(plogi->class3.rxsz) < FC_MIN_PDUSZ)
367 || (bfa_os_ntohs(plogi->class3.rxsz) > FC_MAX_PDUSZ) 367 || (be16_to_cpu(plogi->class3.rxsz) > FC_MAX_PDUSZ)
368 || (plogi->class3.rxsz == 0)) 368 || (plogi->class3.rxsz == 0))
369 return FC_PARSE_FAILURE; 369 return FC_PARSE_FAILURE;
370 370
@@ -537,7 +537,7 @@ fc_pdisc_parse(struct fchs_s *fchs, wwn_t node_name, wwn_t port_name)
537 if (pdisc->class3.class_valid != 1) 537 if (pdisc->class3.class_valid != 1)
538 return FC_PARSE_FAILURE; 538 return FC_PARSE_FAILURE;
539 539
540 if ((bfa_os_ntohs(pdisc->class3.rxsz) < 540 if ((be16_to_cpu(pdisc->class3.rxsz) <
541 (FC_MIN_PDUSZ - sizeof(struct fchs_s))) 541 (FC_MIN_PDUSZ - sizeof(struct fchs_s)))
542 || (pdisc->class3.rxsz == 0)) 542 || (pdisc->class3.rxsz == 0))
543 return FC_PARSE_FAILURE; 543 return FC_PARSE_FAILURE;
@@ -558,7 +558,7 @@ fc_abts_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id)
558 fchs->cat_info = FC_CAT_ABTS; 558 fchs->cat_info = FC_CAT_ABTS;
559 fchs->d_id = (d_id); 559 fchs->d_id = (d_id);
560 fchs->s_id = (s_id); 560 fchs->s_id = (s_id);
561 fchs->ox_id = bfa_os_htons(ox_id); 561 fchs->ox_id = cpu_to_be16(ox_id);
562 562
563 return sizeof(struct fchs_s); 563 return sizeof(struct fchs_s);
564} 564}
@@ -584,7 +584,7 @@ fc_rrq_build(struct fchs_s *fchs, struct fc_rrq_s *rrq, u32 d_id, u32 s_id,
584 */ 584 */
585 memcpy(rrq, &rrq_tmpl, sizeof(struct fc_rrq_s)); 585 memcpy(rrq, &rrq_tmpl, sizeof(struct fc_rrq_s));
586 rrq->s_id = (s_id); 586 rrq->s_id = (s_id);
587 rrq->ox_id = bfa_os_htons(rrq_oxid); 587 rrq->ox_id = cpu_to_be16(rrq_oxid);
588 rrq->rx_id = FC_RXID_ANY; 588 rrq->rx_id = FC_RXID_ANY;
589 589
590 return sizeof(struct fc_rrq_s); 590 return sizeof(struct fc_rrq_s);
@@ -656,10 +656,10 @@ fc_logout_params_pages(struct fchs_s *fc_frame, u8 els_code)
656 656
657 if (els_code == FC_ELS_PRLO) { 657 if (els_code == FC_ELS_PRLO) {
658 prlo = (struct fc_prlo_s *) (fc_frame + 1); 658 prlo = (struct fc_prlo_s *) (fc_frame + 1);
659 num_pages = (bfa_os_ntohs(prlo->payload_len) - 4) / 16; 659 num_pages = (be16_to_cpu(prlo->payload_len) - 4) / 16;
660 } else { 660 } else {
661 tprlo = (struct fc_tprlo_s *) (fc_frame + 1); 661 tprlo = (struct fc_tprlo_s *) (fc_frame + 1);
662 num_pages = (bfa_os_ntohs(tprlo->payload_len) - 4) / 16; 662 num_pages = (be16_to_cpu(tprlo->payload_len) - 4) / 16;
663 } 663 }
664 return num_pages; 664 return num_pages;
665} 665}
@@ -676,7 +676,7 @@ fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc,
676 tprlo_acc->command = FC_ELS_ACC; 676 tprlo_acc->command = FC_ELS_ACC;
677 677
678 tprlo_acc->page_len = 0x10; 678 tprlo_acc->page_len = 0x10;
679 tprlo_acc->payload_len = bfa_os_htons((num_pages * 16) + 4); 679 tprlo_acc->payload_len = cpu_to_be16((num_pages * 16) + 4);
680 680
681 for (page = 0; page < num_pages; page++) { 681 for (page = 0; page < num_pages; page++) {
682 tprlo_acc->tprlo_acc_params[page].opa_valid = 0; 682 tprlo_acc->tprlo_acc_params[page].opa_valid = 0;
@@ -685,7 +685,7 @@ fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc,
685 tprlo_acc->tprlo_acc_params[page].orig_process_assc = 0; 685 tprlo_acc->tprlo_acc_params[page].orig_process_assc = 0;
686 tprlo_acc->tprlo_acc_params[page].resp_process_assc = 0; 686 tprlo_acc->tprlo_acc_params[page].resp_process_assc = 0;
687 } 687 }
688 return bfa_os_ntohs(tprlo_acc->payload_len); 688 return be16_to_cpu(tprlo_acc->payload_len);
689} 689}
690 690
691u16 691u16
@@ -699,7 +699,7 @@ fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, u32 d_id,
699 memset(prlo_acc, 0, (num_pages * 16) + 4); 699 memset(prlo_acc, 0, (num_pages * 16) + 4);
700 prlo_acc->command = FC_ELS_ACC; 700 prlo_acc->command = FC_ELS_ACC;
701 prlo_acc->page_len = 0x10; 701 prlo_acc->page_len = 0x10;
702 prlo_acc->payload_len = bfa_os_htons((num_pages * 16) + 4); 702 prlo_acc->payload_len = cpu_to_be16((num_pages * 16) + 4);
703 703
704 for (page = 0; page < num_pages; page++) { 704 for (page = 0; page < num_pages; page++) {
705 prlo_acc->prlo_acc_params[page].opa_valid = 0; 705 prlo_acc->prlo_acc_params[page].opa_valid = 0;
@@ -709,7 +709,7 @@ fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, u32 d_id,
709 prlo_acc->prlo_acc_params[page].resp_process_assc = 0; 709 prlo_acc->prlo_acc_params[page].resp_process_assc = 0;
710 } 710 }
711 711
712 return bfa_os_ntohs(prlo_acc->payload_len); 712 return be16_to_cpu(prlo_acc->payload_len);
713} 713}
714 714
715u16 715u16
@@ -778,8 +778,8 @@ fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2, u32 d_id,
778 memset(rpsc2, 0, sizeof(struct fc_rpsc2_cmd_s)); 778 memset(rpsc2, 0, sizeof(struct fc_rpsc2_cmd_s));
779 779
780 rpsc2->els_cmd.els_code = FC_ELS_RPSC; 780 rpsc2->els_cmd.els_code = FC_ELS_RPSC;
781 rpsc2->token = bfa_os_htonl(FC_BRCD_TOKEN); 781 rpsc2->token = cpu_to_be32(FC_BRCD_TOKEN);
782 rpsc2->num_pids = bfa_os_htons(npids); 782 rpsc2->num_pids = cpu_to_be16(npids);
783 for (i = 0; i < npids; i++) 783 for (i = 0; i < npids; i++)
784 rpsc2->pid_list[i].pid = pid_list[i]; 784 rpsc2->pid_list[i].pid = pid_list[i];
785 785
@@ -796,13 +796,13 @@ fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc,
796 fc_els_rsp_build(fchs, d_id, s_id, ox_id); 796 fc_els_rsp_build(fchs, d_id, s_id, ox_id);
797 797
798 rpsc_acc->command = FC_ELS_ACC; 798 rpsc_acc->command = FC_ELS_ACC;
799 rpsc_acc->num_entries = bfa_os_htons(1); 799 rpsc_acc->num_entries = cpu_to_be16(1);
800 800
801 rpsc_acc->speed_info[0].port_speed_cap = 801 rpsc_acc->speed_info[0].port_speed_cap =
802 bfa_os_htons(oper_speed->port_speed_cap); 802 cpu_to_be16(oper_speed->port_speed_cap);
803 803
804 rpsc_acc->speed_info[0].port_op_speed = 804 rpsc_acc->speed_info[0].port_op_speed =
805 bfa_os_htons(oper_speed->port_op_speed); 805 cpu_to_be16(oper_speed->port_op_speed);
806 806
807 return sizeof(struct fc_rpsc_acc_s); 807 return sizeof(struct fc_rpsc_acc_s);
808} 808}
@@ -835,7 +835,7 @@ fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
835 pdisc->els_cmd.els_code = FC_ELS_PDISC; 835 pdisc->els_cmd.els_code = FC_ELS_PDISC;
836 fc_els_req_build(fchs, d_id, s_id, ox_id); 836 fc_els_req_build(fchs, d_id, s_id, ox_id);
837 837
838 pdisc->csp.rxsz = pdisc->class3.rxsz = bfa_os_htons(pdu_size); 838 pdisc->csp.rxsz = pdisc->class3.rxsz = cpu_to_be16(pdu_size);
839 pdisc->port_name = port_name; 839 pdisc->port_name = port_name;
840 pdisc->node_name = node_name; 840 pdisc->node_name = node_name;
841 841
@@ -859,7 +859,7 @@ fc_pdisc_rsp_parse(struct fchs_s *fchs, int len, wwn_t port_name)
859 if (!pdisc->class3.class_valid) 859 if (!pdisc->class3.class_valid)
860 return FC_PARSE_NWWN_NOT_EQUAL; 860 return FC_PARSE_NWWN_NOT_EQUAL;
861 861
862 if (bfa_os_ntohs(pdisc->class3.rxsz) < (FC_MIN_PDUSZ)) 862 if (be16_to_cpu(pdisc->class3.rxsz) < (FC_MIN_PDUSZ))
863 return FC_PARSE_RXSZ_INVAL; 863 return FC_PARSE_RXSZ_INVAL;
864 864
865 return FC_PARSE_OK; 865 return FC_PARSE_OK;
@@ -876,7 +876,7 @@ fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
876 memset(prlo, 0, (num_pages * 16) + 4); 876 memset(prlo, 0, (num_pages * 16) + 4);
877 prlo->command = FC_ELS_PRLO; 877 prlo->command = FC_ELS_PRLO;
878 prlo->page_len = 0x10; 878 prlo->page_len = 0x10;
879 prlo->payload_len = bfa_os_htons((num_pages * 16) + 4); 879 prlo->payload_len = cpu_to_be16((num_pages * 16) + 4);
880 880
881 for (page = 0; page < num_pages; page++) { 881 for (page = 0; page < num_pages; page++) {
882 prlo->prlo_params[page].type = FC_TYPE_FCP; 882 prlo->prlo_params[page].type = FC_TYPE_FCP;
@@ -886,7 +886,7 @@ fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
886 prlo->prlo_params[page].resp_process_assc = 0; 886 prlo->prlo_params[page].resp_process_assc = 0;
887 } 887 }
888 888
889 return bfa_os_ntohs(prlo->payload_len); 889 return be16_to_cpu(prlo->payload_len);
890} 890}
891 891
892u16 892u16
@@ -901,7 +901,7 @@ fc_prlo_rsp_parse(struct fchs_s *fchs, int len)
901 if (prlo->command != FC_ELS_ACC) 901 if (prlo->command != FC_ELS_ACC)
902 return FC_PARSE_FAILURE; 902 return FC_PARSE_FAILURE;
903 903
904 num_pages = ((bfa_os_ntohs(prlo->payload_len)) - 4) / 16; 904 num_pages = ((be16_to_cpu(prlo->payload_len)) - 4) / 16;
905 905
906 for (page = 0; page < num_pages; page++) { 906 for (page = 0; page < num_pages; page++) {
907 if (prlo->prlo_acc_params[page].type != FC_TYPE_FCP) 907 if (prlo->prlo_acc_params[page].type != FC_TYPE_FCP)
@@ -934,7 +934,7 @@ fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
934 memset(tprlo, 0, (num_pages * 16) + 4); 934 memset(tprlo, 0, (num_pages * 16) + 4);
935 tprlo->command = FC_ELS_TPRLO; 935 tprlo->command = FC_ELS_TPRLO;
936 tprlo->page_len = 0x10; 936 tprlo->page_len = 0x10;
937 tprlo->payload_len = bfa_os_htons((num_pages * 16) + 4); 937 tprlo->payload_len = cpu_to_be16((num_pages * 16) + 4);
938 938
939 for (page = 0; page < num_pages; page++) { 939 for (page = 0; page < num_pages; page++) {
940 tprlo->tprlo_params[page].type = FC_TYPE_FCP; 940 tprlo->tprlo_params[page].type = FC_TYPE_FCP;
@@ -950,7 +950,7 @@ fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
950 } 950 }
951 } 951 }
952 952
953 return bfa_os_ntohs(tprlo->payload_len); 953 return be16_to_cpu(tprlo->payload_len);
954} 954}
955 955
956u16 956u16
@@ -965,7 +965,7 @@ fc_tprlo_rsp_parse(struct fchs_s *fchs, int len)
965 if (tprlo->command != FC_ELS_ACC) 965 if (tprlo->command != FC_ELS_ACC)
966 return FC_PARSE_ACC_INVAL; 966 return FC_PARSE_ACC_INVAL;
967 967
968 num_pages = (bfa_os_ntohs(tprlo->payload_len) - 4) / 16; 968 num_pages = (be16_to_cpu(tprlo->payload_len) - 4) / 16;
969 969
970 for (page = 0; page < num_pages; page++) { 970 for (page = 0; page < num_pages; page++) {
971 if (tprlo->tprlo_acc_params[page].type != FC_TYPE_FCP) 971 if (tprlo->tprlo_acc_params[page].type != FC_TYPE_FCP)
@@ -1015,7 +1015,7 @@ fc_gs_cthdr_build(struct ct_hdr_s *cthdr, u32 s_id, u16 cmd_code)
1015 cthdr->rev_id = CT_GS3_REVISION; 1015 cthdr->rev_id = CT_GS3_REVISION;
1016 cthdr->gs_type = CT_GSTYPE_DIRSERVICE; 1016 cthdr->gs_type = CT_GSTYPE_DIRSERVICE;
1017 cthdr->gs_sub_type = CT_GSSUBTYPE_NAMESERVER; 1017 cthdr->gs_sub_type = CT_GSSUBTYPE_NAMESERVER;
1018 cthdr->cmd_rsp_code = bfa_os_htons(cmd_code); 1018 cthdr->cmd_rsp_code = cpu_to_be16(cmd_code);
1019} 1019}
1020 1020
1021static void 1021static void
@@ -1025,7 +1025,7 @@ fc_gs_fdmi_cthdr_build(struct ct_hdr_s *cthdr, u32 s_id, u16 cmd_code)
1025 cthdr->rev_id = CT_GS3_REVISION; 1025 cthdr->rev_id = CT_GS3_REVISION;
1026 cthdr->gs_type = CT_GSTYPE_MGMTSERVICE; 1026 cthdr->gs_type = CT_GSTYPE_MGMTSERVICE;
1027 cthdr->gs_sub_type = CT_GSSUBTYPE_HBA_MGMTSERVER; 1027 cthdr->gs_sub_type = CT_GSSUBTYPE_HBA_MGMTSERVER;
1028 cthdr->cmd_rsp_code = bfa_os_htons(cmd_code); 1028 cthdr->cmd_rsp_code = cpu_to_be16(cmd_code);
1029} 1029}
1030 1030
1031static void 1031static void
@@ -1036,7 +1036,7 @@ fc_gs_ms_cthdr_build(struct ct_hdr_s *cthdr, u32 s_id, u16 cmd_code,
1036 cthdr->rev_id = CT_GS3_REVISION; 1036 cthdr->rev_id = CT_GS3_REVISION;
1037 cthdr->gs_type = CT_GSTYPE_MGMTSERVICE; 1037 cthdr->gs_type = CT_GSTYPE_MGMTSERVICE;
1038 cthdr->gs_sub_type = sub_type; 1038 cthdr->gs_sub_type = sub_type;
1039 cthdr->cmd_rsp_code = bfa_os_htons(cmd_code); 1039 cthdr->cmd_rsp_code = cpu_to_be16(cmd_code);
1040} 1040}
1041 1041
1042u16 1042u16
@@ -1090,7 +1090,7 @@ fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1090u16 1090u16
1091fc_ct_rsp_parse(struct ct_hdr_s *cthdr) 1091fc_ct_rsp_parse(struct ct_hdr_s *cthdr)
1092{ 1092{
1093 if (bfa_os_ntohs(cthdr->cmd_rsp_code) != CT_RSP_ACCEPT) { 1093 if (be16_to_cpu(cthdr->cmd_rsp_code) != CT_RSP_ACCEPT) {
1094 if (cthdr->reason_code == CT_RSN_LOGICAL_BUSY) 1094 if (cthdr->reason_code == CT_RSN_LOGICAL_BUSY)
1095 return FC_PARSE_BUSY; 1095 return FC_PARSE_BUSY;
1096 else 1096 else
@@ -1129,7 +1129,7 @@ fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn,
1129 rscn->pagelen = sizeof(rscn->event[0]); 1129 rscn->pagelen = sizeof(rscn->event[0]);
1130 1130
1131 payldlen = sizeof(u32) + rscn->pagelen; 1131 payldlen = sizeof(u32) + rscn->pagelen;
1132 rscn->payldlen = bfa_os_htons(payldlen); 1132 rscn->payldlen = cpu_to_be16(payldlen);
1133 1133
1134 rscn->event[0].format = FC_RSCN_FORMAT_PORTID; 1134 rscn->event[0].format = FC_RSCN_FORMAT_PORTID;
1135 rscn->event[0].portid = s_id; 1135 rscn->event[0].portid = s_id;
@@ -1156,7 +1156,7 @@ fc_rftid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1156 /* By default, FCP FC4 Type is registered */ 1156 /* By default, FCP FC4 Type is registered */
1157 index = FC_TYPE_FCP >> 5; 1157 index = FC_TYPE_FCP >> 5;
1158 type_value = 1 << (FC_TYPE_FCP % 32); 1158 type_value = 1 << (FC_TYPE_FCP % 32);
1159 rftid->fc4_type[index] = bfa_os_htonl(type_value); 1159 rftid->fc4_type[index] = cpu_to_be32(type_value);
1160 1160
1161 return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s); 1161 return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s);
1162} 1162}
@@ -1365,7 +1365,7 @@ fc_get_fc4type_bitmask(u8 fc4_type, u8 *bit_mask)
1365 1365
1366 index = fc4_type >> 5; 1366 index = fc4_type >> 5;
1367 type_value = 1 << (fc4_type % 32); 1367 type_value = 1 << (fc4_type % 32);
1368 ptr[index] = bfa_os_htonl(type_value); 1368 ptr[index] = cpu_to_be32(type_value);
1369 1369
1370} 1370}
1371 1371
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c
index e9075a68e703..8c585bd855ed 100644
--- a/drivers/scsi/bfa/bfa_fcpim.c
+++ b/drivers/scsi/bfa/bfa_fcpim.c
@@ -2260,11 +2260,11 @@ __bfa_cb_ioim_comp(void *cbarg, bfa_boolean_t complete)
2260 * setup residue value correctly for normal completions 2260 * setup residue value correctly for normal completions
2261 */ 2261 */
2262 if (m->resid_flags == FCP_RESID_UNDER) { 2262 if (m->resid_flags == FCP_RESID_UNDER) {
2263 residue = bfa_os_ntohl(m->residue); 2263 residue = be32_to_cpu(m->residue);
2264 bfa_stats(ioim->itnim, iocomp_underrun); 2264 bfa_stats(ioim->itnim, iocomp_underrun);
2265 } 2265 }
2266 if (m->resid_flags == FCP_RESID_OVER) { 2266 if (m->resid_flags == FCP_RESID_OVER) {
2267 residue = bfa_os_ntohl(m->residue); 2267 residue = be32_to_cpu(m->residue);
2268 residue = -residue; 2268 residue = -residue;
2269 bfa_stats(ioim->itnim, iocomp_overrun); 2269 bfa_stats(ioim->itnim, iocomp_overrun);
2270 } 2270 }
@@ -2357,7 +2357,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
2357 /** 2357 /**
2358 * build i/o request message next 2358 * build i/o request message next
2359 */ 2359 */
2360 m->io_tag = bfa_os_htons(ioim->iotag); 2360 m->io_tag = cpu_to_be16(ioim->iotag);
2361 m->rport_hdl = ioim->itnim->rport->fw_handle; 2361 m->rport_hdl = ioim->itnim->rport->fw_handle;
2362 m->io_timeout = bfa_cb_ioim_get_timeout(ioim->dio); 2362 m->io_timeout = bfa_cb_ioim_get_timeout(ioim->dio);
2363 2363
@@ -2395,7 +2395,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
2395 m->cmnd.iodir = bfa_cb_ioim_get_iodir(ioim->dio); 2395 m->cmnd.iodir = bfa_cb_ioim_get_iodir(ioim->dio);
2396 m->cmnd.cdb = *(scsi_cdb_t *)bfa_cb_ioim_get_cdb(ioim->dio); 2396 m->cmnd.cdb = *(scsi_cdb_t *)bfa_cb_ioim_get_cdb(ioim->dio);
2397 fcp_dl = bfa_cb_ioim_get_size(ioim->dio); 2397 fcp_dl = bfa_cb_ioim_get_size(ioim->dio);
2398 m->cmnd.fcp_dl = bfa_os_htonl(fcp_dl); 2398 m->cmnd.fcp_dl = cpu_to_be32(fcp_dl);
2399 2399
2400 /** 2400 /**
2401 * set up I/O message header 2401 * set up I/O message header
@@ -2436,7 +2436,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
2436 bfa_cb_ioim_get_cdb(ioim->dio) + 1, 2436 bfa_cb_ioim_get_cdb(ioim->dio) + 1,
2437 m->cmnd.addl_cdb_len * sizeof(u32)); 2437 m->cmnd.addl_cdb_len * sizeof(u32));
2438 fcp_cmnd_fcpdl(&m->cmnd) = 2438 fcp_cmnd_fcpdl(&m->cmnd) =
2439 bfa_os_htonl(bfa_cb_ioim_get_size(ioim->dio)); 2439 cpu_to_be32(bfa_cb_ioim_get_size(ioim->dio));
2440 } 2440 }
2441#endif 2441#endif
2442 2442
@@ -2564,7 +2564,7 @@ bfa_ioim_send_abort(struct bfa_ioim_s *ioim)
2564 msgop = BFI_IOIM_H2I_IOCLEANUP_REQ; 2564 msgop = BFI_IOIM_H2I_IOCLEANUP_REQ;
2565 2565
2566 bfi_h2i_set(m->mh, BFI_MC_IOIM, msgop, bfa_lpuid(ioim->bfa)); 2566 bfi_h2i_set(m->mh, BFI_MC_IOIM, msgop, bfa_lpuid(ioim->bfa));
2567 m->io_tag = bfa_os_htons(ioim->iotag); 2567 m->io_tag = cpu_to_be16(ioim->iotag);
2568 m->abort_tag = ++ioim->abort_tag; 2568 m->abort_tag = ++ioim->abort_tag;
2569 2569
2570 /** 2570 /**
@@ -2739,7 +2739,7 @@ bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
2739 u16 iotag; 2739 u16 iotag;
2740 enum bfa_ioim_event evt = BFA_IOIM_SM_COMP; 2740 enum bfa_ioim_event evt = BFA_IOIM_SM_COMP;
2741 2741
2742 iotag = bfa_os_ntohs(rsp->io_tag); 2742 iotag = be16_to_cpu(rsp->io_tag);
2743 2743
2744 ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); 2744 ioim = BFA_IOIM_FROM_TAG(fcpim, iotag);
2745 bfa_assert(ioim->iotag == iotag); 2745 bfa_assert(ioim->iotag == iotag);
@@ -2822,7 +2822,7 @@ bfa_ioim_good_comp_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
2822 struct bfa_ioim_s *ioim; 2822 struct bfa_ioim_s *ioim;
2823 u16 iotag; 2823 u16 iotag;
2824 2824
2825 iotag = bfa_os_ntohs(rsp->io_tag); 2825 iotag = be16_to_cpu(rsp->io_tag);
2826 2826
2827 ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); 2827 ioim = BFA_IOIM_FROM_TAG(fcpim, iotag);
2828 bfa_assert(ioim->iotag == iotag); 2828 bfa_assert(ioim->iotag == iotag);
@@ -3380,7 +3380,7 @@ bfa_tskim_send(struct bfa_tskim_s *tskim)
3380 bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_TM_REQ, 3380 bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_TM_REQ,
3381 bfa_lpuid(tskim->bfa)); 3381 bfa_lpuid(tskim->bfa));
3382 3382
3383 m->tsk_tag = bfa_os_htons(tskim->tsk_tag); 3383 m->tsk_tag = cpu_to_be16(tskim->tsk_tag);
3384 m->itn_fhdl = tskim->itnim->rport->fw_handle; 3384 m->itn_fhdl = tskim->itnim->rport->fw_handle;
3385 m->t_secs = tskim->tsecs; 3385 m->t_secs = tskim->tsecs;
3386 m->lun = tskim->lun; 3386 m->lun = tskim->lun;
@@ -3415,7 +3415,7 @@ bfa_tskim_send_abort(struct bfa_tskim_s *tskim)
3415 bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_ABORT_REQ, 3415 bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_ABORT_REQ,
3416 bfa_lpuid(tskim->bfa)); 3416 bfa_lpuid(tskim->bfa));
3417 3417
3418 m->tsk_tag = bfa_os_htons(tskim->tsk_tag); 3418 m->tsk_tag = cpu_to_be16(tskim->tsk_tag);
3419 3419
3420 /** 3420 /**
3421 * queue I/O message to firmware 3421 * queue I/O message to firmware
@@ -3535,7 +3535,7 @@ bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
3535 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 3535 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
3536 struct bfi_tskim_rsp_s *rsp = (struct bfi_tskim_rsp_s *) m; 3536 struct bfi_tskim_rsp_s *rsp = (struct bfi_tskim_rsp_s *) m;
3537 struct bfa_tskim_s *tskim; 3537 struct bfa_tskim_s *tskim;
3538 u16 tsk_tag = bfa_os_ntohs(rsp->tsk_tag); 3538 u16 tsk_tag = be16_to_cpu(rsp->tsk_tag);
3539 3539
3540 tskim = BFA_TSKIM_FROM_TAG(fcpim, tsk_tag); 3540 tskim = BFA_TSKIM_FROM_TAG(fcpim, tsk_tag);
3541 bfa_assert(tskim->tsk_tag == tsk_tag); 3541 bfa_assert(tskim->tsk_tag == tsk_tag);
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index 2bb3a7a61924..88eb91a302fe 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -1329,7 +1329,7 @@ bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric,
1329 return; 1329 return;
1330 } 1330 }
1331 1331
1332 fabric->bb_credit = bfa_os_ntohs(flogi->csp.bbcred); 1332 fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred);
1333 bport->port_topo.pn2n.rem_port_wwn = flogi->port_name; 1333 bport->port_topo.pn2n.rem_port_wwn = flogi->port_name;
1334 bport->port_topo.pn2n.reply_oxid = fchs->ox_id; 1334 bport->port_topo.pn2n.reply_oxid = fchs->ox_id;
1335 1335
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 6cee56fafa1d..263a7bfa16d8 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -482,9 +482,9 @@ bfa_fs_port_get_gen_topo_data(struct bfa_fcs_lport_s *port,
482 memset(gen_topo_data, 0, 482 memset(gen_topo_data, 0,
483 sizeof(struct fc_rnid_general_topology_data_s)); 483 sizeof(struct fc_rnid_general_topology_data_s));
484 484
485 gen_topo_data->asso_type = bfa_os_htonl(RNID_ASSOCIATED_TYPE_HOST); 485 gen_topo_data->asso_type = cpu_to_be32(RNID_ASSOCIATED_TYPE_HOST);
486 gen_topo_data->phy_port_num = 0; /* @todo */ 486 gen_topo_data->phy_port_num = 0; /* @todo */
487 gen_topo_data->num_attached_nodes = bfa_os_htonl(1); 487 gen_topo_data->num_attached_nodes = cpu_to_be32(1);
488} 488}
489 489
490static void 490static void
@@ -1584,7 +1584,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1584 bfa_fcs_fdmi_get_hbaattr(fdmi, fcs_hba_attr); 1584 bfa_fcs_fdmi_get_hbaattr(fdmi, fcs_hba_attr);
1585 1585
1586 rhba->hba_id = bfa_fcs_lport_get_pwwn(port); 1586 rhba->hba_id = bfa_fcs_lport_get_pwwn(port);
1587 rhba->port_list.num_ports = bfa_os_htonl(1); 1587 rhba->port_list.num_ports = cpu_to_be32(1);
1588 rhba->port_list.port_entry = bfa_fcs_lport_get_pwwn(port); 1588 rhba->port_list.port_entry = bfa_fcs_lport_get_pwwn(port);
1589 1589
1590 len = sizeof(rhba->hba_id) + sizeof(rhba->port_list); 1590 len = sizeof(rhba->hba_id) + sizeof(rhba->port_list);
@@ -1601,21 +1601,21 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1601 * Node Name 1601 * Node Name
1602 */ 1602 */
1603 attr = (struct fdmi_attr_s *) curr_ptr; 1603 attr = (struct fdmi_attr_s *) curr_ptr;
1604 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_NODENAME); 1604 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NODENAME);
1605 attr->len = sizeof(wwn_t); 1605 attr->len = sizeof(wwn_t);
1606 memcpy(attr->value, &bfa_fcs_lport_get_nwwn(port), attr->len); 1606 memcpy(attr->value, &bfa_fcs_lport_get_nwwn(port), attr->len);
1607 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; 1607 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len;
1608 len += attr->len; 1608 len += attr->len;
1609 count++; 1609 count++;
1610 attr->len = 1610 attr->len =
1611 bfa_os_htons(attr->len + sizeof(attr->type) + 1611 cpu_to_be16(attr->len + sizeof(attr->type) +
1612 sizeof(attr->len)); 1612 sizeof(attr->len));
1613 1613
1614 /* 1614 /*
1615 * Manufacturer 1615 * Manufacturer
1616 */ 1616 */
1617 attr = (struct fdmi_attr_s *) curr_ptr; 1617 attr = (struct fdmi_attr_s *) curr_ptr;
1618 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MANUFACTURER); 1618 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MANUFACTURER);
1619 attr->len = (u16) strlen(fcs_hba_attr->manufacturer); 1619 attr->len = (u16) strlen(fcs_hba_attr->manufacturer);
1620 memcpy(attr->value, fcs_hba_attr->manufacturer, attr->len); 1620 memcpy(attr->value, fcs_hba_attr->manufacturer, attr->len);
1621 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1621 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1626,14 +1626,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1626 len += attr->len; 1626 len += attr->len;
1627 count++; 1627 count++;
1628 attr->len = 1628 attr->len =
1629 bfa_os_htons(attr->len + sizeof(attr->type) + 1629 cpu_to_be16(attr->len + sizeof(attr->type) +
1630 sizeof(attr->len)); 1630 sizeof(attr->len));
1631 1631
1632 /* 1632 /*
1633 * Serial Number 1633 * Serial Number
1634 */ 1634 */
1635 attr = (struct fdmi_attr_s *) curr_ptr; 1635 attr = (struct fdmi_attr_s *) curr_ptr;
1636 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_SERIALNUM); 1636 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_SERIALNUM);
1637 attr->len = (u16) strlen(fcs_hba_attr->serial_num); 1637 attr->len = (u16) strlen(fcs_hba_attr->serial_num);
1638 memcpy(attr->value, fcs_hba_attr->serial_num, attr->len); 1638 memcpy(attr->value, fcs_hba_attr->serial_num, attr->len);
1639 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1639 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1644,14 +1644,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1644 len += attr->len; 1644 len += attr->len;
1645 count++; 1645 count++;
1646 attr->len = 1646 attr->len =
1647 bfa_os_htons(attr->len + sizeof(attr->type) + 1647 cpu_to_be16(attr->len + sizeof(attr->type) +
1648 sizeof(attr->len)); 1648 sizeof(attr->len));
1649 1649
1650 /* 1650 /*
1651 * Model 1651 * Model
1652 */ 1652 */
1653 attr = (struct fdmi_attr_s *) curr_ptr; 1653 attr = (struct fdmi_attr_s *) curr_ptr;
1654 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MODEL); 1654 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL);
1655 attr->len = (u16) strlen(fcs_hba_attr->model); 1655 attr->len = (u16) strlen(fcs_hba_attr->model);
1656 memcpy(attr->value, fcs_hba_attr->model, attr->len); 1656 memcpy(attr->value, fcs_hba_attr->model, attr->len);
1657 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1657 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1662,14 +1662,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1662 len += attr->len; 1662 len += attr->len;
1663 count++; 1663 count++;
1664 attr->len = 1664 attr->len =
1665 bfa_os_htons(attr->len + sizeof(attr->type) + 1665 cpu_to_be16(attr->len + sizeof(attr->type) +
1666 sizeof(attr->len)); 1666 sizeof(attr->len));
1667 1667
1668 /* 1668 /*
1669 * Model Desc 1669 * Model Desc
1670 */ 1670 */
1671 attr = (struct fdmi_attr_s *) curr_ptr; 1671 attr = (struct fdmi_attr_s *) curr_ptr;
1672 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MODEL_DESC); 1672 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL_DESC);
1673 attr->len = (u16) strlen(fcs_hba_attr->model_desc); 1673 attr->len = (u16) strlen(fcs_hba_attr->model_desc);
1674 memcpy(attr->value, fcs_hba_attr->model_desc, attr->len); 1674 memcpy(attr->value, fcs_hba_attr->model_desc, attr->len);
1675 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1675 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1680,7 +1680,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1680 len += attr->len; 1680 len += attr->len;
1681 count++; 1681 count++;
1682 attr->len = 1682 attr->len =
1683 bfa_os_htons(attr->len + sizeof(attr->type) + 1683 cpu_to_be16(attr->len + sizeof(attr->type) +
1684 sizeof(attr->len)); 1684 sizeof(attr->len));
1685 1685
1686 /* 1686 /*
@@ -1688,7 +1688,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1688 */ 1688 */
1689 if (fcs_hba_attr->hw_version[0] != '\0') { 1689 if (fcs_hba_attr->hw_version[0] != '\0') {
1690 attr = (struct fdmi_attr_s *) curr_ptr; 1690 attr = (struct fdmi_attr_s *) curr_ptr;
1691 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_HW_VERSION); 1691 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_HW_VERSION);
1692 attr->len = (u16) strlen(fcs_hba_attr->hw_version); 1692 attr->len = (u16) strlen(fcs_hba_attr->hw_version);
1693 memcpy(attr->value, fcs_hba_attr->hw_version, attr->len); 1693 memcpy(attr->value, fcs_hba_attr->hw_version, attr->len);
1694 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1694 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1699,7 +1699,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1699 len += attr->len; 1699 len += attr->len;
1700 count++; 1700 count++;
1701 attr->len = 1701 attr->len =
1702 bfa_os_htons(attr->len + sizeof(attr->type) + 1702 cpu_to_be16(attr->len + sizeof(attr->type) +
1703 sizeof(attr->len)); 1703 sizeof(attr->len));
1704 } 1704 }
1705 1705
@@ -1707,7 +1707,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1707 * Driver Version 1707 * Driver Version
1708 */ 1708 */
1709 attr = (struct fdmi_attr_s *) curr_ptr; 1709 attr = (struct fdmi_attr_s *) curr_ptr;
1710 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_DRIVER_VERSION); 1710 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_DRIVER_VERSION);
1711 attr->len = (u16) strlen(fcs_hba_attr->driver_version); 1711 attr->len = (u16) strlen(fcs_hba_attr->driver_version);
1712 memcpy(attr->value, fcs_hba_attr->driver_version, attr->len); 1712 memcpy(attr->value, fcs_hba_attr->driver_version, attr->len);
1713 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1713 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1718,7 +1718,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1718 len += attr->len;; 1718 len += attr->len;;
1719 count++; 1719 count++;
1720 attr->len = 1720 attr->len =
1721 bfa_os_htons(attr->len + sizeof(attr->type) + 1721 cpu_to_be16(attr->len + sizeof(attr->type) +
1722 sizeof(attr->len)); 1722 sizeof(attr->len));
1723 1723
1724 /* 1724 /*
@@ -1726,7 +1726,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1726 */ 1726 */
1727 if (fcs_hba_attr->option_rom_ver[0] != '\0') { 1727 if (fcs_hba_attr->option_rom_ver[0] != '\0') {
1728 attr = (struct fdmi_attr_s *) curr_ptr; 1728 attr = (struct fdmi_attr_s *) curr_ptr;
1729 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_ROM_VERSION); 1729 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_ROM_VERSION);
1730 attr->len = (u16) strlen(fcs_hba_attr->option_rom_ver); 1730 attr->len = (u16) strlen(fcs_hba_attr->option_rom_ver);
1731 memcpy(attr->value, fcs_hba_attr->option_rom_ver, attr->len); 1731 memcpy(attr->value, fcs_hba_attr->option_rom_ver, attr->len);
1732 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1732 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1737,7 +1737,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1737 len += attr->len; 1737 len += attr->len;
1738 count++; 1738 count++;
1739 attr->len = 1739 attr->len =
1740 bfa_os_htons(attr->len + sizeof(attr->type) + 1740 cpu_to_be16(attr->len + sizeof(attr->type) +
1741 sizeof(attr->len)); 1741 sizeof(attr->len));
1742 } 1742 }
1743 1743
@@ -1745,7 +1745,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1745 * f/w Version = driver version 1745 * f/w Version = driver version
1746 */ 1746 */
1747 attr = (struct fdmi_attr_s *) curr_ptr; 1747 attr = (struct fdmi_attr_s *) curr_ptr;
1748 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_FW_VERSION); 1748 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_FW_VERSION);
1749 attr->len = (u16) strlen(fcs_hba_attr->driver_version); 1749 attr->len = (u16) strlen(fcs_hba_attr->driver_version);
1750 memcpy(attr->value, fcs_hba_attr->driver_version, attr->len); 1750 memcpy(attr->value, fcs_hba_attr->driver_version, attr->len);
1751 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1751 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1756,7 +1756,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1756 len += attr->len; 1756 len += attr->len;
1757 count++; 1757 count++;
1758 attr->len = 1758 attr->len =
1759 bfa_os_htons(attr->len + sizeof(attr->type) + 1759 cpu_to_be16(attr->len + sizeof(attr->type) +
1760 sizeof(attr->len)); 1760 sizeof(attr->len));
1761 1761
1762 /* 1762 /*
@@ -1764,7 +1764,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1764 */ 1764 */
1765 if (fcs_hba_attr->os_name[0] != '\0') { 1765 if (fcs_hba_attr->os_name[0] != '\0') {
1766 attr = (struct fdmi_attr_s *) curr_ptr; 1766 attr = (struct fdmi_attr_s *) curr_ptr;
1767 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_OS_NAME); 1767 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_OS_NAME);
1768 attr->len = (u16) strlen(fcs_hba_attr->os_name); 1768 attr->len = (u16) strlen(fcs_hba_attr->os_name);
1769 memcpy(attr->value, fcs_hba_attr->os_name, attr->len); 1769 memcpy(attr->value, fcs_hba_attr->os_name, attr->len);
1770 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1770 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1775,7 +1775,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1775 len += attr->len; 1775 len += attr->len;
1776 count++; 1776 count++;
1777 attr->len = 1777 attr->len =
1778 bfa_os_htons(attr->len + sizeof(attr->type) + 1778 cpu_to_be16(attr->len + sizeof(attr->type) +
1779 sizeof(attr->len)); 1779 sizeof(attr->len));
1780 } 1780 }
1781 1781
@@ -1783,13 +1783,13 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1783 * MAX_CT_PAYLOAD 1783 * MAX_CT_PAYLOAD
1784 */ 1784 */
1785 attr = (struct fdmi_attr_s *) curr_ptr; 1785 attr = (struct fdmi_attr_s *) curr_ptr;
1786 attr->type = bfa_os_htons(FDMI_HBA_ATTRIB_MAX_CT); 1786 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MAX_CT);
1787 attr->len = sizeof(fcs_hba_attr->max_ct_pyld); 1787 attr->len = sizeof(fcs_hba_attr->max_ct_pyld);
1788 memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, attr->len); 1788 memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, attr->len);
1789 len += attr->len; 1789 len += attr->len;
1790 count++; 1790 count++;
1791 attr->len = 1791 attr->len =
1792 bfa_os_htons(attr->len + sizeof(attr->type) + 1792 cpu_to_be16(attr->len + sizeof(attr->type) +
1793 sizeof(attr->len)); 1793 sizeof(attr->len));
1794 1794
1795 /* 1795 /*
@@ -1798,7 +1798,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
1798 len += ((sizeof(attr->type) + 1798 len += ((sizeof(attr->type) +
1799 sizeof(attr->len)) * count); 1799 sizeof(attr->len)) * count);
1800 1800
1801 rhba->hba_attr_blk.attr_count = bfa_os_htonl(count); 1801 rhba->hba_attr_blk.attr_count = cpu_to_be32(count);
1802 return len; 1802 return len;
1803} 1803}
1804 1804
@@ -1825,7 +1825,7 @@ bfa_fcs_lport_fdmi_rhba_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
1825 } 1825 }
1826 1826
1827 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 1827 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
1828 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 1828 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
1829 1829
1830 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 1830 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
1831 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); 1831 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK);
@@ -1909,56 +1909,56 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
1909 * FC4 Types 1909 * FC4 Types
1910 */ 1910 */
1911 attr = (struct fdmi_attr_s *) curr_ptr; 1911 attr = (struct fdmi_attr_s *) curr_ptr;
1912 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_FC4_TYPES); 1912 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_FC4_TYPES);
1913 attr->len = sizeof(fcs_port_attr.supp_fc4_types); 1913 attr->len = sizeof(fcs_port_attr.supp_fc4_types);
1914 memcpy(attr->value, fcs_port_attr.supp_fc4_types, attr->len); 1914 memcpy(attr->value, fcs_port_attr.supp_fc4_types, attr->len);
1915 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; 1915 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len;
1916 len += attr->len; 1916 len += attr->len;
1917 ++count; 1917 ++count;
1918 attr->len = 1918 attr->len =
1919 bfa_os_htons(attr->len + sizeof(attr->type) + 1919 cpu_to_be16(attr->len + sizeof(attr->type) +
1920 sizeof(attr->len)); 1920 sizeof(attr->len));
1921 1921
1922 /* 1922 /*
1923 * Supported Speed 1923 * Supported Speed
1924 */ 1924 */
1925 attr = (struct fdmi_attr_s *) curr_ptr; 1925 attr = (struct fdmi_attr_s *) curr_ptr;
1926 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_SUPP_SPEED); 1926 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_SUPP_SPEED);
1927 attr->len = sizeof(fcs_port_attr.supp_speed); 1927 attr->len = sizeof(fcs_port_attr.supp_speed);
1928 memcpy(attr->value, &fcs_port_attr.supp_speed, attr->len); 1928 memcpy(attr->value, &fcs_port_attr.supp_speed, attr->len);
1929 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; 1929 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len;
1930 len += attr->len; 1930 len += attr->len;
1931 ++count; 1931 ++count;
1932 attr->len = 1932 attr->len =
1933 bfa_os_htons(attr->len + sizeof(attr->type) + 1933 cpu_to_be16(attr->len + sizeof(attr->type) +
1934 sizeof(attr->len)); 1934 sizeof(attr->len));
1935 1935
1936 /* 1936 /*
1937 * current Port Speed 1937 * current Port Speed
1938 */ 1938 */
1939 attr = (struct fdmi_attr_s *) curr_ptr; 1939 attr = (struct fdmi_attr_s *) curr_ptr;
1940 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_PORT_SPEED); 1940 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_SPEED);
1941 attr->len = sizeof(fcs_port_attr.curr_speed); 1941 attr->len = sizeof(fcs_port_attr.curr_speed);
1942 memcpy(attr->value, &fcs_port_attr.curr_speed, attr->len); 1942 memcpy(attr->value, &fcs_port_attr.curr_speed, attr->len);
1943 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; 1943 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len;
1944 len += attr->len; 1944 len += attr->len;
1945 ++count; 1945 ++count;
1946 attr->len = 1946 attr->len =
1947 bfa_os_htons(attr->len + sizeof(attr->type) + 1947 cpu_to_be16(attr->len + sizeof(attr->type) +
1948 sizeof(attr->len)); 1948 sizeof(attr->len));
1949 1949
1950 /* 1950 /*
1951 * max frame size 1951 * max frame size
1952 */ 1952 */
1953 attr = (struct fdmi_attr_s *) curr_ptr; 1953 attr = (struct fdmi_attr_s *) curr_ptr;
1954 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_FRAME_SIZE); 1954 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_FRAME_SIZE);
1955 attr->len = sizeof(fcs_port_attr.max_frm_size); 1955 attr->len = sizeof(fcs_port_attr.max_frm_size);
1956 memcpy(attr->value, &fcs_port_attr.max_frm_size, attr->len); 1956 memcpy(attr->value, &fcs_port_attr.max_frm_size, attr->len);
1957 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; 1957 curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len;
1958 len += attr->len; 1958 len += attr->len;
1959 ++count; 1959 ++count;
1960 attr->len = 1960 attr->len =
1961 bfa_os_htons(attr->len + sizeof(attr->type) + 1961 cpu_to_be16(attr->len + sizeof(attr->type) +
1962 sizeof(attr->len)); 1962 sizeof(attr->len));
1963 1963
1964 /* 1964 /*
@@ -1966,7 +1966,7 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
1966 */ 1966 */
1967 if (fcs_port_attr.os_device_name[0] != '\0') { 1967 if (fcs_port_attr.os_device_name[0] != '\0') {
1968 attr = (struct fdmi_attr_s *) curr_ptr; 1968 attr = (struct fdmi_attr_s *) curr_ptr;
1969 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_DEV_NAME); 1969 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_DEV_NAME);
1970 attr->len = (u16) strlen(fcs_port_attr.os_device_name); 1970 attr->len = (u16) strlen(fcs_port_attr.os_device_name);
1971 memcpy(attr->value, fcs_port_attr.os_device_name, attr->len); 1971 memcpy(attr->value, fcs_port_attr.os_device_name, attr->len);
1972 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1972 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1977,7 +1977,7 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
1977 len += attr->len; 1977 len += attr->len;
1978 ++count; 1978 ++count;
1979 attr->len = 1979 attr->len =
1980 bfa_os_htons(attr->len + sizeof(attr->type) + 1980 cpu_to_be16(attr->len + sizeof(attr->type) +
1981 sizeof(attr->len)); 1981 sizeof(attr->len));
1982 } 1982 }
1983 /* 1983 /*
@@ -1985,7 +1985,7 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
1985 */ 1985 */
1986 if (fcs_port_attr.host_name[0] != '\0') { 1986 if (fcs_port_attr.host_name[0] != '\0') {
1987 attr = (struct fdmi_attr_s *) curr_ptr; 1987 attr = (struct fdmi_attr_s *) curr_ptr;
1988 attr->type = bfa_os_htons(FDMI_PORT_ATTRIB_HOST_NAME); 1988 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_HOST_NAME);
1989 attr->len = (u16) strlen(fcs_port_attr.host_name); 1989 attr->len = (u16) strlen(fcs_port_attr.host_name);
1990 memcpy(attr->value, fcs_port_attr.host_name, attr->len); 1990 memcpy(attr->value, fcs_port_attr.host_name, attr->len);
1991 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable 1991 attr->len = fc_roundup(attr->len, sizeof(u32)); /* variable
@@ -1996,14 +1996,14 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
1996 len += attr->len; 1996 len += attr->len;
1997 ++count; 1997 ++count;
1998 attr->len = 1998 attr->len =
1999 bfa_os_htons(attr->len + sizeof(attr->type) + 1999 cpu_to_be16(attr->len + sizeof(attr->type) +
2000 sizeof(attr->len)); 2000 sizeof(attr->len));
2001 } 2001 }
2002 2002
2003 /* 2003 /*
2004 * Update size of payload 2004 * Update size of payload
2005 */ 2005 */
2006 port_attrib->attr_count = bfa_os_htonl(count); 2006 port_attrib->attr_count = cpu_to_be32(count);
2007 len += ((sizeof(attr->type) + 2007 len += ((sizeof(attr->type) +
2008 sizeof(attr->len)) * count); 2008 sizeof(attr->len)) * count);
2009 return len; 2009 return len;
@@ -2050,7 +2050,7 @@ bfa_fcs_lport_fdmi_rprt_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
2050 } 2050 }
2051 2051
2052 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 2052 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
2053 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 2053 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
2054 2054
2055 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 2055 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
2056 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); 2056 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK);
@@ -2143,7 +2143,7 @@ bfa_fcs_lport_fdmi_rpa_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
2143 } 2143 }
2144 2144
2145 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 2145 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
2146 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 2146 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
2147 2147
2148 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 2148 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
2149 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK); 2149 bfa_sm_send_event(fdmi, FDMISM_EVENT_RSP_OK);
@@ -2204,7 +2204,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi,
2204 sizeof(driver_info->host_os_patch)); 2204 sizeof(driver_info->host_os_patch));
2205 } 2205 }
2206 2206
2207 hba_attr->max_ct_pyld = bfa_os_htonl(FC_MAX_PDUSZ); 2207 hba_attr->max_ct_pyld = cpu_to_be32(FC_MAX_PDUSZ);
2208} 2208}
2209 2209
2210void 2210void
@@ -2230,17 +2230,17 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi,
2230 /* 2230 /*
2231 * Supported Speeds 2231 * Supported Speeds
2232 */ 2232 */
2233 port_attr->supp_speed = bfa_os_htonl(BFA_FCS_FDMI_SUPORTED_SPEEDS); 2233 port_attr->supp_speed = cpu_to_be32(BFA_FCS_FDMI_SUPORTED_SPEEDS);
2234 2234
2235 /* 2235 /*
2236 * Current Speed 2236 * Current Speed
2237 */ 2237 */
2238 port_attr->curr_speed = bfa_os_htonl(pport_attr.speed); 2238 port_attr->curr_speed = cpu_to_be32(pport_attr.speed);
2239 2239
2240 /* 2240 /*
2241 * Max PDU Size. 2241 * Max PDU Size.
2242 */ 2242 */
2243 port_attr->max_frm_size = bfa_os_htonl(FC_MAX_PDUSZ); 2243 port_attr->max_frm_size = cpu_to_be32(FC_MAX_PDUSZ);
2244 2244
2245 /* 2245 /*
2246 * OS device Name 2246 * OS device Name
@@ -2657,12 +2657,12 @@ bfa_fcs_lport_ms_gmal_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
2657 } 2657 }
2658 2658
2659 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 2659 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
2660 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 2660 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
2661 2661
2662 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 2662 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
2663 gmal_resp = (struct fcgs_gmal_resp_s *)(cthdr + 1); 2663 gmal_resp = (struct fcgs_gmal_resp_s *)(cthdr + 1);
2664 2664
2665 num_entries = bfa_os_ntohl(gmal_resp->ms_len); 2665 num_entries = be32_to_cpu(gmal_resp->ms_len);
2666 if (num_entries == 0) { 2666 if (num_entries == 0) {
2667 bfa_sm_send_event(ms, MSSM_EVENT_RSP_ERROR); 2667 bfa_sm_send_event(ms, MSSM_EVENT_RSP_ERROR);
2668 return; 2668 return;
@@ -2853,7 +2853,7 @@ bfa_fcs_lport_ms_gfn_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
2853 } 2853 }
2854 2854
2855 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 2855 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
2856 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 2856 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
2857 2857
2858 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 2858 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
2859 gfn_resp = (wwn_t *)(cthdr + 1); 2859 gfn_resp = (wwn_t *)(cthdr + 1);
@@ -3815,7 +3815,7 @@ bfa_fcs_lport_ns_rspn_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
3815 } 3815 }
3816 3816
3817 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 3817 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
3818 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 3818 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
3819 3819
3820 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 3820 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
3821 port->stats.ns_rspnid_accepts++; 3821 port->stats.ns_rspnid_accepts++;
@@ -3887,7 +3887,7 @@ bfa_fcs_lport_ns_rft_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
3887 } 3887 }
3888 3888
3889 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 3889 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
3890 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 3890 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
3891 3891
3892 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 3892 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
3893 port->stats.ns_rftid_accepts++; 3893 port->stats.ns_rftid_accepts++;
@@ -3964,7 +3964,7 @@ bfa_fcs_lport_ns_rff_id_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
3964 } 3964 }
3965 3965
3966 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 3966 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
3967 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 3967 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
3968 3968
3969 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 3969 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
3970 port->stats.ns_rffid_accepts++; 3970 port->stats.ns_rffid_accepts++;
@@ -4058,7 +4058,7 @@ bfa_fcs_lport_ns_gid_ft_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
4058 } 4058 }
4059 4059
4060 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 4060 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
4061 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 4061 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
4062 4062
4063 switch (cthdr->cmd_rsp_code) { 4063 switch (cthdr->cmd_rsp_code) {
4064 4064
@@ -4624,7 +4624,7 @@ bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port,
4624 int i = 0, j; 4624 int i = 0, j;
4625 4625
4626 num_entries = 4626 num_entries =
4627 (bfa_os_ntohs(rscn->payldlen) - 4627 (be16_to_cpu(rscn->payldlen) -
4628 sizeof(u32)) / sizeof(rscn->event[0]); 4628 sizeof(u32)) / sizeof(rscn->event[0]);
4629 4629
4630 bfa_trc(port->fcs, num_entries); 4630 bfa_trc(port->fcs, num_entries);
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c
index a6872d328975..12b50bda589d 100644
--- a/drivers/scsi/bfa/bfa_fcs_rport.c
+++ b/drivers/scsi/bfa/bfa_fcs_rport.c
@@ -1621,7 +1621,7 @@ bfa_fcs_rport_gidpn_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
1621 bfa_trc(rport->fcs, rport->pwwn); 1621 bfa_trc(rport->fcs, rport->pwwn);
1622 1622
1623 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 1623 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
1624 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 1624 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
1625 1625
1626 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 1626 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
1627 /* Check if the pid is the same as before. */ 1627 /* Check if the pid is the same as before. */
@@ -1691,7 +1691,7 @@ bfa_fcs_rport_gpnid_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
1691 bfa_trc(rport->fcs, rport->pwwn); 1691 bfa_trc(rport->fcs, rport->pwwn);
1692 1692
1693 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp); 1693 cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
1694 cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code); 1694 cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
1695 1695
1696 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) { 1696 if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
1697 bfa_sm_send_event(rport, RPSM_EVENT_ACCEPTED); 1697 bfa_sm_send_event(rport, RPSM_EVENT_ACCEPTED);
@@ -2123,9 +2123,9 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi)
2123 * - MAX receive frame size 2123 * - MAX receive frame size
2124 */ 2124 */
2125 rport->cisc = plogi->csp.cisc; 2125 rport->cisc = plogi->csp.cisc;
2126 rport->maxfrsize = bfa_os_ntohs(plogi->class3.rxsz); 2126 rport->maxfrsize = be16_to_cpu(plogi->class3.rxsz);
2127 2127
2128 bfa_trc(port->fcs, bfa_os_ntohs(plogi->csp.bbcred)); 2128 bfa_trc(port->fcs, be16_to_cpu(plogi->csp.bbcred));
2129 bfa_trc(port->fcs, port->fabric->bb_credit); 2129 bfa_trc(port->fcs, port->fabric->bb_credit);
2130 /** 2130 /**
2131 * Direct Attach P2P mode : 2131 * Direct Attach P2P mode :
@@ -2136,12 +2136,12 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi)
2136 * in PLOGI. 2136 * in PLOGI.
2137 */ 2137 */
2138 if ((!bfa_fcs_fabric_is_switched(port->fabric)) && 2138 if ((!bfa_fcs_fabric_is_switched(port->fabric)) &&
2139 (bfa_os_ntohs(plogi->csp.bbcred) < port->fabric->bb_credit)) { 2139 (be16_to_cpu(plogi->csp.bbcred) < port->fabric->bb_credit)) {
2140 2140
2141 bfa_trc(port->fcs, bfa_os_ntohs(plogi->csp.bbcred)); 2141 bfa_trc(port->fcs, be16_to_cpu(plogi->csp.bbcred));
2142 bfa_trc(port->fcs, port->fabric->bb_credit); 2142 bfa_trc(port->fcs, port->fabric->bb_credit);
2143 2143
2144 port->fabric->bb_credit = bfa_os_ntohs(plogi->csp.bbcred); 2144 port->fabric->bb_credit = be16_to_cpu(plogi->csp.bbcred);
2145 bfa_fcport_set_tx_bbcredit(port->fcs->bfa, 2145 bfa_fcport_set_tx_bbcredit(port->fcs->bfa,
2146 port->fabric->bb_credit); 2146 port->fabric->bb_credit);
2147 } 2147 }
@@ -3090,16 +3090,16 @@ bfa_fcs_rpf_rpsc2_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
3090 rpsc2_acc = (struct fc_rpsc2_acc_s *) BFA_FCXP_RSP_PLD(fcxp); 3090 rpsc2_acc = (struct fc_rpsc2_acc_s *) BFA_FCXP_RSP_PLD(fcxp);
3091 if (rpsc2_acc->els_cmd == FC_ELS_ACC) { 3091 if (rpsc2_acc->els_cmd == FC_ELS_ACC) {
3092 rport->stats.rpsc_accs++; 3092 rport->stats.rpsc_accs++;
3093 num_ents = bfa_os_ntohs(rpsc2_acc->num_pids); 3093 num_ents = be16_to_cpu(rpsc2_acc->num_pids);
3094 bfa_trc(rport->fcs, num_ents); 3094 bfa_trc(rport->fcs, num_ents);
3095 if (num_ents > 0) { 3095 if (num_ents > 0) {
3096 bfa_assert(rpsc2_acc->port_info[0].pid != rport->pid); 3096 bfa_assert(rpsc2_acc->port_info[0].pid != rport->pid);
3097 bfa_trc(rport->fcs, 3097 bfa_trc(rport->fcs,
3098 bfa_os_ntohs(rpsc2_acc->port_info[0].pid)); 3098 be16_to_cpu(rpsc2_acc->port_info[0].pid));
3099 bfa_trc(rport->fcs, 3099 bfa_trc(rport->fcs,
3100 bfa_os_ntohs(rpsc2_acc->port_info[0].speed)); 3100 be16_to_cpu(rpsc2_acc->port_info[0].speed));
3101 bfa_trc(rport->fcs, 3101 bfa_trc(rport->fcs,
3102 bfa_os_ntohs(rpsc2_acc->port_info[0].index)); 3102 be16_to_cpu(rpsc2_acc->port_info[0].index));
3103 bfa_trc(rport->fcs, 3103 bfa_trc(rport->fcs,
3104 rpsc2_acc->port_info[0].type); 3104 rpsc2_acc->port_info[0].type);
3105 3105
@@ -3109,7 +3109,7 @@ bfa_fcs_rpf_rpsc2_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
3109 } 3109 }
3110 3110
3111 rpf->rpsc_speed = fc_rpsc_operspeed_to_bfa_speed( 3111 rpf->rpsc_speed = fc_rpsc_operspeed_to_bfa_speed(
3112 bfa_os_ntohs(rpsc2_acc->port_info[0].speed)); 3112 be16_to_cpu(rpsc2_acc->port_info[0].speed));
3113 3113
3114 bfa_sm_send_event(rpf, RPFSM_EVENT_RPSC_COMP); 3114 bfa_sm_send_event(rpf, RPFSM_EVENT_RPSC_COMP);
3115 } 3115 }
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c
index bd25fc2c874b..8d3bf404229d 100644
--- a/drivers/scsi/bfa/bfa_ioc.c
+++ b/drivers/scsi/bfa/bfa_ioc.c
@@ -1450,7 +1450,7 @@ bfa_ioc_mbox_send(struct bfa_ioc_s *ioc, void *ioc_msg, int len)
1450 */ 1450 */
1451 for (i = 0; i < len / sizeof(u32); i++) 1451 for (i = 0; i < len / sizeof(u32); i++)
1452 bfa_reg_write(ioc->ioc_regs.hfn_mbox + i * sizeof(u32), 1452 bfa_reg_write(ioc->ioc_regs.hfn_mbox + i * sizeof(u32),
1453 bfa_os_wtole(msgp[i])); 1453 cpu_to_le32(msgp[i]));
1454 1454
1455 for (; i < BFI_IOC_MSGLEN_MAX / sizeof(u32); i++) 1455 for (; i < BFI_IOC_MSGLEN_MAX / sizeof(u32); i++)
1456 bfa_reg_write(ioc->ioc_regs.hfn_mbox + i * sizeof(u32), 0); 1456 bfa_reg_write(ioc->ioc_regs.hfn_mbox + i * sizeof(u32), 0);
@@ -1472,7 +1472,7 @@ bfa_ioc_send_enable(struct bfa_ioc_s *ioc)
1472 bfa_ioc_portid(ioc)); 1472 bfa_ioc_portid(ioc));
1473 enable_req.ioc_class = ioc->ioc_mc; 1473 enable_req.ioc_class = ioc->ioc_mc;
1474 bfa_os_gettimeofday(&tv); 1474 bfa_os_gettimeofday(&tv);
1475 enable_req.tv_sec = bfa_os_ntohl(tv.tv_sec); 1475 enable_req.tv_sec = be32_to_cpu(tv.tv_sec);
1476 bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s)); 1476 bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s));
1477} 1477}
1478 1478
@@ -1609,9 +1609,9 @@ bfa_ioc_getattr_reply(struct bfa_ioc_s *ioc)
1609{ 1609{
1610 struct bfi_ioc_attr_s *attr = ioc->attr; 1610 struct bfi_ioc_attr_s *attr = ioc->attr;
1611 1611
1612 attr->adapter_prop = bfa_os_ntohl(attr->adapter_prop); 1612 attr->adapter_prop = be32_to_cpu(attr->adapter_prop);
1613 attr->card_type = bfa_os_ntohl(attr->card_type); 1613 attr->card_type = be32_to_cpu(attr->card_type);
1614 attr->maxfrsize = bfa_os_ntohs(attr->maxfrsize); 1614 attr->maxfrsize = be16_to_cpu(attr->maxfrsize);
1615 1615
1616 bfa_fsm_send_event(ioc, IOC_E_FWRSP_GETATTR); 1616 bfa_fsm_send_event(ioc, IOC_E_FWRSP_GETATTR);
1617} 1617}
@@ -1710,7 +1710,7 @@ bfa_ioc_smem_read(struct bfa_ioc_s *ioc, void *tbuf, u32 soff, u32 sz)
1710 bfa_trc(ioc, len); 1710 bfa_trc(ioc, len);
1711 for (i = 0; i < len; i++) { 1711 for (i = 0; i < len; i++) {
1712 r32 = bfa_mem_read(ioc->ioc_regs.smem_page_start, loff); 1712 r32 = bfa_mem_read(ioc->ioc_regs.smem_page_start, loff);
1713 buf[i] = bfa_os_ntohl(r32); 1713 buf[i] = be32_to_cpu(r32);
1714 loff += sizeof(u32); 1714 loff += sizeof(u32);
1715 1715
1716 /** 1716 /**
@@ -1925,7 +1925,7 @@ bfa_ioc_msgget(struct bfa_ioc_s *ioc, void *mbmsg)
1925 i++) { 1925 i++) {
1926 r32 = bfa_reg_read(ioc->ioc_regs.lpu_mbox + 1926 r32 = bfa_reg_read(ioc->ioc_regs.lpu_mbox +
1927 i * sizeof(u32)); 1927 i * sizeof(u32));
1928 msgp[i] = bfa_os_htonl(r32); 1928 msgp[i] = cpu_to_be32(r32);
1929 } 1929 }
1930 1930
1931 /** 1931 /**
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h
index 97e1b16d2082..71c0b5ac4af5 100644
--- a/drivers/scsi/bfa/bfa_ioc.h
+++ b/drivers/scsi/bfa/bfa_ioc.h
@@ -125,8 +125,8 @@ __bfa_dma_addr_set(union bfi_addr_u *dma_addr, u64 pa)
125static inline void 125static inline void
126__bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa) 126__bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa)
127{ 127{
128 dma_addr->a32.addr_lo = (u32) bfa_os_htonl(pa); 128 dma_addr->a32.addr_lo = (u32) cpu_to_be32(pa);
129 dma_addr->a32.addr_hi = (u32) bfa_os_htonl(bfa_os_u32(pa)); 129 dma_addr->a32.addr_hi = (u32) cpu_to_be32(bfa_os_u32(pa));
130} 130}
131 131
132struct bfa_ioc_regs_s { 132struct bfa_ioc_regs_s {
diff --git a/drivers/scsi/bfa/bfa_os_inc.h b/drivers/scsi/bfa/bfa_os_inc.h
index a79a443f5f4a..d928dcaa5080 100644
--- a/drivers/scsi/bfa/bfa_os_inc.h
+++ b/drivers/scsi/bfa/bfa_os_inc.h
@@ -65,16 +65,6 @@ do { \
65 ((_x) & 0x00ff00) | \ 65 ((_x) & 0x00ff00) | \
66 (((_x) & 0xff0000) >> 16)) 66 (((_x) & 0xff0000) >> 16))
67 67
68#define bfa_swap_8b(_x) \
69 ((((_x) & 0xff00000000000000ull) >> 56) \
70 | (((_x) & 0x00ff000000000000ull) >> 40) \
71 | (((_x) & 0x0000ff0000000000ull) >> 24) \
72 | (((_x) & 0x000000ff00000000ull) >> 8) \
73 | (((_x) & 0x00000000ff000000ull) << 8) \
74 | (((_x) & 0x0000000000ff0000ull) << 24) \
75 | (((_x) & 0x000000000000ff00ull) << 40) \
76 | (((_x) & 0x00000000000000ffull) << 56))
77
78#define bfa_os_swap32(_x) \ 68#define bfa_os_swap32(_x) \
79 ((((_x) & 0xff) << 24) | \ 69 ((((_x) & 0xff) << 24) | \
80 (((_x) & 0x0000ff00) << 8) | \ 70 (((_x) & 0x0000ff00) << 8) | \
@@ -92,32 +82,15 @@ do { \
92 (((u64)(_x) & (u64)0xff00000000000000ull) >> 32))) 82 (((u64)(_x) & (u64)0xff00000000000000ull) >> 32)))
93 83
94#ifndef __BIGENDIAN 84#ifndef __BIGENDIAN
95#define bfa_os_htons(_x) ((u16)((((_x) & 0xff00) >> 8) | \
96 (((_x) & 0x00ff) << 8)))
97#define bfa_os_htonl(_x) bfa_os_swap32(_x)
98#define bfa_os_htonll(_x) bfa_swap_8b(_x)
99#define bfa_os_hton3b(_x) bfa_swap_3b(_x) 85#define bfa_os_hton3b(_x) bfa_swap_3b(_x)
100#define bfa_os_wtole(_x) (_x)
101#define bfa_os_sgaddr(_x) (_x) 86#define bfa_os_sgaddr(_x) (_x)
102
103#else 87#else
104
105#define bfa_os_htons(_x) (_x)
106#define bfa_os_htonl(_x) (_x)
107#define bfa_os_hton3b(_x) (_x) 88#define bfa_os_hton3b(_x) (_x)
108#define bfa_os_htonll(_x) (_x)
109#define bfa_os_wtole(_x) bfa_os_swap32(_x)
110#define bfa_os_sgaddr(_x) bfa_os_swap_sgaddr(_x) 89#define bfa_os_sgaddr(_x) bfa_os_swap_sgaddr(_x)
111
112#endif 90#endif
113 91
114#define bfa_os_ntohs(_x) bfa_os_htons(_x)
115#define bfa_os_ntohl(_x) bfa_os_htonl(_x)
116#define bfa_os_ntohll(_x) bfa_os_htonll(_x)
117#define bfa_os_ntoh3b(_x) bfa_os_hton3b(_x) 92#define bfa_os_ntoh3b(_x) bfa_os_hton3b(_x)
118
119#define bfa_os_u32(__pa64) ((__pa64) >> 32) 93#define bfa_os_u32(__pa64) ((__pa64) >> 32)
120
121#define bfa_os_addr_t void __iomem * 94#define bfa_os_addr_t void __iomem *
122 95
123#define bfa_os_reg_read(_raddr) readl(_raddr) 96#define bfa_os_reg_read(_raddr) readl(_raddr)
diff --git a/drivers/scsi/bfa/bfa_port.c b/drivers/scsi/bfa/bfa_port.c
index b6d170a13bea..17834ff11736 100644
--- a/drivers/scsi/bfa/bfa_port.c
+++ b/drivers/scsi/bfa/bfa_port.c
@@ -37,11 +37,11 @@ bfa_port_stats_swap(struct bfa_port_s *port, union bfa_port_stats_u *stats)
37 t0 = dip[i]; 37 t0 = dip[i];
38 t1 = dip[i + 1]; 38 t1 = dip[i + 1];
39#ifdef __BIGENDIAN 39#ifdef __BIGENDIAN
40 dip[i] = bfa_os_ntohl(t0); 40 dip[i] = be32_to_cpu(t0);
41 dip[i + 1] = bfa_os_ntohl(t1); 41 dip[i + 1] = be32_to_cpu(t1);
42#else 42#else
43 dip[i] = bfa_os_ntohl(t1); 43 dip[i] = be32_to_cpu(t1);
44 dip[i + 1] = bfa_os_ntohl(t0); 44 dip[i + 1] = be32_to_cpu(t0);
45#endif 45#endif
46 } 46 }
47} 47}
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index ee0701fd7b21..4d13688c76d6 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -740,11 +740,11 @@ hal_fcxp_send_comp(struct bfa_s *bfa, struct bfi_fcxp_send_rsp_s *fcxp_rsp)
740{ 740{
741 struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa); 741 struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa);
742 struct bfa_fcxp_s *fcxp; 742 struct bfa_fcxp_s *fcxp;
743 u16 fcxp_tag = bfa_os_ntohs(fcxp_rsp->fcxp_tag); 743 u16 fcxp_tag = be16_to_cpu(fcxp_rsp->fcxp_tag);
744 744
745 bfa_trc(bfa, fcxp_tag); 745 bfa_trc(bfa, fcxp_tag);
746 746
747 fcxp_rsp->rsp_len = bfa_os_ntohl(fcxp_rsp->rsp_len); 747 fcxp_rsp->rsp_len = be32_to_cpu(fcxp_rsp->rsp_len);
748 748
749 /** 749 /**
750 * @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
@@ -753,7 +753,7 @@ hal_fcxp_send_comp(struct bfa_s *bfa, struct bfi_fcxp_send_rsp_s *fcxp_rsp)
753 if (fcxp_rsp->req_status == BFA_STATUS_OK) 753 if (fcxp_rsp->req_status == BFA_STATUS_OK)
754 fcxp_rsp->residue_len = 0; 754 fcxp_rsp->residue_len = 0;
755 else 755 else
756 fcxp_rsp->residue_len = bfa_os_ntohl(fcxp_rsp->residue_len); 756 fcxp_rsp->residue_len = be32_to_cpu(fcxp_rsp->residue_len);
757 757
758 fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag); 758 fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag);
759 759
@@ -884,26 +884,26 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req)
884 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,
885 bfa_lpuid(bfa)); 885 bfa_lpuid(bfa));
886 886
887 send_req->fcxp_tag = bfa_os_htons(fcxp->fcxp_tag); 887 send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag);
888 if (rport) { 888 if (rport) {
889 send_req->rport_fw_hndl = rport->fw_handle; 889 send_req->rport_fw_hndl = rport->fw_handle;
890 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);
891 if (send_req->max_frmsz == 0) 891 if (send_req->max_frmsz == 0)
892 send_req->max_frmsz = bfa_os_htons(FC_MAX_PDUSZ); 892 send_req->max_frmsz = cpu_to_be16(FC_MAX_PDUSZ);
893 } else { 893 } else {
894 send_req->rport_fw_hndl = 0; 894 send_req->rport_fw_hndl = 0;
895 send_req->max_frmsz = bfa_os_htons(FC_MAX_PDUSZ); 895 send_req->max_frmsz = cpu_to_be16(FC_MAX_PDUSZ);
896 } 896 }
897 897
898 send_req->vf_id = bfa_os_htons(reqi->vf_id); 898 send_req->vf_id = cpu_to_be16(reqi->vf_id);
899 send_req->lp_tag = reqi->lp_tag; 899 send_req->lp_tag = reqi->lp_tag;
900 send_req->class = reqi->class; 900 send_req->class = reqi->class;
901 send_req->rsp_timeout = rspi->rsp_timeout; 901 send_req->rsp_timeout = rspi->rsp_timeout;
902 send_req->cts = reqi->cts; 902 send_req->cts = reqi->cts;
903 send_req->fchs = reqi->fchs; 903 send_req->fchs = reqi->fchs;
904 904
905 send_req->req_len = bfa_os_htonl(reqi->req_tot_len); 905 send_req->req_len = cpu_to_be32(reqi->req_tot_len);
906 send_req->rsp_maxlen = bfa_os_htonl(rspi->rsp_maxlen); 906 send_req->rsp_maxlen = cpu_to_be32(rspi->rsp_maxlen);
907 907
908 /* 908 /*
909 * setup req sgles 909 * setup req sgles
@@ -1549,7 +1549,7 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp)
1549 lps->fport = rsp->f_port; 1549 lps->fport = rsp->f_port;
1550 lps->npiv_en = rsp->npiv_en; 1550 lps->npiv_en = rsp->npiv_en;
1551 lps->lp_pid = rsp->lp_pid; 1551 lps->lp_pid = rsp->lp_pid;
1552 lps->pr_bbcred = bfa_os_ntohs(rsp->bb_credit); 1552 lps->pr_bbcred = be16_to_cpu(rsp->bb_credit);
1553 lps->pr_pwwn = rsp->port_name; 1553 lps->pr_pwwn = rsp->port_name;
1554 lps->pr_nwwn = rsp->node_name; 1554 lps->pr_nwwn = rsp->node_name;
1555 lps->auth_req = rsp->auth_req; 1555 lps->auth_req = rsp->auth_req;
@@ -1647,7 +1647,7 @@ bfa_lps_send_login(struct bfa_lps_s *lps)
1647 1647
1648 m->lp_tag = lps->lp_tag; 1648 m->lp_tag = lps->lp_tag;
1649 m->alpa = lps->alpa; 1649 m->alpa = lps->alpa;
1650 m->pdu_size = bfa_os_htons(lps->pdusz); 1650 m->pdu_size = cpu_to_be16(lps->pdusz);
1651 m->pwwn = lps->pwwn; 1651 m->pwwn = lps->pwwn;
1652 m->nwwn = lps->nwwn; 1652 m->nwwn = lps->nwwn;
1653 m->fdisc = lps->fdisc; 1653 m->fdisc = lps->fdisc;
@@ -2995,7 +2995,7 @@ bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport)
2995 trunk->attr.state = BFA_TRUNK_DISABLED; 2995 trunk->attr.state = BFA_TRUNK_DISABLED;
2996 2996
2997 /* update FCoE specific */ 2997 /* update FCoE specific */
2998 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);
2999 2999
3000 bfa_trc(fcport->bfa, fcport->speed); 3000 bfa_trc(fcport->bfa, fcport->speed);
3001 bfa_trc(fcport->bfa, fcport->topology); 3001 bfa_trc(fcport->bfa, fcport->topology);
@@ -3038,7 +3038,7 @@ bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
3038 m->pwwn = fcport->pwwn; 3038 m->pwwn = fcport->pwwn;
3039 m->port_cfg = fcport->cfg; 3039 m->port_cfg = fcport->cfg;
3040 m->msgtag = fcport->msgtag; 3040 m->msgtag = fcport->msgtag;
3041 m->port_cfg.maxfrsize = bfa_os_htons(fcport->cfg.maxfrsize); 3041 m->port_cfg.maxfrsize = cpu_to_be16(fcport->cfg.maxfrsize);
3042 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);
3043 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo); 3043 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo);
3044 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi); 3044 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi);
@@ -3114,7 +3114,7 @@ bfa_fcport_send_txcredit(void *port_cbarg)
3114 3114
3115 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,
3116 bfa_lpuid(fcport->bfa)); 3116 bfa_lpuid(fcport->bfa));
3117 m->tx_bbcredit = bfa_os_htons((u16)fcport->cfg.tx_bbcredit); 3117 m->tx_bbcredit = cpu_to_be16((u16)fcport->cfg.tx_bbcredit);
3118 3118
3119 /** 3119 /**
3120 * queue I/O message to firmware 3120 * queue I/O message to firmware
@@ -3132,7 +3132,7 @@ bfa_fcport_qos_stats_swap(struct bfa_qos_stats_s *d,
3132 3132
3133 /* Now swap the 32 bit fields */ 3133 /* Now swap the 32 bit fields */
3134 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)
3135 dip[i] = bfa_os_ntohl(sip[i]); 3135 dip[i] = be32_to_cpu(sip[i]);
3136} 3136}
3137 3137
3138static void 3138static void
@@ -3146,11 +3146,11 @@ bfa_fcport_fcoe_stats_swap(struct bfa_fcoe_stats_s *d,
3146 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));
3147 i = i + 2) { 3147 i = i + 2) {
3148#ifdef __BIGENDIAN 3148#ifdef __BIGENDIAN
3149 dip[i] = bfa_os_ntohl(sip[i]); 3149 dip[i] = be32_to_cpu(sip[i]);
3150 dip[i + 1] = bfa_os_ntohl(sip[i + 1]); 3150 dip[i + 1] = be32_to_cpu(sip[i + 1]);
3151#else 3151#else
3152 dip[i] = bfa_os_ntohl(sip[i + 1]); 3152 dip[i] = be32_to_cpu(sip[i + 1]);
3153 dip[i + 1] = bfa_os_ntohl(sip[i]); 3153 dip[i + 1] = be32_to_cpu(sip[i]);
3154#endif 3154#endif
3155 } 3155 }
3156} 3156}
@@ -3325,7 +3325,7 @@ bfa_trunk_scn(struct bfa_fcport_s *fcport, struct bfi_fcport_trunk_scn_s *scn)
3325 lattr->trunk_wwn = tlink->trunk_wwn; 3325 lattr->trunk_wwn = tlink->trunk_wwn;
3326 lattr->fctl = tlink->fctl; 3326 lattr->fctl = tlink->fctl;
3327 lattr->speed = tlink->speed; 3327 lattr->speed = tlink->speed;
3328 lattr->deskew = bfa_os_ntohl(tlink->deskew); 3328 lattr->deskew = be32_to_cpu(tlink->deskew);
3329 3329
3330 if (tlink->state == BFA_TRUNK_LINK_STATE_UP) { 3330 if (tlink->state == BFA_TRUNK_LINK_STATE_UP) {
3331 fcport->speed = tlink->speed; 3331 fcport->speed = tlink->speed;
@@ -3874,7 +3874,7 @@ bfa_fcport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr)
3874 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 3874 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3875 3875
3876 qos_attr->state = fcport->qos_attr.state; 3876 qos_attr->state = fcport->qos_attr.state;
3877 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);
3878} 3878}
3879 3879
3880void 3880void
@@ -3885,10 +3885,10 @@ bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa,
3885 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;
3886 u32 i = 0; 3886 u32 i = 0;
3887 3887
3888 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);
3889 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);
3890 qos_vc_attr->elp_opmode_flags = 3890 qos_vc_attr->elp_opmode_flags =
3891 bfa_os_ntohl(bfa_vc_attr->elp_opmode_flags); 3891 be32_to_cpu(bfa_vc_attr->elp_opmode_flags);
3892 3892
3893 /* Individual VC info */ 3893 /* Individual VC info */
3894 while (i < qos_vc_attr->total_vc_count) { 3894 while (i < qos_vc_attr->total_vc_count) {
@@ -4273,9 +4273,9 @@ bfa_rport_sm_online(struct bfa_rport_s *rp, enum bfa_rport_event event)
4273 bfa_trc(rp->bfa, qos_scn->new_qos_attr.qos_priority); 4273 bfa_trc(rp->bfa, qos_scn->new_qos_attr.qos_priority);
4274 4274
4275 qos_scn->old_qos_attr.qos_flow_id = 4275 qos_scn->old_qos_attr.qos_flow_id =
4276 bfa_os_ntohl(qos_scn->old_qos_attr.qos_flow_id); 4276 be32_to_cpu(qos_scn->old_qos_attr.qos_flow_id);
4277 qos_scn->new_qos_attr.qos_flow_id = 4277 qos_scn->new_qos_attr.qos_flow_id =
4278 bfa_os_ntohl(qos_scn->new_qos_attr.qos_flow_id); 4278 be32_to_cpu(qos_scn->new_qos_attr.qos_flow_id);
4279 4279
4280 if (qos_scn->old_qos_attr.qos_flow_id != 4280 if (qos_scn->old_qos_attr.qos_flow_id !=
4281 qos_scn->new_qos_attr.qos_flow_id) 4281 qos_scn->new_qos_attr.qos_flow_id)
@@ -4697,7 +4697,7 @@ bfa_rport_send_fwcreate(struct bfa_rport_s *rp)
4697 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,
4698 bfa_lpuid(rp->bfa)); 4698 bfa_lpuid(rp->bfa));
4699 m->bfa_handle = rp->rport_tag; 4699 m->bfa_handle = rp->rport_tag;
4700 m->max_frmsz = bfa_os_htons(rp->rport_info.max_frmsz); 4700 m->max_frmsz = cpu_to_be16(rp->rport_info.max_frmsz);
4701 m->pid = rp->rport_info.pid; 4701 m->pid = rp->rport_info.pid;
4702 m->lp_tag = rp->rport_info.lp_tag; 4702 m->lp_tag = rp->rport_info.lp_tag;
4703 m->local_pid = rp->rport_info.local_pid; 4703 m->local_pid = rp->rport_info.local_pid;
@@ -4888,7 +4888,7 @@ bfa_rport_get_qos_attr(struct bfa_rport_s *rport,
4888 struct bfa_rport_qos_attr_s *qos_attr) 4888 struct bfa_rport_qos_attr_s *qos_attr)
4889{ 4889{
4890 qos_attr->qos_priority = rport->qos_attr.qos_priority; 4890 qos_attr->qos_priority = rport->qos_attr.qos_priority;
4891 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);
4892 4892
4893} 4893}
4894 4894
@@ -5155,7 +5155,7 @@ claim_uf_post_msgs(struct bfa_uf_mod_s *ufm, struct bfa_meminfo_s *mi)
5155 5155
5156 uf_bp_msg->buf_tag = i; 5156 uf_bp_msg->buf_tag = i;
5157 buf_len = sizeof(struct bfa_uf_buf_s); 5157 buf_len = sizeof(struct bfa_uf_buf_s);
5158 uf_bp_msg->buf_len = bfa_os_htons(buf_len); 5158 uf_bp_msg->buf_len = cpu_to_be16(buf_len);
5159 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,
5160 bfa_lpuid(ufm->bfa)); 5160 bfa_lpuid(ufm->bfa));
5161 5161
@@ -5308,8 +5308,8 @@ uf_recv(struct bfa_s *bfa, struct bfi_uf_frm_rcvd_s *m)
5308 u8 *buf = &uf_buf->d[0]; 5308 u8 *buf = &uf_buf->d[0];
5309 struct fchs_s *fchs; 5309 struct fchs_s *fchs;
5310 5310
5311 m->frm_len = bfa_os_ntohs(m->frm_len); 5311 m->frm_len = be16_to_cpu(m->frm_len);
5312 m->xfr_len = bfa_os_ntohs(m->xfr_len); 5312 m->xfr_len = be16_to_cpu(m->xfr_len);
5313 5313
5314 fchs = (struct fchs_s *)uf_buf; 5314 fchs = (struct fchs_s *)uf_buf;
5315 5315
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index d8843720eac1..27dd06ff6a3d 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -70,7 +70,7 @@ bfad_im_get_starget_node_name(struct scsi_target *starget)
70 if (itnim) 70 if (itnim)
71 node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim); 71 node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim);
72 72
73 fc_starget_node_name(starget) = bfa_os_htonll(node_name); 73 fc_starget_node_name(starget) = cpu_to_be64(node_name);
74 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 74 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
75} 75}
76 76
@@ -96,7 +96,7 @@ bfad_im_get_starget_port_name(struct scsi_target *starget)
96 if (itnim) 96 if (itnim)
97 port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim); 97 port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim);
98 98
99 fc_starget_port_name(starget) = bfa_os_htonll(port_name); 99 fc_starget_port_name(starget) = cpu_to_be64(port_name);
100 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 100 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
101} 101}
102 102
@@ -249,7 +249,7 @@ bfad_im_get_host_fabric_name(struct Scsi_Host *shost)
249 249
250 fabric_nwwn = bfa_fcs_lport_get_fabric_name(port->fcs_port); 250 fabric_nwwn = bfa_fcs_lport_get_fabric_name(port->fcs_port);
251 251
252 fc_host_fabric_name(shost) = bfa_os_htonll(fabric_nwwn); 252 fc_host_fabric_name(shost) = cpu_to_be64(fabric_nwwn);
253 253
254} 254}
255 255
@@ -733,7 +733,7 @@ bfad_im_node_name_show(struct device *dev, struct device_attribute *attr,
733 u64 nwwn; 733 u64 nwwn;
734 734
735 nwwn = bfa_fcs_lport_get_nwwn(port->fcs_port); 735 nwwn = bfa_fcs_lport_get_nwwn(port->fcs_port);
736 return snprintf(buf, PAGE_SIZE, "0x%llx\n", bfa_os_htonll(nwwn)); 736 return snprintf(buf, PAGE_SIZE, "0x%llx\n", cpu_to_be64(nwwn));
737} 737}
738 738
739static ssize_t 739static ssize_t
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index d950ee44016e..236922bc9e40 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -949,9 +949,9 @@ bfad_os_fc_host_init(struct bfad_im_port_s *im_port)
949 char symname[BFA_SYMNAME_MAXLEN]; 949 char symname[BFA_SYMNAME_MAXLEN];
950 950
951 fc_host_node_name(host) = 951 fc_host_node_name(host) =
952 bfa_os_htonll((bfa_fcs_lport_get_nwwn(port->fcs_port))); 952 cpu_to_be64((bfa_fcs_lport_get_nwwn(port->fcs_port)));
953 fc_host_port_name(host) = 953 fc_host_port_name(host) =
954 bfa_os_htonll((bfa_fcs_lport_get_pwwn(port->fcs_port))); 954 cpu_to_be64((bfa_fcs_lport_get_pwwn(port->fcs_port)));
955 fc_host_max_npiv_vports(host) = bfa_lps_get_max_vport(&bfad->bfa); 955 fc_host_max_npiv_vports(host) = bfa_lps_get_max_vport(&bfad->bfa);
956 956
957 fc_host_supported_classes(host) = FC_COS_CLASS3; 957 fc_host_supported_classes(host) = FC_COS_CLASS3;
@@ -983,9 +983,9 @@ bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, struct bfad_itnim_s *itnim)
983 struct bfad_itnim_data_s *itnim_data; 983 struct bfad_itnim_data_s *itnim_data;
984 984
985 rport_ids.node_name = 985 rport_ids.node_name =
986 bfa_os_htonll(bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim)); 986 cpu_to_be64(bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim));
987 rport_ids.port_name = 987 rport_ids.port_name =
988 bfa_os_htonll(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim)); 988 cpu_to_be64(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim));
989 rport_ids.port_id = 989 rport_ids.port_id =
990 bfa_os_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim)); 990 bfa_os_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim));
991 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; 991 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;