21 #include <linux/pci.h>
22 #include <linux/slab.h>
24 #include <linux/export.h>
26 #include <asm/unaligned.h>
28 #include <scsi/scsi.h>
48 #define LPFC_RESET_WAIT 2
49 #define LPFC_ABORT_WAIT 2
53 static char *dif_op_str[] = {
82 "9050 BLKGRD: ERROR %s _dump_buf_data is NULL\n",
90 "9051 BLKGRD: ERROR: data scatterlist is null\n");
111 "9052 BLKGRD: ERROR %s _dump_buf_data is NULL\n",
118 "9053 BLKGRD: ERROR: prot scatterlist is null\n");
140 lpfc_sli4_set_rsp_sgl_last(
struct lpfc_hba *phba,
147 bf_set(lpfc_sli4_sge_last, sgl, 1);
183 spin_unlock_irqrestore(shost->
host_lock, flags);
203 spin_unlock_irqrestore(shost->
host_lock, flags);
219 lpfc_send_sdev_queuedepth_change_event(
struct lpfc_hba *phba,
254 spin_unlock_irqrestore(&phba->
hbalock, flags);
276 unsigned long new_queue_depth, old_queue_depth;
283 lpfc_send_sdev_queuedepth_change_event(phba, vport,
312 spin_unlock_irqrestore(&phba->
hbalock, flags);
318 spin_unlock_irqrestore(&phba->
hbalock, flags);
324 spin_unlock_irqrestore(&phba->
pport->work_port_lock, flags);
343 lpfc_rampup_queue_depth(
struct lpfc_vport *vport,
358 spin_unlock_irqrestore(&phba->
hbalock, flags);
362 spin_unlock_irqrestore(&phba->
hbalock, flags);
368 spin_unlock_irqrestore(&phba->
pport->work_port_lock, flags);
389 unsigned long new_queue_depth;
390 unsigned long num_rsrc_err, num_cmd_success;
401 if (num_rsrc_err == 0)
407 shost = lpfc_shost_from_vport(vports[i]);
411 (num_rsrc_err + num_cmd_success);
412 if (!new_queue_depth)
446 shost = lpfc_shost_from_vport(vports[i]);
448 if (vports[i]->cfg_lun_queue_depth <=
481 shost = lpfc_shost_from_vport(vports[i]);
507 lpfc_new_scsi_buf_s3(
struct lpfc_vport *vport,
int num_to_alloc)
519 for (bcnt = 0; bcnt < num_to_alloc; bcnt++) {
569 bpl[0].tus.f.bdeSize =
sizeof(
struct fcp_cmnd);
576 bpl[1].tus.f.bdeSize =
sizeof(
struct fcp_rsp);
620 lpfc_release_scsi_buf_s3(phba, psb);
639 unsigned long iflag = 0;
642 spin_lock(&phba->
sli4_hba.abts_scsi_buf_list_lock);
646 && psb->
rdata->pnode->vport == vport)
649 spin_unlock(&phba->
sli4_hba.abts_scsi_buf_list_lock);
650 spin_unlock_irqrestore(&phba->
hbalock, iflag);
668 unsigned long iflag = 0;
676 spin_lock(&phba->
sli4_hba.abts_scsi_buf_list_lock);
684 &phba->
sli4_hba.abts_scsi_buf_list_lock);
686 ndlp = psb->
rdata->pnode;
691 spin_unlock_irqrestore(&phba->
hbalock, iflag);
697 lpfc_release_scsi_buf_s4(phba, psb);
703 spin_unlock(&phba->
sli4_hba.abts_scsi_buf_list_lock);
704 for (i = 1; i <= phba->
sli.last_iotag; i++) {
705 iocbq = phba->
sli.iocbq_lookup[
i];
714 spin_unlock_irqrestore(&phba->
hbalock, iflag);
720 spin_unlock_irqrestore(&phba->
hbalock, iflag);
743 int post_cnt = 0, block_cnt = 0, num_posting = 0, num_posted = 0;
755 list_del_init(&psb->
list);
757 if ((last_xritag !=
NO_XRI) &&
758 (psb->
cur_iocbq.sli4_xritag != last_xritag + 1)) {
760 list_splice_init(&prep_sblist, &blck_sblist);
761 post_cnt = block_cnt - 1;
770 list_splice_init(&prep_sblist, &blck_sblist);
771 post_cnt = block_cnt;
776 last_xritag = psb->
cur_iocbq.sli4_xritag;
779 if (num_posting == sb_count) {
782 list_splice_init(&prep_sblist, &blck_sblist);
783 post_cnt = block_cnt;
784 }
else if (block_cnt == 1) {
825 while (!list_empty(&blck_sblist)) {
841 while (!list_empty(&scsi_sblist)) {
844 lpfc_release_scsi_buf_s4(phba, psb);
865 int num_posted,
rc = 0;
873 if (!list_empty(&post_sblist)) {
898 lpfc_new_scsi_buf_s4(
struct lpfc_vport *vport,
int num_to_alloc)
908 int bcnt, num_posted;
913 for (bcnt = 0; bcnt < num_to_alloc; bcnt++) {
962 pdma_phys_fcp_rsp = pdma_phys_fcp_cmd +
sizeof(
struct fcp_cmnd);
972 bf_set(lpfc_sli4_sge_last, sgl, 0);
981 bf_set(lpfc_sli4_sge_last, sgl, 1);
1016 "3021 Allocate %d out of %d requested new SCSI "
1017 "buffers\n", bcnt, num_to_alloc);
1020 if (!list_empty(&post_sblist))
1022 &post_sblist, bcnt);
1042 lpfc_new_scsi_buf(
struct lpfc_vport *vport,
int num_to_alloc)
1044 return vport->
phba->lpfc_new_scsi_buf(vport, num_to_alloc);
1063 unsigned long iflag = 0;
1090 unsigned long iflag = 0;
1141 unsigned long iflag = 0;
1162 unsigned long iflag = 0;
1169 &phba->
sli4_hba.lpfc_abts_scsi_buf_list);
1170 spin_unlock_irqrestore(&phba->
sli4_hba.abts_scsi_buf_list_lock,
1231 if (scsi_sg_count(scsi_cmnd)) {
1240 scsi_sg_count(scsi_cmnd), datadir);
1247 "9064 BLKGRD: %s: Too many sg segments from "
1248 "dma_map_sg. Config %d, seg_cnt %d\n",
1305 data_bde->
tus.
f.bdeSize = (num_bde *
1307 physaddr += (
sizeof(
struct fcp_cmnd) +
1320 ((num_bde + 2) *
sizeof(
struct ulp_bde64));
1333 static inline unsigned
1334 lpfc_cmd_blksize(
struct scsi_cmnd *
sc)
1336 return sc->
device->sector_size;
1339 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1342 #define BG_ERR_INIT 0x1
1344 #define BG_ERR_TGT 0x2
1346 #define BG_ERR_SWAP 0x10
1348 #define BG_ERR_CHECK 0x20
1361 lpfc_bg_err_inject(
struct lpfc_hba *phba,
struct scsi_cmnd *
sc,
1380 sgpe = scsi_prot_sglist(sc);
1381 sgde = scsi_sglist(sc);
1382 lba = scsi_get_lba(sc);
1385 if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) {
1386 blksize = lpfc_cmd_blksize(sc);
1387 numblks = (scsi_bufflen(sc) + blksize - 1) / blksize;
1390 if ((phba->lpfc_injerr_lba < lba) ||
1391 (phba->lpfc_injerr_lba >= (lba + numblks)))
1394 blockoff = phba->lpfc_injerr_lba -
lba;
1397 if (numblks < blockoff)
1403 rdata = sc->
device->hostdata;
1404 if (rdata && rdata->
pnode) {
1405 ndlp = rdata->
pnode;
1408 if (phba->lpfc_injerr_nportid &&
1409 (phba->lpfc_injerr_nportid != ndlp->
nlp_DID))
1416 if (phba->lpfc_injerr_wwpn.u.wwn[0] &&
1431 if (phba->lpfc_injerr_wref_cnt) {
1444 "9076 BLKGRD: Injecting reftag error: "
1445 "write lba x%lx + x%x oldrefTag x%x\n",
1446 (
unsigned long)lba, blockoff,
1454 lpfc_cmd->prot_data_type =
1456 lpfc_cmd->prot_data_segment =
1458 lpfc_cmd->prot_data =
1462 phba->lpfc_injerr_wref_cnt--;
1463 if (phba->lpfc_injerr_wref_cnt == 0) {
1464 phba->lpfc_injerr_nportid = 0;
1465 phba->lpfc_injerr_lba =
1466 LPFC_INJERR_LBA_OFF;
1467 memset(&phba->lpfc_injerr_wwpn,
1470 rc = BG_ERR_TGT | BG_ERR_CHECK;
1482 *reftag = 0xDEADBEEF;
1483 phba->lpfc_injerr_wref_cnt--;
1484 if (phba->lpfc_injerr_wref_cnt == 0) {
1485 phba->lpfc_injerr_nportid = 0;
1486 phba->lpfc_injerr_lba =
1487 LPFC_INJERR_LBA_OFF;
1488 memset(&phba->lpfc_injerr_wwpn,
1491 rc = BG_ERR_TGT | BG_ERR_CHECK;
1494 "9078 BLKGRD: Injecting reftag error: "
1495 "write lba x%lx\n", (
unsigned long)lba);
1503 *reftag = 0xDEADBEEF;
1504 phba->lpfc_injerr_wref_cnt--;
1505 if (phba->lpfc_injerr_wref_cnt == 0) {
1506 phba->lpfc_injerr_nportid = 0;
1507 phba->lpfc_injerr_lba =
1508 LPFC_INJERR_LBA_OFF;
1509 memset(&phba->lpfc_injerr_wwpn,
1515 "9077 BLKGRD: Injecting reftag error: "
1516 "write lba x%lx\n", (
unsigned long)lba);
1520 if (phba->lpfc_injerr_rref_cnt) {
1530 *reftag = 0xDEADBEEF;
1531 phba->lpfc_injerr_rref_cnt--;
1532 if (phba->lpfc_injerr_rref_cnt == 0) {
1533 phba->lpfc_injerr_nportid = 0;
1534 phba->lpfc_injerr_lba =
1535 LPFC_INJERR_LBA_OFF;
1536 memset(&phba->lpfc_injerr_wwpn,
1542 "9079 BLKGRD: Injecting reftag error: "
1543 "read lba x%lx\n", (
unsigned long)lba);
1551 if (phba->lpfc_injerr_wapp_cnt) {
1564 "9080 BLKGRD: Injecting apptag error: "
1565 "write lba x%lx + x%x oldappTag x%x\n",
1566 (
unsigned long)lba, blockoff,
1574 lpfc_cmd->prot_data_type =
1576 lpfc_cmd->prot_data_segment =
1578 lpfc_cmd->prot_data =
1582 phba->lpfc_injerr_wapp_cnt--;
1583 if (phba->lpfc_injerr_wapp_cnt == 0) {
1584 phba->lpfc_injerr_nportid = 0;
1585 phba->lpfc_injerr_lba =
1586 LPFC_INJERR_LBA_OFF;
1587 memset(&phba->lpfc_injerr_wwpn,
1590 rc = BG_ERR_TGT | BG_ERR_CHECK;
1602 phba->lpfc_injerr_wapp_cnt--;
1603 if (phba->lpfc_injerr_wapp_cnt == 0) {
1604 phba->lpfc_injerr_nportid = 0;
1605 phba->lpfc_injerr_lba =
1606 LPFC_INJERR_LBA_OFF;
1607 memset(&phba->lpfc_injerr_wwpn,
1610 rc = BG_ERR_TGT | BG_ERR_CHECK;
1613 "0813 BLKGRD: Injecting apptag error: "
1614 "write lba x%lx\n", (
unsigned long)lba);
1623 phba->lpfc_injerr_wapp_cnt--;
1624 if (phba->lpfc_injerr_wapp_cnt == 0) {
1625 phba->lpfc_injerr_nportid = 0;
1626 phba->lpfc_injerr_lba =
1627 LPFC_INJERR_LBA_OFF;
1628 memset(&phba->lpfc_injerr_wwpn,
1634 "0812 BLKGRD: Injecting apptag error: "
1635 "write lba x%lx\n", (
unsigned long)lba);
1639 if (phba->lpfc_injerr_rapp_cnt) {
1650 phba->lpfc_injerr_rapp_cnt--;
1651 if (phba->lpfc_injerr_rapp_cnt == 0) {
1652 phba->lpfc_injerr_nportid = 0;
1653 phba->lpfc_injerr_lba =
1654 LPFC_INJERR_LBA_OFF;
1655 memset(&phba->lpfc_injerr_wwpn,
1661 "0814 BLKGRD: Injecting apptag error: "
1662 "read lba x%lx\n", (
unsigned long)lba);
1671 if (phba->lpfc_injerr_wgrd_cnt) {
1683 phba->lpfc_injerr_wgrd_cnt--;
1684 if (phba->lpfc_injerr_wgrd_cnt == 0) {
1685 phba->lpfc_injerr_nportid = 0;
1686 phba->lpfc_injerr_lba =
1687 LPFC_INJERR_LBA_OFF;
1688 memset(&phba->lpfc_injerr_wwpn,
1692 rc |= BG_ERR_TGT | BG_ERR_SWAP;
1696 "0817 BLKGRD: Injecting guard error: "
1697 "write lba x%lx\n", (
unsigned long)lba);
1705 phba->lpfc_injerr_wgrd_cnt--;
1706 if (phba->lpfc_injerr_wgrd_cnt == 0) {
1707 phba->lpfc_injerr_nportid = 0;
1708 phba->lpfc_injerr_lba =
1709 LPFC_INJERR_LBA_OFF;
1710 memset(&phba->lpfc_injerr_wwpn,
1714 rc = BG_ERR_INIT | BG_ERR_SWAP;
1718 "0816 BLKGRD: Injecting guard error: "
1719 "write lba x%lx\n", (
unsigned long)lba);
1723 if (phba->lpfc_injerr_rgrd_cnt) {
1733 phba->lpfc_injerr_rgrd_cnt--;
1734 if (phba->lpfc_injerr_rgrd_cnt == 0) {
1735 phba->lpfc_injerr_nportid = 0;
1736 phba->lpfc_injerr_lba =
1737 LPFC_INJERR_LBA_OFF;
1738 memset(&phba->lpfc_injerr_wwpn,
1742 rc = BG_ERR_INIT | BG_ERR_SWAP;
1746 "0818 BLKGRD: Injecting guard error: "
1747 "read lba x%lx\n", (
unsigned long)lba);
1768 lpfc_sc_to_bg_opcodes(
struct lpfc_hba *phba,
struct scsi_cmnd *sc,
1775 switch (scsi_get_prot_op(sc)) {
1797 "9063 BLKGRD: Bad op/guard:%d/IP combination\n",
1798 scsi_get_prot_op(sc));
1804 switch (scsi_get_prot_op(sc)) {
1826 "9075 BLKGRD: Bad op/guard:%d/CRC combination\n",
1827 scsi_get_prot_op(sc));
1836 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1849 lpfc_bg_err_opcodes(
struct lpfc_hba *phba,
struct scsi_cmnd *sc,
1856 switch (scsi_get_prot_op(sc)) {
1881 switch (scsi_get_prot_op(sc)) {
1942 lpfc_bg_setup_bpl(
struct lpfc_hba *phba,
struct scsi_cmnd *sc,
1949 int i = 0, num_bde = 0,
status;
1951 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1959 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop);
1964 blksize = lpfc_cmd_blksize(sc);
1965 reftag = (
uint32_t)scsi_get_lba(sc);
1967 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1968 rc = lpfc_bg_err_inject(phba, sc, &reftag,
NULL, 1);
1970 if (rc & BG_ERR_SWAP)
1971 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
1972 if (rc & BG_ERR_CHECK)
1994 bf_set(pde6_optx, pde6, txop);
1995 bf_set(pde6_oprx, pde6, rxop);
1997 bf_set(pde6_ce, pde6, checking);
1998 bf_set(pde6_re, pde6, checking);
2000 bf_set(pde6_ai, pde6, 1);
2001 bf_set(pde6_ae, pde6, 0);
2002 bf_set(pde6_apptagval, pde6, 0);
2072 lpfc_bg_setup_bpl_prot(
struct lpfc_hba *phba,
struct scsi_cmnd *sc,
2073 struct ulp_bde64 *bpl,
int datacnt,
int protcnt)
2081 unsigned short curr_data = 0, curr_prot = 0;
2082 unsigned int split_offset;
2083 unsigned int protgroup_len, protgroup_offset = 0, protgroup_remainder;
2084 unsigned int protgrp_blks, protgrp_bytes;
2085 unsigned int remainder, subtotal;
2088 unsigned char pgdone = 0, alldone = 0;
2090 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
2098 sgpe = scsi_prot_sglist(sc);
2099 sgde = scsi_sglist(sc);
2101 if (!sgpe || !sgde) {
2103 "9020 Invalid s/g entry: data=0x%p prot=0x%p\n",
2108 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop);
2113 blksize = lpfc_cmd_blksize(sc);
2114 reftag = (
uint32_t)scsi_get_lba(sc);
2116 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
2117 rc = lpfc_bg_err_inject(phba, sc, &reftag,
NULL, 1);
2119 if (rc & BG_ERR_SWAP)
2120 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
2121 if (rc & BG_ERR_CHECK)
2145 bf_set(pde6_optx, pde6, txop);
2146 bf_set(pde6_oprx, pde6, rxop);
2147 bf_set(pde6_ce, pde6, checking);
2148 bf_set(pde6_re, pde6, checking);
2149 bf_set(pde6_ai, pde6, 1);
2150 bf_set(pde6_ae, pde6, 0);
2151 bf_set(pde6_apptagval, pde6, 0);
2164 protgroup_len =
sg_dma_len(sgpe) - protgroup_offset;
2167 BUG_ON(protgroup_len % 8);
2176 protgrp_blks = protgroup_len / 8;
2177 protgrp_bytes = protgrp_blks * blksize;
2180 if ((pde7->
addrLow & 0xfff) + protgroup_len > 0x1000) {
2181 protgroup_remainder = 0x1000 - (pde7->
addrLow & 0xfff);
2182 protgroup_offset += protgroup_remainder;
2183 protgrp_blks = protgroup_remainder / 8;
2184 protgrp_bytes = protgrp_blks * blksize;
2186 protgroup_offset = 0;
2198 "9065 BLKGRD:%s Invalid data segment\n",
2209 if ((subtotal + remainder) <= protgrp_bytes) {
2211 bpl->
tus.
f.bdeSize = remainder;
2214 if ((subtotal + remainder) == protgrp_bytes)
2218 bpl->
tus.
f.bdeSize = protgrp_bytes - subtotal;
2219 split_offset += bpl->
tus.
f.bdeSize;
2222 subtotal += bpl->
tus.
f.bdeSize;
2241 if (protgroup_offset) {
2243 reftag += protgrp_blks;
2249 if (curr_prot == protcnt) {
2251 }
else if (curr_prot < protcnt) {
2257 reftag += protgrp_blks;
2261 "9054 BLKGRD: bug in %s\n", __func__);
2300 lpfc_bg_setup_sgl(
struct lpfc_hba *phba,
struct scsi_cmnd *sc,
2301 struct sli4_sge *sgl,
int datasegcnt)
2306 int i = 0, num_sge = 0,
status;
2311 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
2318 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop);
2323 blksize = lpfc_cmd_blksize(sc);
2324 reftag = (
uint32_t)scsi_get_lba(sc);
2326 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
2327 rc = lpfc_bg_err_inject(phba, sc, &reftag,
NULL, 1);
2329 if (rc & BG_ERR_SWAP)
2330 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
2331 if (rc & BG_ERR_CHECK)
2346 bf_set(lpfc_sli4_sge_dif_optx, diseed, txop);
2347 bf_set(lpfc_sli4_sge_dif_oprx, diseed, rxop);
2349 bf_set(lpfc_sli4_sge_dif_ce, diseed, checking);
2350 bf_set(lpfc_sli4_sge_dif_re, diseed, checking);
2352 bf_set(lpfc_sli4_sge_dif_ai, diseed, 1);
2353 bf_set(lpfc_sli4_sge_dif_me, diseed, 0);
2369 if ((i + 1) == datasegcnt)
2370 bf_set(lpfc_sli4_sge_last, sgl, 1);
2372 bf_set(lpfc_sli4_sge_last, sgl, 0);
2373 bf_set(lpfc_sli4_sge_offset, sgl, dma_offset);
2377 dma_offset += dma_len;
2425 lpfc_bg_setup_sgl_prot(
struct lpfc_hba *phba,
struct scsi_cmnd *sc,
2426 struct sli4_sge *sgl,
int datacnt,
int protcnt)
2432 unsigned short curr_data = 0, curr_prot = 0;
2433 unsigned int split_offset;
2434 unsigned int protgroup_len, protgroup_offset = 0, protgroup_remainder;
2435 unsigned int protgrp_blks, protgrp_bytes;
2436 unsigned int remainder, subtotal;
2438 unsigned char pgdone = 0, alldone = 0;
2443 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
2450 sgpe = scsi_prot_sglist(sc);
2451 sgde = scsi_sglist(sc);
2453 if (!sgpe || !sgde) {
2455 "9082 Invalid s/g entry: data=0x%p prot=0x%p\n",
2460 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop);
2465 blksize = lpfc_cmd_blksize(sc);
2466 reftag = (
uint32_t)scsi_get_lba(sc);
2468 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
2469 rc = lpfc_bg_err_inject(phba, sc, &reftag,
NULL, 1);
2471 if (rc & BG_ERR_SWAP)
2472 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
2473 if (rc & BG_ERR_CHECK)
2490 bf_set(lpfc_sli4_sge_dif_optx, diseed, txop);
2491 bf_set(lpfc_sli4_sge_dif_oprx, diseed, rxop);
2492 bf_set(lpfc_sli4_sge_dif_ce, diseed, checking);
2493 bf_set(lpfc_sli4_sge_dif_re, diseed, checking);
2494 bf_set(lpfc_sli4_sge_dif_ai, diseed, 1);
2495 bf_set(lpfc_sli4_sge_dif_me, diseed, 0);
2507 protgroup_len =
sg_dma_len(sgpe) - protgroup_offset;
2510 BUG_ON(protgroup_len % 8);
2519 protgrp_blks = protgroup_len / 8;
2520 protgrp_bytes = protgrp_blks * blksize;
2523 if ((sgl->
addr_lo & 0xfff) + protgroup_len > 0x1000) {
2524 protgroup_remainder = 0x1000 - (sgl->
addr_lo & 0xfff);
2525 protgroup_offset += protgroup_remainder;
2526 protgrp_blks = protgroup_remainder / 8;
2527 protgrp_bytes = protgrp_blks * blksize;
2529 protgroup_offset = 0;
2541 "9086 BLKGRD:%s Invalid data segment\n",
2550 if ((subtotal + remainder) <= protgrp_bytes) {
2552 dma_len = remainder;
2555 if ((subtotal + remainder) == protgrp_bytes)
2559 dma_len = protgrp_bytes - subtotal;
2560 split_offset += dma_len;
2563 subtotal += dma_len;
2567 bf_set(lpfc_sli4_sge_last, sgl, 0);
2568 bf_set(lpfc_sli4_sge_offset, sgl, dma_offset);
2572 dma_offset += dma_len;
2584 if (protgroup_offset) {
2586 reftag += protgrp_blks;
2592 if (curr_prot == protcnt) {
2593 bf_set(lpfc_sli4_sge_last, sgl, 1);
2595 }
else if (curr_prot < protcnt) {
2601 reftag += protgrp_blks;
2605 "9085 BLKGRD: bug in %s\n", __func__);
2627 lpfc_prot_group_type(
struct lpfc_hba *phba,
struct scsi_cmnd *sc)
2630 unsigned char op = scsi_get_prot_op(sc);
2645 "9021 Unsupported protection op:%d\n", op);
2662 lpfc_bg_scsi_prep_dma_buf_s3(
struct lpfc_hba *phba,
2665 struct scsi_cmnd *scsi_cmnd = lpfc_cmd->
pCmd;
2666 struct fcp_cmnd *fcp_cmnd = lpfc_cmd->
fcp_cmnd;
2671 int prot_group_type = 0;
2680 if (scsi_sg_count(scsi_cmnd)) {
2688 scsi_sglist(scsi_cmnd),
2689 scsi_sg_count(scsi_cmnd), datadir);
2693 lpfc_cmd->
seg_cnt = datasegcnt;
2696 "9067 BLKGRD: %s: Too many sg segments"
2697 " from dma_map_sg. Config %d, seg_cnt"
2705 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd);
2707 switch (prot_group_type) {
2709 num_bde = lpfc_bg_setup_bpl(phba, scsi_cmnd, bpl,
2722 scsi_prot_sglist(scsi_cmnd),
2723 scsi_prot_sg_count(scsi_cmnd), datadir);
2733 "9068 BLKGRD: %s: Too many prot sg "
2734 "segments from dma_map_sg. Config %d,"
2735 "prot_seg_cnt %d\n", __func__,
2739 scsi_prot_sglist(scsi_cmnd),
2740 scsi_prot_sg_count(scsi_cmnd),
2746 num_bde = lpfc_bg_setup_bpl_prot(phba, scsi_cmnd, bpl,
2747 datasegcnt, protsegcnt);
2756 "9022 Unexpected protection group %i\n",
2771 iocb_cmd->
ulpLe = 1;
2773 fcpdl = scsi_bufflen(scsi_cmnd);
2781 blksize = lpfc_cmd_blksize(scsi_cmnd);
2782 diflen = (fcpdl / blksize) * 8;
2796 "9023 Could not setup all needed BDE's"
2797 "prot_group_type=%d, num_bde=%d\n",
2798 prot_group_type, num_bde);
2818 struct scsi_cmnd *cmd = lpfc_cmd->
pCmd;
2826 " 0x%x lba 0x%llx blk cnt 0x%x "
2827 "bgstat=0x%x bghm=0x%x\n",
2828 cmd->
cmnd[0], (
unsigned long long)scsi_get_lba(cmd),
2829 blk_rq_sectors(cmd->
request), bgstat, bghm);
2834 " Data for %u blocks to debugfs\n",
2835 (cmd->
cmnd[7] << 8 | cmd->
cmnd[8]));
2836 lpfc_debug_save_data(phba, cmd);
2839 if (lpfc_prot_group_type(phba, cmd) ==
2842 "Saving DIF for %u blocks to debugfs\n",
2843 (cmd->
cmnd[7] << 8 | cmd->
cmnd[8]));
2844 lpfc_debug_save_dif(phba, cmd);
2851 if (lpfc_bgs_get_invalid_prof(bgstat)) {
2854 " BlockGuard profile. bgstat:0x%x\n",
2860 if (lpfc_bgs_get_uninit_dif_block(bgstat)) {
2863 "Invalid BlockGuard DIF Block. bgstat:0x%x\n",
2869 if (lpfc_bgs_get_guard_err(bgstat)) {
2878 "9055 BLKGRD: guard_tag error\n");
2881 if (lpfc_bgs_get_reftag_err(bgstat)) {
2891 "9056 BLKGRD: ref_tag error\n");
2894 if (lpfc_bgs_get_apptag_err(bgstat)) {
2904 "9061 BLKGRD: app_tag error\n");
2907 if (lpfc_bgs_get_hi_water_mark_present(bgstat)) {
2920 switch (scsi_get_prot_op(cmd)) {
2923 bghm /= cmd->
device->sector_size;
2929 bghm /= (cmd->
device->sector_size +
2934 failing_sector = scsi_get_lba(cmd);
2935 failing_sector += bghm;
2945 "9057 BLKGRD: Unknown error reported!\n");
2967 struct scsi_cmnd *scsi_cmnd = lpfc_cmd->
pCmd;
2969 struct fcp_cmnd *fcp_cmnd = lpfc_cmd->
fcp_cmnd;
2986 if (scsi_sg_count(scsi_cmnd)) {
3000 bf_set(lpfc_sli4_sge_last, sgl, 0);
3003 first_data_sgl =
sgl;
3007 " %s: Too many sg segments from "
3008 "dma_map_sg. Config %d, seg_cnt %d\n",
3030 if ((num_bde + 1) == nseg)
3031 bf_set(lpfc_sli4_sge_last, sgl, 1);
3033 bf_set(lpfc_sli4_sge_last, sgl, 0);
3034 bf_set(lpfc_sli4_sge_offset, sgl, dma_offset);
3038 dma_offset += dma_len;
3045 bde->addrLow = first_data_sgl->
addr_lo;
3046 bde->addrHigh = first_data_sgl->addr_hi;
3047 bde->tus.f.bdeSize =
3056 bf_set(lpfc_sli4_sge_last, sgl, 1);
3087 lpfc_bg_scsi_adjust_dl(
struct lpfc_hba *phba,
3090 struct scsi_cmnd *sc = lpfc_cmd->
pCmd;
3094 fcpdl = scsi_bufflen(sc);
3109 blksize = lpfc_cmd_blksize(sc);
3110 diflen = (fcpdl / blksize) * 8;
3125 lpfc_bg_scsi_prep_dma_buf_s4(
struct lpfc_hba *phba,
3128 struct scsi_cmnd *scsi_cmnd = lpfc_cmd->
pCmd;
3129 struct fcp_cmnd *fcp_cmnd = lpfc_cmd->
fcp_cmnd;
3134 int prot_group_type = 0;
3141 if (scsi_sg_count(scsi_cmnd)) {
3149 scsi_sglist(scsi_cmnd),
3150 scsi_sg_count(scsi_cmnd), datadir);
3157 bf_set(lpfc_sli4_sge_last, sgl, 0);
3161 lpfc_cmd->
seg_cnt = datasegcnt;
3164 "9087 BLKGRD: %s: Too many sg segments"
3165 " from dma_map_sg. Config %d, seg_cnt"
3173 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd);
3175 switch (prot_group_type) {
3177 num_bde = lpfc_bg_setup_sgl(phba, scsi_cmnd, sgl,
3190 scsi_prot_sglist(scsi_cmnd),
3191 scsi_prot_sg_count(scsi_cmnd), datadir);
3201 "9088 BLKGRD: %s: Too many prot sg "
3202 "segments from dma_map_sg. Config %d,"
3203 "prot_seg_cnt %d\n", __func__,
3207 scsi_prot_sglist(scsi_cmnd),
3208 scsi_prot_sg_count(scsi_cmnd),
3214 num_bde = lpfc_bg_setup_sgl_prot(phba, scsi_cmnd, sgl,
3215 datasegcnt, protsegcnt);
3224 "9083 Unexpected protection group %i\n",
3230 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd);
3244 "9084 Could not setup all needed BDE's"
3245 "prot_group_type=%d, num_bde=%d\n",
3246 prot_group_type, num_bde);
3300 struct scsi_cmnd *cmnd = lpfc_cmd->
pCmd;
3307 unsigned long flags;
3377 spin_unlock_irqrestore(&phba->
hbalock, flags);
3403 scsi_prot_sg_count(psb->
pCmd),
3404 psb->
pCmd->sc_data_direction);
3421 struct scsi_cmnd *cmnd = lpfc_cmd->
pCmd;
3422 struct fcp_cmnd *fcpcmd = lpfc_cmd->
fcp_cmnd;
3445 if (rsplen != 0 && rsplen != 4 && rsplen != 8) {
3447 "2719 Invalid response length: "
3448 "tgt x%x lun x%x cmnd x%x rsplen x%x\n",
3457 "2757 Protocol failure detected during "
3458 "processing of FCP I/O op: "
3459 "tgt x%x lun x%x cmnd x%x rspInfo3 x%x\n",
3468 if ((resp_info & SNS_LEN_VALID) && fcprsp->
rspSnsLen) {
3473 if (resp_info & RSP_LEN_VALID)
3490 "9024 FCP command x%x failed: x%x SNS x%x x%x "
3491 "Data: x%x x%x x%x x%x x%x\n",
3492 cmnd->
cmnd[0], scsi_status,
3499 scsi_set_resid(cmnd, 0);
3500 if (resp_info & RESID_UNDER) {
3504 "9025 FCP Read Underrun, expected %d, "
3505 "residual %d Data: x%x x%x x%x\n",
3507 scsi_get_resid(cmnd), fcpi_parm, cmnd->
cmnd[0],
3517 (scsi_get_resid(cmnd) != fcpi_parm)) {
3520 "9026 FCP Read Check Error "
3521 "and Underrun Data: x%x x%x x%x x%x\n",
3523 scsi_get_resid(cmnd), fcpi_parm,
3525 scsi_set_resid(cmnd, scsi_bufflen(cmnd));
3534 if (!(resp_info & SNS_LEN_VALID) &&
3536 (scsi_bufflen(cmnd) - scsi_get_resid(cmnd)
3539 "9027 FCP command x%x residual "
3540 "underrun converted to error "
3541 "Data: x%x x%x x%x\n",
3542 cmnd->
cmnd[0], scsi_bufflen(cmnd),
3548 "9028 FCP command x%x residual overrun error. "
3549 "Data: x%x x%x\n", cmnd->
cmnd[0],
3550 scsi_bufflen(cmnd), scsi_get_resid(cmnd));
3557 }
else if (fcpi_parm) {
3559 "9029 FCP Data Transfer Check Error: "
3560 "x%x x%x x%x x%x x%x\n",
3563 fcpi_parm, cmnd->
cmnd[0], scsi_status);
3564 switch (scsi_status) {
3575 scsi_set_resid(cmnd, scsi_bufflen(cmnd));
3580 lpfc_send_scsi_error_event(vport->
phba, vport, lpfc_cmd, rsp_iocb);
3602 struct scsi_cmnd *cmd;
3606 unsigned long flags;
3615 cmd = lpfc_cmd->
pCmd;
3616 shost = cmd->
device->host;
3623 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
3624 if (lpfc_cmd->prot_data_type) {
3632 switch (lpfc_cmd->prot_data_type) {
3633 case LPFC_INJERR_REFTAG:
3635 lpfc_cmd->prot_data;
3637 case LPFC_INJERR_APPTAG:
3641 case LPFC_INJERR_GUARD:
3649 lpfc_cmd->prot_data = 0;
3650 lpfc_cmd->prot_data_type = 0;
3651 lpfc_cmd->prot_data_segment =
NULL;
3664 !lpfc_cmd->
fcp_rsp->rspStatus3 &&
3665 (lpfc_cmd->
fcp_rsp->rspStatus2 & RESID_UNDER) &&
3671 "9030 FCP cmd x%x failed <%d/%d> "
3672 "status: x%x result: x%x "
3673 "sid: x%x did: x%x oxid: x%x "
3681 lpfc_cmd->
cur_iocbq.sli4_xritag : 0xffff,
3685 switch (lpfc_cmd->
status) {
3688 lpfc_handle_fcp_err(vport, lpfc_cmd, pIocbOut);
3709 fast_path_evt->
vport = vport;
3715 spin_unlock_irqrestore(&phba->
hbalock, flags);
3744 lpfc_parse_bg_err(phba, lpfc_cmd,
3750 "9031 non-zero BGSTAT "
3751 "on unprotected cmd\n");
3782 "0710 Iodone <%d/%d> cmd %p, error "
3783 "x%x SNS x%x x%x Data: x%x x%x\n",
3786 scsi_get_resid(cmd));
3789 lpfc_update_stats(phba, lpfc_cmd);
3807 spin_unlock_irqrestore(shost->
host_lock, flags);
3820 spin_unlock_irqrestore(shost->
host_lock, flags);
3824 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);
3827 queue_depth = cmd->
device->queue_depth;
3834 spin_unlock_irqrestore(&phba->
hbalock, flags);
3841 if (lpfc_cmd->
waitq)
3843 spin_unlock_irqrestore(shost->
host_lock, flags);
3844 lpfc_release_scsi_buf(phba, lpfc_cmd);
3849 lpfc_rampup_queue_depth(vport, queue_depth);
3861 tmp_sdev->queue_depth-1);
3865 "0711 detected queue full - lun queue "
3866 "depth adjusted to %d.\n",
depth);
3867 lpfc_send_sdev_queuedepth_change_event(phba, vport,
3876 spin_unlock_irqrestore(&phba->
hbalock, flags);
3883 if (lpfc_cmd->
waitq)
3885 spin_unlock_irqrestore(shost->
host_lock, flags);
3887 lpfc_release_scsi_buf(phba, lpfc_cmd);
3899 lpfc_fcpcmd_to_iocb(
uint8_t *
data,
struct fcp_cmnd *fcp_cmnd)
3902 for (i = 0, j = 0; i <
sizeof(
struct fcp_cmnd);
3922 struct scsi_cmnd *scsi_cmnd = lpfc_cmd->
pCmd;
3923 struct fcp_cmnd *fcp_cmnd = lpfc_cmd->
fcp_cmnd;
3934 lpfc_cmd->
fcp_rsp->rspSnsLen = 0;
3941 ptr = &fcp_cmnd->
fcpCdb[0];
3948 if (scsi_populate_tag_msg(scsi_cmnd, tag)) {
3971 if (scsi_sg_count(scsi_cmnd)) {
3978 iocb_cmd->
ulpPU = 0;
3991 iocb_cmd->
ulpPU = 0;
3997 lpfc_fcpcmd_to_iocb(iocb_cmd->
unsli3.
fcp_ext.icd, fcp_cmnd);
4013 piocbq->
iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl;
4033 lpfc_scsi_prep_task_mgmt_cmd(
struct lpfc_vport *vport,
4051 piocb = &piocbq->
iocb;
4055 memset(fcp_cmnd, 0,
sizeof(
struct fcp_cmnd));
4057 fcp_cmnd->
fcpCntl2 = task_mgmt_cmd;
4058 if (vport->
phba->sli_rev == 3 &&
4073 if (lpfc_cmd->
timeout > 0xff) {
4083 lpfc_sli4_set_rsp_sgl_last(vport->
phba, lpfc_cmd);
4121 "1418 Invalid HBA PCI-device group: 0x%x\n",
4141 lpfc_tskmgmt_def_cmpl(
struct lpfc_hba *phba,
4148 lpfc_release_scsi_buf(phba, lpfc_cmd);
4167 static char lpfcinfobuf[384];
4169 memset(lpfcinfobuf,0,384);
4170 if (phba && phba->
pcidev){
4172 len =
strlen(lpfcinfobuf);
4175 " on PCI bus %02x device %02x irq %d",
4176 phba->
pcidev->bus->number,
4179 len =
strlen(lpfcinfobuf);
4180 if (phba->
Port[0]) {
4186 len =
strlen(lpfcinfobuf);
4190 if (phba->
sli4_hba.link_state.logical_speed)
4192 phba->
sli4_hba.link_state.logical_speed;
4197 snprintf(lpfcinfobuf + len, 384-len,
4212 unsigned long poll_tmo_expires =
4228 lpfc_poll_rearm_timer(phba);
4248 lpfc_poll_rearm_timer(phba);
4266 lpfc_queuecommand(
struct Scsi_Host *shost,
struct scsi_cmnd *cmnd)
4276 err = fc_remote_port_chkready(
rport);
4279 goto out_fail_command;
4281 ndlp = rdata->
pnode;
4287 "9058 BLKGRD: ERROR: rcvd protected cmd:%02x"
4288 " op:%02x str=%s without registering for"
4289 " BlockGuard - Rejecting command\n",
4290 cmnd->
cmnd[0], scsi_get_prot_op(cmnd),
4291 dif_op_str[scsi_get_prot_op(cmnd)]);
4292 goto out_fail_command;
4304 lpfc_cmd = lpfc_get_scsi_buf(phba, ndlp);
4305 if (lpfc_cmd ==
NULL) {
4309 "0707 driver's buffer pool is empty, "
4318 lpfc_cmd->
pCmd = cmnd;
4319 lpfc_cmd->
rdata = rdata;
4325 if (vport->
phba->cfg_enable_bg) {
4327 "9033 BLKGRD: rcvd %s cmd:x%x "
4328 "sector x%llx cnt %u pt %x\n",
4329 dif_op_str[scsi_get_prot_op(cmnd)],
4331 (
unsigned long long)scsi_get_lba(cmnd),
4332 blk_rq_sectors(cmnd->
request),
4333 (cmnd->
cmnd[1]>>5));
4335 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd);
4337 if (vport->
phba->cfg_enable_bg) {
4339 "9038 BLKGRD: rcvd PROT_NORMAL cmd: "
4340 "x%x sector x%llx cnt %u pt %x\n",
4342 (
unsigned long long)scsi_get_lba(cmnd),
4343 blk_rq_sectors(cmnd->
request),
4344 (cmnd->
cmnd[1]>>5));
4346 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd);
4350 goto out_host_busy_free_buf;
4352 lpfc_scsi_prep_cmnd(vport, lpfc_cmd, ndlp);
4359 goto out_host_busy_free_buf;
4366 lpfc_poll_rearm_timer(phba);
4371 out_host_busy_free_buf:
4372 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);
4373 lpfc_release_scsi_buf(phba, lpfc_cmd);
4397 lpfc_abort_handler(
struct scsi_cmnd *cmnd)
4406 int ret =
SUCCESS, status = 0;
4407 unsigned long flags;
4411 if (status != 0 && status !=
SUCCESS)
4417 spin_unlock_irqrestore(&phba->
hbalock, flags);
4419 "3168 SCSI Layer abort requested I/O has been "
4420 "flushed by LLD.\n");
4425 if (!lpfc_cmd || !lpfc_cmd->
pCmd) {
4426 spin_unlock_irqrestore(&phba->
hbalock, flags);
4428 "2873 SCSI Layer I/O Abort Request IO CMPL Status "
4429 "x%x ID %d LUN %d\n",
4437 spin_unlock_irqrestore(&phba->
hbalock, flags);
4439 "3169 SCSI Layer abort requested I/O has been "
4440 "cancelled by LLD.\n");
4449 if (lpfc_cmd->
pCmd != cmnd) {
4451 "3170 SCSI Layer abort requested I/O has been "
4452 "completed by LLD.\n");
4456 BUG_ON(iocb->context1 != lpfc_cmd);
4459 if (abtsiocb ==
NULL) {
4471 icmd = &abtsiocb->iocb;
4473 icmd->un.acxri.abortContextTag = cmd->ulpContext;
4475 icmd->un.acxri.abortIoTag = iocb->sli4_xritag;
4480 icmd->ulpClass = cmd->ulpClass;
4483 abtsiocb->fcp_wqidx = iocb->fcp_wqidx;
4486 if (lpfc_is_link_up(phba))
4492 abtsiocb->vport = vport;
4494 spin_unlock_irqrestore(&phba->
hbalock, flags);
4510 (lpfc_cmd->
pCmd != cmnd),
4514 if (lpfc_cmd->
pCmd == cmnd) {
4517 "0748 abort handler timed out waiting "
4518 "for abortng I/O (xri:x%x) to complete: "
4519 "ret %#x, ID %d, LUN %d\n",
4520 iocb->sli4_xritag, ret,
4526 spin_unlock_irqrestore(&phba->
hbalock, flags);
4529 "0749 SCSI Layer I/O Abort Request Status x%x ID %d "
4530 "LUN %d\n", ret, cmnd->
device->id,
4536 lpfc_taskmgmt_name(
uint8_t task_mgmt_cmd)
4538 switch (task_mgmt_cmd) {
4540 return "ABORT_TASK_SET";
4542 return "FCP_CLEAR_TASK_SET";
4544 return "FCP_BUS_RESET";
4546 return "FCP_LUN_RESET";
4548 return "FCP_TARGET_RESET";
4550 return "FCP_CLEAR_ACA";
4552 return "FCP_TERMINATE_TASK";
4575 unsigned tgt_id,
unsigned int lun_id,
4589 lpfc_cmd = lpfc_get_scsi_buf(phba, rdata->
pnode);
4590 if (lpfc_cmd ==
NULL)
4593 lpfc_cmd->
rdata = rdata;
4595 status = lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd, lun_id,
4598 lpfc_release_scsi_buf(phba, lpfc_cmd);
4604 if (iocbqrsp ==
NULL) {
4605 lpfc_release_scsi_buf(phba, lpfc_cmd);
4610 "0702 Issue %s to TGT %d LUN %d "
4611 "rpi x%x nlp_flag x%x Data: x%x x%x\n",
4612 lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id,
4617 iocbq, iocbqrsp, lpfc_cmd->
timeout);
4620 iocbq->
iocb_cmpl = lpfc_tskmgmt_def_cmpl;
4626 "0727 TMF %s to TGT %d LUN %d failed (%d, %d) "
4628 lpfc_taskmgmt_name(task_mgmt_cmd),
4640 lpfc_release_scsi_buf(phba, lpfc_cmd);
4658 lpfc_chk_tgt_mapped(
struct lpfc_vport *vport,
struct scsi_cmnd *cmnd)
4662 unsigned long later;
4666 "0797 Tgt Map rport failure: rdata x%p\n", rdata);
4669 pnode = rdata->
pnode;
4681 rdata = cmnd->
device->hostdata;
4684 pnode = rdata->
pnode;
4713 unsigned long later;
4719 tgt_id, lun_id, context);
4727 "0724 I/O flush failure for context %s : cnt x%x\n",
4749 lpfc_device_reset_handler(
struct scsi_cmnd *cmnd)
4755 unsigned tgt_id = cmnd->
device->id;
4756 unsigned int lun_id = cmnd->
device->lun;
4762 "0798 Device Reset rport failure: rdata x%p\n", rdata);
4765 pnode = rdata->
pnode;
4767 if (status != 0 && status !=
SUCCESS)
4770 status = lpfc_chk_tgt_mapped(vport, cmnd);
4773 "0721 Device Reset rport failure: rdata x%p\n", rdata);
4786 status = lpfc_send_taskmgmt(vport, rdata, tgt_id, lun_id,
4790 "0713 SCSI layer issued Device Reset (%d, %d) "
4791 "return x%x\n", tgt_id, lun_id, status);
4799 ret = lpfc_reset_flush_io_context(vport, tgt_id, lun_id,
4816 lpfc_target_reset_handler(
struct scsi_cmnd *cmnd)
4822 unsigned tgt_id = cmnd->
device->id;
4823 unsigned int lun_id = cmnd->
device->lun;
4829 "0799 Target Reset rport failure: rdata x%p\n", rdata);
4832 pnode = rdata->
pnode;
4834 if (status != 0 && status !=
SUCCESS)
4837 status = lpfc_chk_tgt_mapped(vport, cmnd);
4840 "0722 Target Reset rport failure: rdata x%p\n", rdata);
4853 status = lpfc_send_taskmgmt(vport, rdata, tgt_id, lun_id,
4857 "0723 SCSI layer issued Target Reset (%d, %d) "
4858 "return x%x\n", tgt_id, lun_id, status);
4866 ret = lpfc_reset_flush_io_context(vport, tgt_id, lun_id,
4883 lpfc_bus_reset_handler(
struct scsi_cmnd *cmnd)
4902 if (status != 0 && status !=
SUCCESS)
4928 status = lpfc_send_taskmgmt(vport, ndlp->
rport->dd_data,
4933 "0700 Bus Reset on target %d failed\n",
4945 status = lpfc_reset_flush_io_context(vport, 0, 0,
LPFC_CTX_HOST);
4950 "0714 SCSI layer issued Bus Reset Data: x%x\n", ret);
4971 lpfc_host_reset_handler(
struct scsi_cmnd *cmnd)
4987 "3172 SCSI layer issued Host Reset Data: x%x\n", ret);
5012 int num_allocated = 0;
5015 if (!
rport || fc_remote_port_chkready(
rport))
5038 "0704 At limitation of %d preallocated "
5039 "command buffers\n", total);
5042 }
else if (total + num_to_alloc >
5045 "0705 Allocation request of %d "
5046 "command buffers will exceed max of %d. "
5047 "Reducing allocation request to %d.\n",
5052 num_allocated = lpfc_new_scsi_buf(vport, num_to_alloc);
5053 if (num_to_alloc != num_allocated) {
5055 "0708 Allocation request of %d "
5056 "command buffers did not succeed. "
5057 "Allocated %d buffers.\n",
5058 num_to_alloc, num_allocated);
5060 if (num_allocated > 0)
5091 lpfc_poll_rearm_timer(phba);
5118 .queuecommand = lpfc_queuecommand,
5119 .eh_abort_handler = lpfc_abort_handler,
5120 .eh_device_reset_handler = lpfc_device_reset_handler,
5121 .eh_target_reset_handler = lpfc_target_reset_handler,
5122 .eh_bus_reset_handler = lpfc_bus_reset_handler,
5123 .eh_host_reset_handler = lpfc_host_reset_handler,
5124 .slave_alloc = lpfc_slave_alloc,
5125 .slave_configure = lpfc_slave_configure,
5126 .slave_destroy = lpfc_slave_destroy,
5133 .max_sectors = 0xFFFF,
5142 .queuecommand = lpfc_queuecommand,
5143 .eh_abort_handler = lpfc_abort_handler,
5144 .eh_device_reset_handler = lpfc_device_reset_handler,
5145 .eh_target_reset_handler = lpfc_target_reset_handler,
5146 .eh_bus_reset_handler = lpfc_bus_reset_handler,
5147 .slave_alloc = lpfc_slave_alloc,
5148 .slave_configure = lpfc_slave_configure,
5149 .slave_destroy = lpfc_slave_destroy,
5156 .max_sectors = 0xFFFF,