Commit 5036f0a0ecd31fc94360a944b352d082e1182b04
Committed by
James Bottomley
1 parent
68d91cbd52
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
[SCSI] csiostor: Fix sparse warnings.
This patch fixes sparse warnings related to endian-ness, which were reported by the 0-day kernel build and testing tool. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Naresh Kumar Inna <naresh@chelsio.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Showing 8 changed files with 110 additions and 128 deletions Side-by-side Diff
drivers/scsi/csiostor/csio_attr.c
... | ... | @@ -89,7 +89,7 @@ |
89 | 89 | spin_unlock_irq(shost->host_lock); |
90 | 90 | |
91 | 91 | sp = &rn->rn_sparm; |
92 | - rport->maxframe_size = sp->csp.sp_bb_data; | |
92 | + rport->maxframe_size = ntohs(sp->csp.sp_bb_data); | |
93 | 93 | if (ntohs(sp->clsp[2].cp_class) & FC_CPC_VALID) |
94 | 94 | rport->supported_classes = FC_COS_CLASS3; |
95 | 95 | else |
... | ... | @@ -192,7 +192,7 @@ |
192 | 192 | fc_host_supported_speeds(shost) = FC_PORTSPEED_10GBIT | |
193 | 193 | FC_PORTSPEED_1GBIT; |
194 | 194 | |
195 | - fc_host_maxframe_size(shost) = ln->ln_sparm.csp.sp_bb_data; | |
195 | + fc_host_maxframe_size(shost) = ntohs(ln->ln_sparm.csp.sp_bb_data); | |
196 | 196 | memset(fc_host_supported_fc4s(shost), 0, |
197 | 197 | sizeof(fc_host_supported_fc4s(shost))); |
198 | 198 | fc_host_supported_fc4s(shost)[7] = 1; |
199 | 199 | |
200 | 200 | |
... | ... | @@ -325,23 +325,23 @@ |
325 | 325 | memset(&fcoe_port_stats, 0, sizeof(struct fw_fcoe_port_stats)); |
326 | 326 | csio_get_phy_port_stats(hw, ln->portid, &fcoe_port_stats); |
327 | 327 | |
328 | - fhs->tx_frames += (fcoe_port_stats.tx_bcast_frames + | |
329 | - fcoe_port_stats.tx_mcast_frames + | |
330 | - fcoe_port_stats.tx_ucast_frames + | |
331 | - fcoe_port_stats.tx_offload_frames); | |
332 | - fhs->tx_words += (fcoe_port_stats.tx_bcast_bytes + | |
333 | - fcoe_port_stats.tx_mcast_bytes + | |
334 | - fcoe_port_stats.tx_ucast_bytes + | |
335 | - fcoe_port_stats.tx_offload_bytes) / | |
328 | + fhs->tx_frames += (be64_to_cpu(fcoe_port_stats.tx_bcast_frames) + | |
329 | + be64_to_cpu(fcoe_port_stats.tx_mcast_frames) + | |
330 | + be64_to_cpu(fcoe_port_stats.tx_ucast_frames) + | |
331 | + be64_to_cpu(fcoe_port_stats.tx_offload_frames)); | |
332 | + fhs->tx_words += (be64_to_cpu(fcoe_port_stats.tx_bcast_bytes) + | |
333 | + be64_to_cpu(fcoe_port_stats.tx_mcast_bytes) + | |
334 | + be64_to_cpu(fcoe_port_stats.tx_ucast_bytes) + | |
335 | + be64_to_cpu(fcoe_port_stats.tx_offload_bytes)) / | |
336 | 336 | CSIO_WORD_TO_BYTE; |
337 | - fhs->rx_frames += (fcoe_port_stats.rx_bcast_frames + | |
338 | - fcoe_port_stats.rx_mcast_frames + | |
339 | - fcoe_port_stats.rx_ucast_frames); | |
340 | - fhs->rx_words += (fcoe_port_stats.rx_bcast_bytes + | |
341 | - fcoe_port_stats.rx_mcast_bytes + | |
342 | - fcoe_port_stats.rx_ucast_bytes) / | |
337 | + fhs->rx_frames += (be64_to_cpu(fcoe_port_stats.rx_bcast_frames) + | |
338 | + be64_to_cpu(fcoe_port_stats.rx_mcast_frames) + | |
339 | + be64_to_cpu(fcoe_port_stats.rx_ucast_frames)); | |
340 | + fhs->rx_words += (be64_to_cpu(fcoe_port_stats.rx_bcast_bytes) + | |
341 | + be64_to_cpu(fcoe_port_stats.rx_mcast_bytes) + | |
342 | + be64_to_cpu(fcoe_port_stats.rx_ucast_bytes)) / | |
343 | 343 | CSIO_WORD_TO_BYTE; |
344 | - fhs->error_frames += fcoe_port_stats.rx_err_frames; | |
344 | + fhs->error_frames += be64_to_cpu(fcoe_port_stats.rx_err_frames); | |
345 | 345 | fhs->fcp_input_requests += ln->stats.n_input_requests; |
346 | 346 | fhs->fcp_output_requests += ln->stats.n_output_requests; |
347 | 347 | fhs->fcp_control_requests += ln->stats.n_control_requests; |
drivers/scsi/csiostor/csio_hw.c
... | ... | @@ -169,7 +169,7 @@ |
169 | 169 | * is assigned the 64-bit ECC word for the read data. |
170 | 170 | */ |
171 | 171 | int |
172 | -csio_hw_mc_read(struct csio_hw *hw, uint32_t addr, uint32_t *data, | |
172 | +csio_hw_mc_read(struct csio_hw *hw, uint32_t addr, __be32 *data, | |
173 | 173 | uint64_t *ecc) |
174 | 174 | { |
175 | 175 | int i; |
... | ... | @@ -209,7 +209,7 @@ |
209 | 209 | * is assigned the 64-bit ECC word for the read data. |
210 | 210 | */ |
211 | 211 | int |
212 | -csio_hw_edc_read(struct csio_hw *hw, int idx, uint32_t addr, uint32_t *data, | |
212 | +csio_hw_edc_read(struct csio_hw *hw, int idx, uint32_t addr, __be32 *data, | |
213 | 213 | uint64_t *ecc) |
214 | 214 | { |
215 | 215 | int i; |
... | ... | @@ -249,7 +249,7 @@ |
249 | 249 | * address @addr. |
250 | 250 | */ |
251 | 251 | static int |
252 | -csio_mem_win_rw(struct csio_hw *hw, u32 addr, __be32 *data, int dir) | |
252 | +csio_mem_win_rw(struct csio_hw *hw, u32 addr, u32 *data, int dir) | |
253 | 253 | { |
254 | 254 | int i; |
255 | 255 | |
... | ... | @@ -296,7 +296,7 @@ |
296 | 296 | { |
297 | 297 | uint32_t pos, start, end, offset, memoffset; |
298 | 298 | int ret; |
299 | - __be32 *data; | |
299 | + uint32_t *data; | |
300 | 300 | |
301 | 301 | /* |
302 | 302 | * Argument sanity checks ... |
... | ... | @@ -379,7 +379,7 @@ |
379 | 379 | } |
380 | 380 | |
381 | 381 | static int |
382 | -csio_memory_write(struct csio_hw *hw, int mtype, u32 addr, u32 len, __be32 *buf) | |
382 | +csio_memory_write(struct csio_hw *hw, int mtype, u32 addr, u32 len, u32 *buf) | |
383 | 383 | { |
384 | 384 | return csio_memory_rw(hw, mtype, addr, len, buf, 0); |
385 | 385 | } |
... | ... | @@ -429,6 +429,7 @@ |
429 | 429 | |
430 | 430 | pci_read_config_dword(hw->pdev, base + PCI_VPD_DATA, data); |
431 | 431 | *data = le32_to_cpu(*data); |
432 | + | |
432 | 433 | return 0; |
433 | 434 | } |
434 | 435 | |
... | ... | @@ -926,7 +927,7 @@ |
926 | 927 | int ret; |
927 | 928 | uint32_t i; |
928 | 929 | uint8_t first_page[SF_PAGE_SIZE]; |
929 | - const uint32_t *p = (const uint32_t *)fw_data; | |
930 | + const __be32 *p = (const __be32 *)fw_data; | |
930 | 931 | struct fw_hdr *hdr = (struct fw_hdr *)fw_data; |
931 | 932 | uint32_t sf_sec_size; |
932 | 933 | |
... | ... | @@ -2116,7 +2117,6 @@ |
2116 | 2117 | const struct firmware *cf; |
2117 | 2118 | struct pci_dev *pci_dev = hw->pdev; |
2118 | 2119 | struct device *dev = &pci_dev->dev; |
2119 | - | |
2120 | 2120 | unsigned int mtype = 0, maddr = 0; |
2121 | 2121 | uint32_t *cfg_data; |
2122 | 2122 | int value_to_add = 0; |
drivers/scsi/csiostor/csio_hw.h
... | ... | @@ -658,10 +658,8 @@ |
658 | 658 | struct csio_lnode *csio_lnode_alloc(struct csio_hw *); |
659 | 659 | int csio_config_queues(struct csio_hw *); |
660 | 660 | |
661 | -int csio_hw_mc_read(struct csio_hw *, uint32_t, | |
662 | - uint32_t *, uint64_t *); | |
663 | -int csio_hw_edc_read(struct csio_hw *, int, uint32_t, uint32_t *, | |
664 | - uint64_t *); | |
661 | +int csio_hw_mc_read(struct csio_hw *, uint32_t, __be32 *, uint64_t *); | |
662 | +int csio_hw_edc_read(struct csio_hw *, int, uint32_t, __be32 *, uint64_t *); | |
665 | 663 | int csio_hw_init(struct csio_hw *); |
666 | 664 | void csio_hw_exit(struct csio_hw *); |
667 | 665 | #endif /* ifndef __CSIO_HW_H__ */ |
drivers/scsi/csiostor/csio_lnode.c
... | ... | @@ -214,7 +214,7 @@ |
214 | 214 | cmd->ct_rev = FC_CT_REV; |
215 | 215 | cmd->ct_fs_type = type; |
216 | 216 | cmd->ct_fs_subtype = sub_type; |
217 | - cmd->ct_cmd = op; | |
217 | + cmd->ct_cmd = htons(op); | |
218 | 218 | } |
219 | 219 | |
220 | 220 | static int |
221 | 221 | |
... | ... | @@ -285,11 +285,13 @@ |
285 | 285 | void *cmd; |
286 | 286 | uint8_t *pld; |
287 | 287 | uint32_t len = 0; |
288 | + __be32 val; | |
289 | + __be16 mfs; | |
290 | + uint32_t numattrs = 0; | |
288 | 291 | struct csio_lnode *ln = fdmi_req->lnode; |
289 | 292 | struct fs_fdmi_attrs *attrib_blk; |
290 | 293 | struct fc_fdmi_port_name *port_name; |
291 | 294 | uint8_t buf[64]; |
292 | - uint32_t val; | |
293 | 295 | uint8_t *fc4_type; |
294 | 296 | |
295 | 297 | if (fdmi_req->wr_status != FW_SUCCESS) { |
... | ... | @@ -311,7 +313,7 @@ |
311 | 313 | |
312 | 314 | /* Prepare CT hdr for RPA cmd */ |
313 | 315 | memset(cmd, 0, FC_CT_HDR_LEN); |
314 | - csio_fill_ct_iu(cmd, FC_FST_MGMT, FC_FDMI_SUBTYPE, htons(FC_FDMI_RPA)); | |
316 | + csio_fill_ct_iu(cmd, FC_FST_MGMT, FC_FDMI_SUBTYPE, FC_FDMI_RPA); | |
315 | 317 | |
316 | 318 | /* Prepare RPA payload */ |
317 | 319 | pld = (uint8_t *)csio_ct_get_pld(cmd); |
318 | 320 | |
... | ... | @@ -331,12 +333,12 @@ |
331 | 333 | fc4_type[7] = 1; |
332 | 334 | csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_FC4TYPES, |
333 | 335 | fc4_type, FC_FDMI_PORT_ATTR_FC4TYPES_LEN); |
334 | - attrib_blk->numattrs++; | |
336 | + numattrs++; | |
335 | 337 | val = htonl(FC_PORTSPEED_1GBIT | FC_PORTSPEED_10GBIT); |
336 | 338 | csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_SUPPORTEDSPEED, |
337 | 339 | (uint8_t *)&val, |
338 | 340 | FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN); |
339 | - attrib_blk->numattrs++; | |
341 | + numattrs++; | |
340 | 342 | |
341 | 343 | if (hw->pport[ln->portid].link_speed == FW_PORT_CAP_SPEED_1G) |
342 | 344 | val = htonl(FC_PORTSPEED_1GBIT); |
343 | 345 | |
344 | 346 | |
345 | 347 | |
346 | 348 | |
347 | 349 | |
... | ... | @@ -347,24 +349,24 @@ |
347 | 349 | csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_CURRENTPORTSPEED, |
348 | 350 | (uint8_t *)&val, |
349 | 351 | FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN); |
350 | - attrib_blk->numattrs++; | |
352 | + numattrs++; | |
351 | 353 | |
352 | - val = htonl(ln->ln_sparm.csp.sp_bb_data); | |
354 | + mfs = ln->ln_sparm.csp.sp_bb_data; | |
353 | 355 | csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_MAXFRAMESIZE, |
354 | - (uint8_t *)&val, FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN); | |
355 | - attrib_blk->numattrs++; | |
356 | + (uint8_t *)&mfs, FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN); | |
357 | + numattrs++; | |
356 | 358 | |
357 | 359 | strcpy(buf, "csiostor"); |
358 | 360 | csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_OSDEVICENAME, buf, |
359 | 361 | (uint16_t)strlen(buf)); |
360 | - attrib_blk->numattrs++; | |
362 | + numattrs++; | |
361 | 363 | |
362 | 364 | if (!csio_hostname(buf, sizeof(buf))) { |
363 | 365 | csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_HOSTNAME, |
364 | 366 | buf, (uint16_t)strlen(buf)); |
365 | - attrib_blk->numattrs++; | |
367 | + numattrs++; | |
366 | 368 | } |
367 | - attrib_blk->numattrs = ntohl(attrib_blk->numattrs); | |
369 | + attrib_blk->numattrs = htonl(numattrs); | |
368 | 370 | len = (uint32_t)(pld - (uint8_t *)cmd); |
369 | 371 | |
370 | 372 | /* Submit FDMI RPA request */ |
... | ... | @@ -388,7 +390,8 @@ |
388 | 390 | void *cmd; |
389 | 391 | uint8_t *pld; |
390 | 392 | uint32_t len = 0; |
391 | - uint32_t maxpayload = htonl(65536); | |
393 | + uint32_t numattrs = 0; | |
394 | + __be32 maxpayload = htonl(65536); | |
392 | 395 | struct fc_fdmi_hba_identifier *hbaid; |
393 | 396 | struct csio_lnode *ln = fdmi_req->lnode; |
394 | 397 | struct fc_fdmi_rpl *reg_pl; |
... | ... | @@ -413,7 +416,7 @@ |
413 | 416 | |
414 | 417 | /* Prepare CT hdr for RHBA cmd */ |
415 | 418 | memset(cmd, 0, FC_CT_HDR_LEN); |
416 | - csio_fill_ct_iu(cmd, FC_FST_MGMT, FC_FDMI_SUBTYPE, htons(FC_FDMI_RHBA)); | |
419 | + csio_fill_ct_iu(cmd, FC_FST_MGMT, FC_FDMI_SUBTYPE, FC_FDMI_RHBA); | |
417 | 420 | len = FC_CT_HDR_LEN; |
418 | 421 | |
419 | 422 | /* Prepare RHBA payload */ |
... | ... | @@ -424,7 +427,7 @@ |
424 | 427 | |
425 | 428 | /* Register one port per hba */ |
426 | 429 | reg_pl = (struct fc_fdmi_rpl *)pld; |
427 | - reg_pl->numport = ntohl(1); | |
430 | + reg_pl->numport = htonl(1); | |
428 | 431 | memcpy(®_pl->port[0].portname, csio_ln_wwpn(ln), 8); |
429 | 432 | pld += sizeof(*reg_pl); |
430 | 433 | |
431 | 434 | |
432 | 435 | |
433 | 436 | |
434 | 437 | |
435 | 438 | |
436 | 439 | |
437 | 440 | |
438 | 441 | |
... | ... | @@ -436,42 +439,42 @@ |
436 | 439 | |
437 | 440 | csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_NODENAME, csio_ln_wwnn(ln), |
438 | 441 | FC_FDMI_HBA_ATTR_NODENAME_LEN); |
439 | - attrib_blk->numattrs++; | |
442 | + numattrs++; | |
440 | 443 | |
441 | 444 | memset(buf, 0, sizeof(buf)); |
442 | 445 | |
443 | 446 | strcpy(buf, "Chelsio Communications"); |
444 | 447 | csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MANUFACTURER, buf, |
445 | 448 | (uint16_t)strlen(buf)); |
446 | - attrib_blk->numattrs++; | |
449 | + numattrs++; | |
447 | 450 | csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_SERIALNUMBER, |
448 | 451 | hw->vpd.sn, (uint16_t)sizeof(hw->vpd.sn)); |
449 | - attrib_blk->numattrs++; | |
452 | + numattrs++; | |
450 | 453 | csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MODEL, hw->vpd.id, |
451 | 454 | (uint16_t)sizeof(hw->vpd.id)); |
452 | - attrib_blk->numattrs++; | |
455 | + numattrs++; | |
453 | 456 | csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MODELDESCRIPTION, |
454 | 457 | hw->model_desc, (uint16_t)strlen(hw->model_desc)); |
455 | - attrib_blk->numattrs++; | |
458 | + numattrs++; | |
456 | 459 | csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_HARDWAREVERSION, |
457 | 460 | hw->hw_ver, (uint16_t)sizeof(hw->hw_ver)); |
458 | - attrib_blk->numattrs++; | |
461 | + numattrs++; | |
459 | 462 | csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_FIRMWAREVERSION, |
460 | 463 | hw->fwrev_str, (uint16_t)strlen(hw->fwrev_str)); |
461 | - attrib_blk->numattrs++; | |
464 | + numattrs++; | |
462 | 465 | |
463 | 466 | if (!csio_osname(buf, sizeof(buf))) { |
464 | 467 | csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_OSNAMEVERSION, |
465 | 468 | buf, (uint16_t)strlen(buf)); |
466 | - attrib_blk->numattrs++; | |
469 | + numattrs++; | |
467 | 470 | } |
468 | 471 | |
469 | 472 | csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MAXCTPAYLOAD, |
470 | 473 | (uint8_t *)&maxpayload, |
471 | 474 | FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN); |
472 | 475 | len = (uint32_t)(pld - (uint8_t *)cmd); |
473 | - attrib_blk->numattrs++; | |
474 | - attrib_blk->numattrs = ntohl(attrib_blk->numattrs); | |
476 | + numattrs++; | |
477 | + attrib_blk->numattrs = htonl(numattrs); | |
475 | 478 | |
476 | 479 | /* Submit FDMI RHBA request */ |
477 | 480 | spin_lock_irq(&hw->lock); |
... | ... | @@ -518,7 +521,7 @@ |
518 | 521 | |
519 | 522 | /* Prepare FDMI DPRT cmd */ |
520 | 523 | memset(cmd, 0, FC_CT_HDR_LEN); |
521 | - csio_fill_ct_iu(cmd, FC_FST_MGMT, FC_FDMI_SUBTYPE, htons(FC_FDMI_DPRT)); | |
524 | + csio_fill_ct_iu(cmd, FC_FST_MGMT, FC_FDMI_SUBTYPE, FC_FDMI_DPRT); | |
522 | 525 | len = FC_CT_HDR_LEN; |
523 | 526 | port_name = (struct fc_fdmi_port_name *)csio_ct_get_pld(cmd); |
524 | 527 | memcpy(&port_name->portname, csio_ln_wwpn(ln), 8); |
... | ... | @@ -567,7 +570,7 @@ |
567 | 570 | /* Prepare FDMI DHBA cmd */ |
568 | 571 | cmd = fdmi_req->dma_buf.vaddr; |
569 | 572 | memset(cmd, 0, FC_CT_HDR_LEN); |
570 | - csio_fill_ct_iu(cmd, FC_FST_MGMT, FC_FDMI_SUBTYPE, htons(FC_FDMI_DHBA)); | |
573 | + csio_fill_ct_iu(cmd, FC_FST_MGMT, FC_FDMI_SUBTYPE, FC_FDMI_DHBA); | |
571 | 574 | len = FC_CT_HDR_LEN; |
572 | 575 | |
573 | 576 | hbaid = (struct fc_fdmi_hba_identifier *)csio_ct_get_pld(cmd); |
... | ... | @@ -599,6 +602,7 @@ |
599 | 602 | struct fc_els_csp *csp; |
600 | 603 | struct fc_els_cssp *clsp; |
601 | 604 | enum fw_retval retval; |
605 | + __be32 nport_id; | |
602 | 606 | |
603 | 607 | retval = FW_CMD_RETVAL_GET(ntohl(rsp->alloc_to_len16)); |
604 | 608 | if (retval != FW_SUCCESS) { |
... | ... | @@ -610,10 +614,9 @@ |
610 | 614 | spin_lock_irq(&hw->lock); |
611 | 615 | |
612 | 616 | memcpy(ln->mac, rsp->vnport_mac, sizeof(ln->mac)); |
613 | - memcpy(&ln->nport_id, &rsp->vnport_mac[3], | |
614 | - sizeof(uint8_t)*3); | |
615 | - ln->nport_id = ntohl(ln->nport_id); | |
616 | - ln->nport_id = ln->nport_id>>8; | |
617 | + memcpy(&nport_id, &rsp->vnport_mac[3], sizeof(uint8_t)*3); | |
618 | + ln->nport_id = ntohl(nport_id); | |
619 | + ln->nport_id = ln->nport_id >> 8; | |
617 | 620 | |
618 | 621 | /* Update WWNs */ |
619 | 622 | /* |
620 | 623 | |
... | ... | @@ -628,18 +631,18 @@ |
628 | 631 | csp = (struct fc_els_csp *)rsp->cmn_srv_parms; |
629 | 632 | ln->ln_sparm.csp.sp_hi_ver = csp->sp_hi_ver; |
630 | 633 | ln->ln_sparm.csp.sp_lo_ver = csp->sp_lo_ver; |
631 | - ln->ln_sparm.csp.sp_bb_cred = ntohs(csp->sp_bb_cred); | |
632 | - ln->ln_sparm.csp.sp_features = ntohs(csp->sp_features); | |
633 | - ln->ln_sparm.csp.sp_bb_data = ntohs(csp->sp_bb_data); | |
634 | - ln->ln_sparm.csp.sp_r_a_tov = ntohl(csp->sp_r_a_tov); | |
635 | - ln->ln_sparm.csp.sp_e_d_tov = ntohl(csp->sp_e_d_tov); | |
634 | + ln->ln_sparm.csp.sp_bb_cred = csp->sp_bb_cred; | |
635 | + ln->ln_sparm.csp.sp_features = csp->sp_features; | |
636 | + ln->ln_sparm.csp.sp_bb_data = csp->sp_bb_data; | |
637 | + ln->ln_sparm.csp.sp_r_a_tov = csp->sp_r_a_tov; | |
638 | + ln->ln_sparm.csp.sp_e_d_tov = csp->sp_e_d_tov; | |
636 | 639 | |
637 | 640 | /* Copy word 0 & word 1 of class sparam */ |
638 | 641 | clsp = (struct fc_els_cssp *)rsp->clsp_word_0_1; |
639 | - ln->ln_sparm.clsp[2].cp_class = ntohs(clsp->cp_class); | |
640 | - ln->ln_sparm.clsp[2].cp_init = ntohs(clsp->cp_init); | |
641 | - ln->ln_sparm.clsp[2].cp_recip = ntohs(clsp->cp_recip); | |
642 | - ln->ln_sparm.clsp[2].cp_rdfs = ntohs(clsp->cp_rdfs); | |
642 | + ln->ln_sparm.clsp[2].cp_class = clsp->cp_class; | |
643 | + ln->ln_sparm.clsp[2].cp_init = clsp->cp_init; | |
644 | + ln->ln_sparm.clsp[2].cp_recip = clsp->cp_recip; | |
645 | + ln->ln_sparm.clsp[2].cp_rdfs = clsp->cp_rdfs; | |
643 | 646 | |
644 | 647 | spin_unlock_irq(&hw->lock); |
645 | 648 | |
... | ... | @@ -1499,7 +1502,7 @@ |
1499 | 1502 | /* HW un lock here */ |
1500 | 1503 | } else { |
1501 | 1504 | csio_warn(hw, "Unexpected FCOE LINK status:0x%x\n", |
1502 | - ntohl(lcmd->lstatus)); | |
1505 | + lcmd->lstatus); | |
1503 | 1506 | CSIO_INC_STATS(hw, n_cpl_unexp); |
1504 | 1507 | } |
1505 | 1508 | } else if (cpl_op == CPL_FW6_PLD) { |
... | ... | @@ -1663,7 +1666,7 @@ |
1663 | 1666 | uint32_t did, uint32_t flow_id, uint8_t *fw_wr) |
1664 | 1667 | { |
1665 | 1668 | struct fw_fcoe_els_ct_wr *wr; |
1666 | - uint32_t port_id; | |
1669 | + __be32 port_id; | |
1667 | 1670 | |
1668 | 1671 | wr = (struct fw_fcoe_els_ct_wr *)fw_wr; |
1669 | 1672 | wr->op_immdlen = cpu_to_be32(FW_WR_OP(FW_FCOE_ELS_CT_WR) | |
... | ... | @@ -1676,8 +1679,8 @@ |
1676 | 1679 | wr->ctl_pri = 0; |
1677 | 1680 | wr->cp_en_class = 0; |
1678 | 1681 | wr->cookie = io_req->fw_handle; |
1679 | - wr->iqid = (uint16_t)cpu_to_be16(csio_q_physiqid( | |
1680 | - io_req->lnode->hwp, io_req->iq_idx)); | |
1682 | + wr->iqid = cpu_to_be16(csio_q_physiqid( | |
1683 | + io_req->lnode->hwp, io_req->iq_idx)); | |
1681 | 1684 | wr->fl_to_sp = FW_FCOE_ELS_CT_WR_SP(1); |
1682 | 1685 | wr->tmo_val = (uint8_t) io_req->tmo; |
1683 | 1686 | port_id = htonl(sid); |
drivers/scsi/csiostor/csio_mb.c
... | ... | @@ -1119,13 +1119,11 @@ |
1119 | 1119 | } /* csio_fcoe_read_portparams_init_mb */ |
1120 | 1120 | |
1121 | 1121 | void |
1122 | -csio_mb_process_portparams_rsp( | |
1123 | - struct csio_hw *hw, | |
1122 | +csio_mb_process_portparams_rsp(struct csio_hw *hw, | |
1124 | 1123 | struct csio_mb *mbp, |
1125 | 1124 | enum fw_retval *retval, |
1126 | 1125 | struct fw_fcoe_port_cmd_params *portparams, |
1127 | - struct fw_fcoe_port_stats *portstats | |
1128 | - ) | |
1126 | + struct fw_fcoe_port_stats *portstats) | |
1129 | 1127 | { |
1130 | 1128 | struct fw_fcoe_stats_cmd *rsp = (struct fw_fcoe_stats_cmd *)(mbp->mb); |
1131 | 1129 | struct fw_fcoe_port_stats stats; |
1132 | 1130 | |
1133 | 1131 | |
1134 | 1132 | |
1135 | 1133 | |
... | ... | @@ -1142,50 +1140,32 @@ |
1142 | 1140 | memcpy(dst, src, (portparams->nstats * 8)); |
1143 | 1141 | if (portparams->idx == 1) { |
1144 | 1142 | /* Get the first 6 flits from the Mailbox */ |
1145 | - portstats->tx_bcast_bytes = | |
1146 | - be64_to_cpu(stats.tx_bcast_bytes); | |
1147 | - portstats->tx_bcast_frames = | |
1148 | - be64_to_cpu(stats.tx_bcast_frames); | |
1149 | - portstats->tx_mcast_bytes = | |
1150 | - be64_to_cpu(stats.tx_mcast_bytes); | |
1151 | - portstats->tx_mcast_frames = | |
1152 | - be64_to_cpu(stats.tx_mcast_frames); | |
1153 | - portstats->tx_ucast_bytes = | |
1154 | - be64_to_cpu(stats.tx_ucast_bytes); | |
1155 | - portstats->tx_ucast_frames = | |
1156 | - be64_to_cpu(stats.tx_ucast_frames); | |
1143 | + portstats->tx_bcast_bytes = stats.tx_bcast_bytes; | |
1144 | + portstats->tx_bcast_frames = stats.tx_bcast_frames; | |
1145 | + portstats->tx_mcast_bytes = stats.tx_mcast_bytes; | |
1146 | + portstats->tx_mcast_frames = stats.tx_mcast_frames; | |
1147 | + portstats->tx_ucast_bytes = stats.tx_ucast_bytes; | |
1148 | + portstats->tx_ucast_frames = stats.tx_ucast_frames; | |
1157 | 1149 | } |
1158 | 1150 | if (portparams->idx == 7) { |
1159 | 1151 | /* Get the second 6 flits from the Mailbox */ |
1160 | - portstats->tx_drop_frames = | |
1161 | - be64_to_cpu(stats.tx_drop_frames); | |
1162 | - portstats->tx_offload_bytes = | |
1163 | - be64_to_cpu(stats.tx_offload_bytes); | |
1164 | - portstats->tx_offload_frames = | |
1165 | - be64_to_cpu(stats.tx_offload_frames); | |
1152 | + portstats->tx_drop_frames = stats.tx_drop_frames; | |
1153 | + portstats->tx_offload_bytes = stats.tx_offload_bytes; | |
1154 | + portstats->tx_offload_frames = stats.tx_offload_frames; | |
1166 | 1155 | #if 0 |
1167 | - portstats->rx_pf_bytes = | |
1168 | - be64_to_cpu(stats.rx_pf_bytes); | |
1169 | - portstats->rx_pf_frames = | |
1170 | - be64_to_cpu(stats.rx_pf_frames); | |
1156 | + portstats->rx_pf_bytes = stats.rx_pf_bytes; | |
1157 | + portstats->rx_pf_frames = stats.rx_pf_frames; | |
1171 | 1158 | #endif |
1172 | - portstats->rx_bcast_bytes = | |
1173 | - be64_to_cpu(stats.rx_bcast_bytes); | |
1174 | - portstats->rx_bcast_frames = | |
1175 | - be64_to_cpu(stats.rx_bcast_frames); | |
1176 | - portstats->rx_mcast_bytes = | |
1177 | - be64_to_cpu(stats.rx_mcast_bytes); | |
1159 | + portstats->rx_bcast_bytes = stats.rx_bcast_bytes; | |
1160 | + portstats->rx_bcast_frames = stats.rx_bcast_frames; | |
1161 | + portstats->rx_mcast_bytes = stats.rx_mcast_bytes; | |
1178 | 1162 | } |
1179 | 1163 | if (portparams->idx == 13) { |
1180 | 1164 | /* Get the last 4 flits from the Mailbox */ |
1181 | - portstats->rx_mcast_frames = | |
1182 | - be64_to_cpu(stats.rx_mcast_frames); | |
1183 | - portstats->rx_ucast_bytes = | |
1184 | - be64_to_cpu(stats.rx_ucast_bytes); | |
1185 | - portstats->rx_ucast_frames = | |
1186 | - be64_to_cpu(stats.rx_ucast_frames); | |
1187 | - portstats->rx_err_frames = | |
1188 | - be64_to_cpu(stats.rx_err_frames); | |
1165 | + portstats->rx_mcast_frames = stats.rx_mcast_frames; | |
1166 | + portstats->rx_ucast_bytes = stats.rx_ucast_bytes; | |
1167 | + portstats->rx_ucast_frames = stats.rx_ucast_frames; | |
1168 | + portstats->rx_err_frames = stats.rx_err_frames; | |
1189 | 1169 | } |
1190 | 1170 | } |
1191 | 1171 | } |
... | ... | @@ -1414,7 +1394,7 @@ |
1414 | 1394 | (hw, data_reg + i)); |
1415 | 1395 | csio_wr_reg32(hw, 0, ctl_reg); |
1416 | 1396 | |
1417 | - if (FW_CMD_RETVAL_GET(*(mbp->mb))) | |
1397 | + if (csio_mb_fw_retval(mbp) != FW_SUCCESS) | |
1418 | 1398 | CSIO_INC_STATS(mbm, n_err); |
1419 | 1399 | |
1420 | 1400 | CSIO_INC_STATS(mbm, n_rsp); |
drivers/scsi/csiostor/csio_rnode.c
... | ... | @@ -303,9 +303,9 @@ |
303 | 303 | uint8_t rport_type; |
304 | 304 | struct csio_rnode *rn, *match_rn; |
305 | 305 | uint32_t vnp_flowid; |
306 | - uint32_t *port_id; | |
306 | + __be32 *port_id; | |
307 | 307 | |
308 | - port_id = (uint32_t *)&rdevp->r_id[0]; | |
308 | + port_id = (__be32 *)&rdevp->r_id[0]; | |
309 | 309 | rport_type = |
310 | 310 | FW_RDEV_WR_RPORT_TYPE_GET(rdevp->rd_xfer_rdy_to_rport_type); |
311 | 311 | |
312 | 312 | |
... | ... | @@ -439,9 +439,9 @@ |
439 | 439 | uint8_t null[8]; |
440 | 440 | uint8_t rport_type; |
441 | 441 | uint8_t fc_class; |
442 | - uint32_t *did; | |
442 | + __be32 *did; | |
443 | 443 | |
444 | - did = (uint32_t *) &rdevp->r_id[0]; | |
444 | + did = (__be32 *) &rdevp->r_id[0]; | |
445 | 445 | rport_type = |
446 | 446 | FW_RDEV_WR_RPORT_TYPE_GET(rdevp->rd_xfer_rdy_to_rport_type); |
447 | 447 | switch (rport_type) { |
448 | 448 | |
... | ... | @@ -529,9 +529,10 @@ |
529 | 529 | rn->nport_id = (ntohl(*did) >> 8) & CSIO_DID_MASK; |
530 | 530 | memcpy(csio_rn_wwnn(rn), rdevp->wwnn, 8); |
531 | 531 | memcpy(csio_rn_wwpn(rn), rdevp->wwpn, 8); |
532 | - rn->rn_sparm.csp.sp_bb_data = ntohs(rdevp->rcv_fr_sz); | |
532 | + rn->rn_sparm.csp.sp_bb_data = rdevp->rcv_fr_sz; | |
533 | 533 | fc_class = FW_RDEV_WR_CLASS_GET(rdevp->vft_to_qos); |
534 | 534 | rn->rn_sparm.clsp[fc_class - 1].cp_class = htons(FC_CPC_VALID); |
535 | + | |
535 | 536 | return 0; |
536 | 537 | } |
537 | 538 |
drivers/scsi/csiostor/csio_scsi.c
... | ... | @@ -237,7 +237,7 @@ |
237 | 237 | DIV_ROUND_UP(size, 16))); |
238 | 238 | |
239 | 239 | wr->cookie = (uintptr_t) req; |
240 | - wr->iqid = (uint16_t)cpu_to_be16(csio_q_physiqid(hw, req->iq_idx)); | |
240 | + wr->iqid = cpu_to_be16(csio_q_physiqid(hw, req->iq_idx)); | |
241 | 241 | wr->tmo_val = (uint8_t) req->tmo; |
242 | 242 | wr->r3 = 0; |
243 | 243 | memset(&wr->r5, 0, 8); |
... | ... | @@ -396,7 +396,7 @@ |
396 | 396 | wr->flowid_len16 = cpu_to_be32(FW_WR_FLOWID(rn->flowid) | |
397 | 397 | FW_WR_LEN16(DIV_ROUND_UP(size, 16))); |
398 | 398 | wr->cookie = (uintptr_t)req; |
399 | - wr->iqid = (uint16_t)cpu_to_be16(csio_q_physiqid(hw, req->iq_idx)); | |
399 | + wr->iqid = cpu_to_be16(csio_q_physiqid(hw, req->iq_idx)); | |
400 | 400 | wr->tmo_val = (uint8_t)(req->tmo); |
401 | 401 | wr->use_xfer_cnt = 1; |
402 | 402 | wr->xfer_cnt = cpu_to_be32(scsi_bufflen(scmnd)); |
... | ... | @@ -449,7 +449,7 @@ |
449 | 449 | wr->flowid_len16 = cpu_to_be32(FW_WR_FLOWID(rn->flowid) | |
450 | 450 | FW_WR_LEN16(DIV_ROUND_UP(size, 16))); |
451 | 451 | wr->cookie = (uintptr_t)req; |
452 | - wr->iqid = (uint16_t)cpu_to_be16(csio_q_physiqid(hw, req->iq_idx)); | |
452 | + wr->iqid = cpu_to_be16(csio_q_physiqid(hw, req->iq_idx)); | |
453 | 453 | wr->tmo_val = (uint8_t)(req->tmo); |
454 | 454 | wr->use_xfer_cnt = 1; |
455 | 455 | wr->xfer_cnt = cpu_to_be32(scsi_bufflen(scmnd)); |
... | ... | @@ -680,7 +680,7 @@ |
680 | 680 | DIV_ROUND_UP(size, 16))); |
681 | 681 | |
682 | 682 | wr->cookie = (uintptr_t) req; |
683 | - wr->iqid = (uint16_t)cpu_to_be16(csio_q_physiqid(hw, req->iq_idx)); | |
683 | + wr->iqid = cpu_to_be16(csio_q_physiqid(hw, req->iq_idx)); | |
684 | 684 | wr->tmo_val = (uint8_t) req->tmo; |
685 | 685 | /* 0 for CHK_ALL_IO tells FW to look up t_cookie */ |
686 | 686 | wr->sub_opcode_to_chk_all_io = |
drivers/scsi/csiostor/t4fw_api_stor.h
... | ... | @@ -221,7 +221,7 @@ |
221 | 221 | struct fw_fcoe_els_ct_wr { |
222 | 222 | __be32 op_immdlen; |
223 | 223 | __be32 flowid_len16; |
224 | - __be64 cookie; | |
224 | + u64 cookie; | |
225 | 225 | __be16 iqid; |
226 | 226 | u8 tmo_val; |
227 | 227 | u8 els_ct_type; |
... | ... | @@ -246,7 +246,7 @@ |
246 | 246 | struct fw_scsi_write_wr { |
247 | 247 | __be32 op_immdlen; |
248 | 248 | __be32 flowid_len16; |
249 | - __be64 cookie; | |
249 | + u64 cookie; | |
250 | 250 | __be16 iqid; |
251 | 251 | u8 tmo_val; |
252 | 252 | u8 use_xfer_cnt; |
... | ... | @@ -272,7 +272,7 @@ |
272 | 272 | struct fw_scsi_read_wr { |
273 | 273 | __be32 op_immdlen; |
274 | 274 | __be32 flowid_len16; |
275 | - __be64 cookie; | |
275 | + u64 cookie; | |
276 | 276 | __be16 iqid; |
277 | 277 | u8 tmo_val; |
278 | 278 | u8 use_xfer_cnt; |
... | ... | @@ -298,7 +298,7 @@ |
298 | 298 | struct fw_scsi_cmd_wr { |
299 | 299 | __be32 op_immdlen; |
300 | 300 | __be32 flowid_len16; |
301 | - __be64 cookie; | |
301 | + u64 cookie; | |
302 | 302 | __be16 iqid; |
303 | 303 | u8 tmo_val; |
304 | 304 | u8 r3; |
305 | 305 | |
... | ... | @@ -326,12 +326,12 @@ |
326 | 326 | struct fw_scsi_abrt_cls_wr { |
327 | 327 | __be32 op_immdlen; |
328 | 328 | __be32 flowid_len16; |
329 | - __be64 cookie; | |
329 | + u64 cookie; | |
330 | 330 | __be16 iqid; |
331 | 331 | u8 tmo_val; |
332 | 332 | u8 sub_opcode_to_chk_all_io; |
333 | 333 | u8 r3[4]; |
334 | - __be64 t_cookie; | |
334 | + u64 t_cookie; | |
335 | 335 | }; |
336 | 336 | |
337 | 337 | #define FW_SCSI_ABRT_CLS_WR_SUB_OPCODE(x) ((x) << 2) |