aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfa_fcbuild.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcbuild.c')
-rw-r--r--drivers/scsi/bfa/bfa_fcbuild.c196
1 files changed, 98 insertions, 98 deletions
diff --git a/drivers/scsi/bfa/bfa_fcbuild.c b/drivers/scsi/bfa/bfa_fcbuild.c
index b7d2657ca82a..9c725314b513 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;
@@ -137,7 +137,7 @@ fcbuild_init(void)
137static void 137static void
138fc_gs_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u32 ox_id) 138fc_gs_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u32 ox_id)
139{ 139{
140 bfa_os_memset(fchs, 0, sizeof(struct fchs_s)); 140 memset(fchs, 0, sizeof(struct fchs_s));
141 141
142 fchs->routing = FC_RTG_FC4_DEV_DATA; 142 fchs->routing = FC_RTG_FC4_DEV_DATA;
143 fchs->cat_info = FC_CAT_UNSOLICIT_CTRL; 143 fchs->cat_info = FC_CAT_UNSOLICIT_CTRL;
@@ -148,9 +148,9 @@ 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
155 * no need to set rx_id for response 155 * no need to set rx_id for response
156 */ 156 */
@@ -159,16 +159,16 @@ fc_gs_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u32 ox_id)
159void 159void
160fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id) 160fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id)
161{ 161{
162 bfa_os_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
169fc_els_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id) 169fc_els_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id)
170{ 170{
171 bfa_os_memcpy(fchs, &fc_els_rsp_tmpl, sizeof(struct fchs_s)); 171 memcpy(fchs, &fc_els_rsp_tmpl, sizeof(struct fchs_s));
172 fchs->d_id = d_id; 172 fchs->d_id = d_id;
173 fchs->s_id = s_id; 173 fchs->s_id = s_id;
174 fchs->ox_id = ox_id; 174 fchs->ox_id = ox_id;
@@ -198,7 +198,7 @@ fc_els_rsp_parse(struct fchs_s *fchs, int len)
198static void 198static void
199fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id) 199fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id)
200{ 200{
201 bfa_os_memcpy(fchs, &fc_bls_rsp_tmpl, sizeof(struct fchs_s)); 201 memcpy(fchs, &fc_bls_rsp_tmpl, sizeof(struct fchs_s));
202 fchs->d_id = d_id; 202 fchs->d_id = d_id;
203 fchs->s_id = s_id; 203 fchs->s_id = s_id;
204 fchs->ox_id = ox_id; 204 fchs->ox_id = ox_id;
@@ -211,7 +211,7 @@ fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
211{ 211{
212 struct fc_logi_s *plogi = (struct fc_logi_s *) (pld); 212 struct fc_logi_s *plogi = (struct fc_logi_s *) (pld);
213 213
214 bfa_os_memcpy(plogi, &plogi_tmpl, sizeof(struct fc_logi_s)); 214 memcpy(plogi, &plogi_tmpl, sizeof(struct fc_logi_s));
215 215
216 plogi->els_cmd.els_code = els_code; 216 plogi->els_cmd.els_code = els_code;
217 if (els_code == FC_ELS_PLOGI) 217 if (els_code == FC_ELS_PLOGI)
@@ -219,10 +219,10 @@ 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 bfa_os_memcpy(&plogi->port_name, &port_name, sizeof(wwn_t)); 224 memcpy(&plogi->port_name, &port_name, sizeof(wwn_t));
225 bfa_os_memcpy(&plogi->node_name, &node_name, sizeof(wwn_t)); 225 memcpy(&plogi->node_name, &node_name, sizeof(wwn_t));
226 226
227 return sizeof(struct fc_logi_s); 227 return sizeof(struct fc_logi_s);
228} 228}
@@ -235,12 +235,12 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
235 u32 d_id = bfa_os_hton3b(FC_FABRIC_PORT); 235 u32 d_id = bfa_os_hton3b(FC_FABRIC_PORT);
236 u32 *vvl_info; 236 u32 *vvl_info;
237 237
238 bfa_os_memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); 238 memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s));
239 239
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}
@@ -272,15 +272,15 @@ fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
272{ 272{
273 u32 d_id = 0; 273 u32 d_id = 0;
274 274
275 bfa_os_memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); 275 memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s));
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}
@@ -291,12 +291,12 @@ fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
291{ 291{
292 u32 d_id = bfa_os_hton3b(FC_FABRIC_PORT); 292 u32 d_id = bfa_os_hton3b(FC_FABRIC_PORT);
293 293
294 bfa_os_memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); 294 memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s));
295 295
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
@@ -378,7 +378,7 @@ fc_prli_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
378 struct fc_prli_s *prli = (struct fc_prli_s *) (pld); 378 struct fc_prli_s *prli = (struct fc_prli_s *) (pld);
379 379
380 fc_els_req_build(fchs, d_id, s_id, ox_id); 380 fc_els_req_build(fchs, d_id, s_id, ox_id);
381 bfa_os_memcpy(prli, &prli_tmpl, sizeof(struct fc_prli_s)); 381 memcpy(prli, &prli_tmpl, sizeof(struct fc_prli_s));
382 382
383 prli->command = FC_ELS_PRLI; 383 prli->command = FC_ELS_PRLI;
384 prli->parampage.servparams.initiator = 1; 384 prli->parampage.servparams.initiator = 1;
@@ -397,7 +397,7 @@ fc_prli_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
397 struct fc_prli_s *prli = (struct fc_prli_s *) (pld); 397 struct fc_prli_s *prli = (struct fc_prli_s *) (pld);
398 398
399 fc_els_rsp_build(fchs, d_id, s_id, ox_id); 399 fc_els_rsp_build(fchs, d_id, s_id, ox_id);
400 bfa_os_memcpy(prli, &prli_tmpl, sizeof(struct fc_prli_s)); 400 memcpy(prli, &prli_tmpl, sizeof(struct fc_prli_s));
401 401
402 prli->command = FC_ELS_ACC; 402 prli->command = FC_ELS_ACC;
403 403
@@ -448,7 +448,7 @@ fc_logo_build(struct fchs_s *fchs, struct fc_logo_s *logo, u32 d_id, u32 s_id,
448{ 448{
449 fc_els_req_build(fchs, d_id, s_id, ox_id); 449 fc_els_req_build(fchs, d_id, s_id, ox_id);
450 450
451 bfa_os_memset(logo, '\0', sizeof(struct fc_logo_s)); 451 memset(logo, '\0', sizeof(struct fc_logo_s));
452 logo->els_cmd.els_code = FC_ELS_LOGO; 452 logo->els_cmd.els_code = FC_ELS_LOGO;
453 logo->nport_id = (s_id); 453 logo->nport_id = (s_id);
454 logo->orig_port_name = port_name; 454 logo->orig_port_name = port_name;
@@ -461,7 +461,7 @@ fc_adisc_x_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id,
461 u32 s_id, u16 ox_id, wwn_t port_name, 461 u32 s_id, u16 ox_id, wwn_t port_name,
462 wwn_t node_name, u8 els_code) 462 wwn_t node_name, u8 els_code)
463{ 463{
464 bfa_os_memset(adisc, '\0', sizeof(struct fc_adisc_s)); 464 memset(adisc, '\0', sizeof(struct fc_adisc_s));
465 465
466 adisc->els_cmd.els_code = els_code; 466 adisc->els_cmd.els_code = els_code;
467 467
@@ -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;
@@ -554,11 +554,11 @@ fc_pdisc_parse(struct fchs_s *fchs, wwn_t node_name, wwn_t port_name)
554u16 554u16
555fc_abts_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id) 555fc_abts_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id)
556{ 556{
557 bfa_os_memcpy(fchs, &fc_bls_req_tmpl, sizeof(struct fchs_s)); 557 memcpy(fchs, &fc_bls_req_tmpl, sizeof(struct fchs_s));
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}
@@ -582,9 +582,9 @@ fc_rrq_build(struct fchs_s *fchs, struct fc_rrq_s *rrq, u32 d_id, u32 s_id,
582 /* 582 /*
583 * build rrq payload 583 * build rrq payload
584 */ 584 */
585 bfa_os_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);
@@ -598,7 +598,7 @@ fc_logo_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
598 598
599 fc_els_rsp_build(fchs, d_id, s_id, ox_id); 599 fc_els_rsp_build(fchs, d_id, s_id, ox_id);
600 600
601 bfa_os_memset(acc, 0, sizeof(struct fc_els_cmd_s)); 601 memset(acc, 0, sizeof(struct fc_els_cmd_s));
602 acc->els_code = FC_ELS_ACC; 602 acc->els_code = FC_ELS_ACC;
603 603
604 return sizeof(struct fc_els_cmd_s); 604 return sizeof(struct fc_els_cmd_s);
@@ -610,7 +610,7 @@ fc_ls_rjt_build(struct fchs_s *fchs, struct fc_ls_rjt_s *ls_rjt, u32 d_id,
610 u8 reason_code_expl) 610 u8 reason_code_expl)
611{ 611{
612 fc_els_rsp_build(fchs, d_id, s_id, ox_id); 612 fc_els_rsp_build(fchs, d_id, s_id, ox_id);
613 bfa_os_memset(ls_rjt, 0, sizeof(struct fc_ls_rjt_s)); 613 memset(ls_rjt, 0, sizeof(struct fc_ls_rjt_s));
614 614
615 ls_rjt->els_cmd.els_code = FC_ELS_LS_RJT; 615 ls_rjt->els_cmd.els_code = FC_ELS_LS_RJT;
616 ls_rjt->reason_code = reason_code; 616 ls_rjt->reason_code = reason_code;
@@ -626,7 +626,7 @@ fc_ba_acc_build(struct fchs_s *fchs, struct fc_ba_acc_s *ba_acc, u32 d_id,
626{ 626{
627 fc_bls_rsp_build(fchs, d_id, s_id, ox_id); 627 fc_bls_rsp_build(fchs, d_id, s_id, ox_id);
628 628
629 bfa_os_memcpy(ba_acc, &ba_acc_tmpl, sizeof(struct fc_ba_acc_s)); 629 memcpy(ba_acc, &ba_acc_tmpl, sizeof(struct fc_ba_acc_s));
630 630
631 fchs->rx_id = rx_id; 631 fchs->rx_id = rx_id;
632 632
@@ -641,7 +641,7 @@ fc_ls_acc_build(struct fchs_s *fchs, struct fc_els_cmd_s *els_cmd, u32 d_id,
641 u32 s_id, u16 ox_id) 641 u32 s_id, u16 ox_id)
642{ 642{
643 fc_els_rsp_build(fchs, d_id, s_id, ox_id); 643 fc_els_rsp_build(fchs, d_id, s_id, ox_id);
644 bfa_os_memset(els_cmd, 0, sizeof(struct fc_els_cmd_s)); 644 memset(els_cmd, 0, sizeof(struct fc_els_cmd_s));
645 els_cmd->els_code = FC_ELS_ACC; 645 els_cmd->els_code = FC_ELS_ACC;
646 646
647 return sizeof(struct fc_els_cmd_s); 647 return sizeof(struct fc_els_cmd_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}
@@ -672,11 +672,11 @@ fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc,
672 672
673 fc_els_rsp_build(fchs, d_id, s_id, ox_id); 673 fc_els_rsp_build(fchs, d_id, s_id, ox_id);
674 674
675 bfa_os_memset(tprlo_acc, 0, (num_pages * 16) + 4); 675 memset(tprlo_acc, 0, (num_pages * 16) + 4);
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
@@ -696,10 +696,10 @@ fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, u32 d_id,
696 696
697 fc_els_rsp_build(fchs, d_id, s_id, ox_id); 697 fc_els_rsp_build(fchs, d_id, s_id, ox_id);
698 698
699 bfa_os_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
@@ -718,7 +718,7 @@ fc_rnid_build(struct fchs_s *fchs, struct fc_rnid_cmd_s *rnid, u32 d_id,
718{ 718{
719 fc_els_req_build(fchs, d_id, s_id, ox_id); 719 fc_els_req_build(fchs, d_id, s_id, ox_id);
720 720
721 bfa_os_memset(rnid, 0, sizeof(struct fc_rnid_cmd_s)); 721 memset(rnid, 0, sizeof(struct fc_rnid_cmd_s));
722 722
723 rnid->els_cmd.els_code = FC_ELS_RNID; 723 rnid->els_cmd.els_code = FC_ELS_RNID;
724 rnid->node_id_data_format = data_format; 724 rnid->node_id_data_format = data_format;
@@ -732,7 +732,7 @@ fc_rnid_acc_build(struct fchs_s *fchs, struct fc_rnid_acc_s *rnid_acc, u32 d_id,
732 struct fc_rnid_common_id_data_s *common_id_data, 732 struct fc_rnid_common_id_data_s *common_id_data,
733 struct fc_rnid_general_topology_data_s *gen_topo_data) 733 struct fc_rnid_general_topology_data_s *gen_topo_data)
734{ 734{
735 bfa_os_memset(rnid_acc, 0, sizeof(struct fc_rnid_acc_s)); 735 memset(rnid_acc, 0, sizeof(struct fc_rnid_acc_s));
736 736
737 fc_els_rsp_build(fchs, d_id, s_id, ox_id); 737 fc_els_rsp_build(fchs, d_id, s_id, ox_id);
738 738
@@ -745,7 +745,7 @@ fc_rnid_acc_build(struct fchs_s *fchs, struct fc_rnid_acc_s *rnid_acc, u32 d_id,
745 if (data_format == RNID_NODEID_DATA_FORMAT_DISCOVERY) { 745 if (data_format == RNID_NODEID_DATA_FORMAT_DISCOVERY) {
746 rnid_acc->specific_id_data_length = 746 rnid_acc->specific_id_data_length =
747 sizeof(struct fc_rnid_general_topology_data_s); 747 sizeof(struct fc_rnid_general_topology_data_s);
748 bfa_os_assign(rnid_acc->gen_topology_data, *gen_topo_data); 748 rnid_acc->gen_topology_data = *gen_topo_data;
749 return sizeof(struct fc_rnid_acc_s); 749 return sizeof(struct fc_rnid_acc_s);
750 } else { 750 } else {
751 return sizeof(struct fc_rnid_acc_s) - 751 return sizeof(struct fc_rnid_acc_s) -
@@ -760,7 +760,7 @@ fc_rpsc_build(struct fchs_s *fchs, struct fc_rpsc_cmd_s *rpsc, u32 d_id,
760{ 760{
761 fc_els_req_build(fchs, d_id, s_id, ox_id); 761 fc_els_req_build(fchs, d_id, s_id, ox_id);
762 762
763 bfa_os_memset(rpsc, 0, sizeof(struct fc_rpsc_cmd_s)); 763 memset(rpsc, 0, sizeof(struct fc_rpsc_cmd_s));
764 764
765 rpsc->els_cmd.els_code = FC_ELS_RPSC; 765 rpsc->els_cmd.els_code = FC_ELS_RPSC;
766 return sizeof(struct fc_rpsc_cmd_s); 766 return sizeof(struct fc_rpsc_cmd_s);
@@ -775,11 +775,11 @@ fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2, u32 d_id,
775 775
776 fc_els_req_build(fchs, bfa_os_hton3b(dctlr_id), s_id, 0); 776 fc_els_req_build(fchs, bfa_os_hton3b(dctlr_id), s_id, 0);
777 777
778 bfa_os_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
@@ -791,18 +791,18 @@ fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc,
791 u32 d_id, u32 s_id, u16 ox_id, 791 u32 d_id, u32 s_id, u16 ox_id,
792 struct fc_rpsc_speed_info_s *oper_speed) 792 struct fc_rpsc_speed_info_s *oper_speed)
793{ 793{
794 bfa_os_memset(rpsc_acc, 0, sizeof(struct fc_rpsc_acc_s)); 794 memset(rpsc_acc, 0, sizeof(struct fc_rpsc_acc_s));
795 795
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}
@@ -830,12 +830,12 @@ fc_pdisc_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
830{ 830{
831 struct fc_logi_s *pdisc = (struct fc_logi_s *) (fchs + 1); 831 struct fc_logi_s *pdisc = (struct fc_logi_s *) (fchs + 1);
832 832
833 bfa_os_memcpy(pdisc, &plogi_tmpl, sizeof(struct fc_logi_s)); 833 memcpy(pdisc, &plogi_tmpl, sizeof(struct fc_logi_s));
834 834
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;
@@ -873,10 +873,10 @@ fc_prlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
873 int page; 873 int page;
874 874
875 fc_els_req_build(fchs, d_id, s_id, ox_id); 875 fc_els_req_build(fchs, d_id, s_id, ox_id);
876 bfa_os_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)
@@ -931,10 +931,10 @@ fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
931 int page; 931 int page;
932 932
933 fc_els_req_build(fchs, d_id, s_id, ox_id); 933 fc_els_req_build(fchs, d_id, s_id, ox_id);
934 bfa_os_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)
@@ -1011,32 +1011,32 @@ fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id,
1011static void 1011static void
1012fc_gs_cthdr_build(struct ct_hdr_s *cthdr, u32 s_id, u16 cmd_code) 1012fc_gs_cthdr_build(struct ct_hdr_s *cthdr, u32 s_id, u16 cmd_code)
1013{ 1013{
1014 bfa_os_memset(cthdr, 0, sizeof(struct ct_hdr_s)); 1014 memset(cthdr, 0, sizeof(struct ct_hdr_s));
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
1022fc_gs_fdmi_cthdr_build(struct ct_hdr_s *cthdr, u32 s_id, u16 cmd_code) 1022fc_gs_fdmi_cthdr_build(struct ct_hdr_s *cthdr, u32 s_id, u16 cmd_code)
1023{ 1023{
1024 bfa_os_memset(cthdr, 0, sizeof(struct ct_hdr_s)); 1024 memset(cthdr, 0, sizeof(struct ct_hdr_s));
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
1032fc_gs_ms_cthdr_build(struct ct_hdr_s *cthdr, u32 s_id, u16 cmd_code, 1032fc_gs_ms_cthdr_build(struct ct_hdr_s *cthdr, u32 s_id, u16 cmd_code,
1033 u8 sub_type) 1033 u8 sub_type)
1034{ 1034{
1035 bfa_os_memset(cthdr, 0, sizeof(struct ct_hdr_s)); 1035 memset(cthdr, 0, sizeof(struct ct_hdr_s));
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
@@ -1050,7 +1050,7 @@ fc_gidpn_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1050 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1050 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1051 fc_gs_cthdr_build(cthdr, s_id, GS_GID_PN); 1051 fc_gs_cthdr_build(cthdr, s_id, GS_GID_PN);
1052 1052
1053 bfa_os_memset(gidpn, 0, sizeof(struct fcgs_gidpn_req_s)); 1053 memset(gidpn, 0, sizeof(struct fcgs_gidpn_req_s));
1054 gidpn->port_name = port_name; 1054 gidpn->port_name = port_name;
1055 return sizeof(struct fcgs_gidpn_req_s) + sizeof(struct ct_hdr_s); 1055 return sizeof(struct fcgs_gidpn_req_s) + sizeof(struct ct_hdr_s);
1056} 1056}
@@ -1066,7 +1066,7 @@ fc_gpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1066 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1066 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1067 fc_gs_cthdr_build(cthdr, s_id, GS_GPN_ID); 1067 fc_gs_cthdr_build(cthdr, s_id, GS_GPN_ID);
1068 1068
1069 bfa_os_memset(gpnid, 0, sizeof(fcgs_gpnid_req_t)); 1069 memset(gpnid, 0, sizeof(fcgs_gpnid_req_t));
1070 gpnid->dap = port_id; 1070 gpnid->dap = port_id;
1071 return sizeof(fcgs_gpnid_req_t) + sizeof(struct ct_hdr_s); 1071 return sizeof(fcgs_gpnid_req_t) + sizeof(struct ct_hdr_s);
1072} 1072}
@@ -1082,7 +1082,7 @@ fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1082 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1082 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1083 fc_gs_cthdr_build(cthdr, s_id, GS_GNN_ID); 1083 fc_gs_cthdr_build(cthdr, s_id, GS_GNN_ID);
1084 1084
1085 bfa_os_memset(gnnid, 0, sizeof(fcgs_gnnid_req_t)); 1085 memset(gnnid, 0, sizeof(fcgs_gnnid_req_t));
1086 gnnid->dap = port_id; 1086 gnnid->dap = port_id;
1087 return sizeof(fcgs_gnnid_req_t) + sizeof(struct ct_hdr_s); 1087 return sizeof(fcgs_gnnid_req_t) + sizeof(struct ct_hdr_s);
1088} 1088}
@@ -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
@@ -1108,7 +1108,7 @@ fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr,
1108 1108
1109 fc_els_req_build(fchs, d_id, s_id, ox_id); 1109 fc_els_req_build(fchs, d_id, s_id, ox_id);
1110 1110
1111 bfa_os_memset(scr, 0, sizeof(struct fc_scr_s)); 1111 memset(scr, 0, sizeof(struct fc_scr_s));
1112 scr->command = FC_ELS_SCR; 1112 scr->command = FC_ELS_SCR;
1113 scr->reg_func = FC_SCR_REG_FUNC_FULL; 1113 scr->reg_func = FC_SCR_REG_FUNC_FULL;
1114 if (set_br_reg) 1114 if (set_br_reg)
@@ -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;
@@ -1149,14 +1149,14 @@ fc_rftid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1149 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1149 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1150 fc_gs_cthdr_build(cthdr, s_id, GS_RFT_ID); 1150 fc_gs_cthdr_build(cthdr, s_id, GS_RFT_ID);
1151 1151
1152 bfa_os_memset(rftid, 0, sizeof(struct fcgs_rftid_req_s)); 1152 memset(rftid, 0, sizeof(struct fcgs_rftid_req_s));
1153 1153
1154 rftid->dap = s_id; 1154 rftid->dap = s_id;
1155 1155
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}
@@ -1172,10 +1172,10 @@ fc_rftid_build_sol(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1172 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1172 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1173 fc_gs_cthdr_build(cthdr, s_id, GS_RFT_ID); 1173 fc_gs_cthdr_build(cthdr, s_id, GS_RFT_ID);
1174 1174
1175 bfa_os_memset(rftid, 0, sizeof(struct fcgs_rftid_req_s)); 1175 memset(rftid, 0, sizeof(struct fcgs_rftid_req_s));
1176 1176
1177 rftid->dap = s_id; 1177 rftid->dap = s_id;
1178 bfa_os_memcpy((void *)rftid->fc4_type, (void *)fc4_bitmap, 1178 memcpy((void *)rftid->fc4_type, (void *)fc4_bitmap,
1179 (bitmap_size < 32 ? bitmap_size : 32)); 1179 (bitmap_size < 32 ? bitmap_size : 32));
1180 1180
1181 return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s); 1181 return sizeof(struct fcgs_rftid_req_s) + sizeof(struct ct_hdr_s);
@@ -1192,7 +1192,7 @@ fc_rffid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1192 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1192 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1193 fc_gs_cthdr_build(cthdr, s_id, GS_RFF_ID); 1193 fc_gs_cthdr_build(cthdr, s_id, GS_RFF_ID);
1194 1194
1195 bfa_os_memset(rffid, 0, sizeof(struct fcgs_rffid_req_s)); 1195 memset(rffid, 0, sizeof(struct fcgs_rffid_req_s));
1196 1196
1197 rffid->dap = s_id; 1197 rffid->dap = s_id;
1198 rffid->fc4ftr_bits = fc4_ftrs; 1198 rffid->fc4ftr_bits = fc4_ftrs;
@@ -1214,7 +1214,7 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1214 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1214 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1215 fc_gs_cthdr_build(cthdr, s_id, GS_RSPN_ID); 1215 fc_gs_cthdr_build(cthdr, s_id, GS_RSPN_ID);
1216 1216
1217 bfa_os_memset(rspnid, 0, sizeof(struct fcgs_rspnid_req_s)); 1217 memset(rspnid, 0, sizeof(struct fcgs_rspnid_req_s));
1218 1218
1219 rspnid->dap = s_id; 1219 rspnid->dap = s_id;
1220 rspnid->spn_len = (u8) strlen((char *)name); 1220 rspnid->spn_len = (u8) strlen((char *)name);
@@ -1235,7 +1235,7 @@ fc_gid_ft_build(struct fchs_s *fchs, void *pyld, u32 s_id, u8 fc4_type)
1235 1235
1236 fc_gs_cthdr_build(cthdr, s_id, GS_GID_FT); 1236 fc_gs_cthdr_build(cthdr, s_id, GS_GID_FT);
1237 1237
1238 bfa_os_memset(gidft, 0, sizeof(struct fcgs_gidft_req_s)); 1238 memset(gidft, 0, sizeof(struct fcgs_gidft_req_s));
1239 gidft->fc4_type = fc4_type; 1239 gidft->fc4_type = fc4_type;
1240 gidft->domain_id = 0; 1240 gidft->domain_id = 0;
1241 gidft->area_id = 0; 1241 gidft->area_id = 0;
@@ -1254,7 +1254,7 @@ fc_rpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1254 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1254 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1255 fc_gs_cthdr_build(cthdr, s_id, GS_RPN_ID); 1255 fc_gs_cthdr_build(cthdr, s_id, GS_RPN_ID);
1256 1256
1257 bfa_os_memset(rpnid, 0, sizeof(struct fcgs_rpnid_req_s)); 1257 memset(rpnid, 0, sizeof(struct fcgs_rpnid_req_s));
1258 rpnid->port_id = port_id; 1258 rpnid->port_id = port_id;
1259 rpnid->port_name = port_name; 1259 rpnid->port_name = port_name;
1260 1260
@@ -1272,7 +1272,7 @@ fc_rnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1272 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1272 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1273 fc_gs_cthdr_build(cthdr, s_id, GS_RNN_ID); 1273 fc_gs_cthdr_build(cthdr, s_id, GS_RNN_ID);
1274 1274
1275 bfa_os_memset(rnnid, 0, sizeof(struct fcgs_rnnid_req_s)); 1275 memset(rnnid, 0, sizeof(struct fcgs_rnnid_req_s));
1276 rnnid->port_id = port_id; 1276 rnnid->port_id = port_id;
1277 rnnid->node_name = node_name; 1277 rnnid->node_name = node_name;
1278 1278
@@ -1291,7 +1291,7 @@ fc_rcsid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1291 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1291 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1292 fc_gs_cthdr_build(cthdr, s_id, GS_RCS_ID); 1292 fc_gs_cthdr_build(cthdr, s_id, GS_RCS_ID);
1293 1293
1294 bfa_os_memset(rcsid, 0, sizeof(struct fcgs_rcsid_req_s)); 1294 memset(rcsid, 0, sizeof(struct fcgs_rcsid_req_s));
1295 rcsid->port_id = port_id; 1295 rcsid->port_id = port_id;
1296 rcsid->cos = cos; 1296 rcsid->cos = cos;
1297 1297
@@ -1309,7 +1309,7 @@ fc_rptid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1309 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1309 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1310 fc_gs_cthdr_build(cthdr, s_id, GS_RPT_ID); 1310 fc_gs_cthdr_build(cthdr, s_id, GS_RPT_ID);
1311 1311
1312 bfa_os_memset(rptid, 0, sizeof(struct fcgs_rptid_req_s)); 1312 memset(rptid, 0, sizeof(struct fcgs_rptid_req_s));
1313 rptid->port_id = port_id; 1313 rptid->port_id = port_id;
1314 rptid->port_type = port_type; 1314 rptid->port_type = port_type;
1315 1315
@@ -1326,7 +1326,7 @@ fc_ganxt_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id)
1326 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1326 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1327 fc_gs_cthdr_build(cthdr, s_id, GS_GA_NXT); 1327 fc_gs_cthdr_build(cthdr, s_id, GS_GA_NXT);
1328 1328
1329 bfa_os_memset(ganxt, 0, sizeof(struct fcgs_ganxt_req_s)); 1329 memset(ganxt, 0, sizeof(struct fcgs_ganxt_req_s));
1330 ganxt->port_id = port_id; 1330 ganxt->port_id = port_id;
1331 1331
1332 return sizeof(struct ct_hdr_s) + sizeof(struct fcgs_ganxt_req_s); 1332 return sizeof(struct ct_hdr_s) + sizeof(struct fcgs_ganxt_req_s);
@@ -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
@@ -1383,7 +1383,7 @@ fc_gmal_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn)
1383 fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GMAL_CMD, 1383 fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GMAL_CMD,
1384 CT_GSSUBTYPE_CFGSERVER); 1384 CT_GSSUBTYPE_CFGSERVER);
1385 1385
1386 bfa_os_memset(gmal, 0, sizeof(fcgs_gmal_req_t)); 1386 memset(gmal, 0, sizeof(fcgs_gmal_req_t));
1387 gmal->wwn = wwn; 1387 gmal->wwn = wwn;
1388 1388
1389 return sizeof(struct ct_hdr_s) + sizeof(fcgs_gmal_req_t); 1389 return sizeof(struct ct_hdr_s) + sizeof(fcgs_gmal_req_t);
@@ -1403,7 +1403,7 @@ fc_gfn_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn)
1403 fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GFN_CMD, 1403 fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GFN_CMD,
1404 CT_GSSUBTYPE_CFGSERVER); 1404 CT_GSSUBTYPE_CFGSERVER);
1405 1405
1406 bfa_os_memset(gfn, 0, sizeof(fcgs_gfn_req_t)); 1406 memset(gfn, 0, sizeof(fcgs_gfn_req_t));
1407 gfn->wwn = wwn; 1407 gfn->wwn = wwn;
1408 1408
1409 return sizeof(struct ct_hdr_s) + sizeof(fcgs_gfn_req_t); 1409 return sizeof(struct ct_hdr_s) + sizeof(fcgs_gfn_req_t);