Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6: (25 commits)
[SCSI] mptfc: race between mptfc_register_dev and mptfc_target_alloc
[SCSI] lpfc 8.1.6 : Fix Data Corruption in Bus Reset Path
[SCSI] mptspi: revalidate negotiation parameters after host reset and resume
[SCSI] srp.h: avoid padding of structs
[SCSI] ibmvscsi: fix leak when failing to send srp event
[SCSI] qla2xxx: Correct eh_abort recovery logic.
[SCSI] megaraid_{mm,mbox}: fix a bug in reset handler
[SCSI] fusion - bug fix stack overflow in mptbase
[SCSI] scsi: Add IBM 2104-DU3 to blist
[SCSI] Fix DVD burning issues.
[SCSI] SCSI: aic7xxx_osm_pci resource leak fix.
[SCSI] - fusion - mptfc bug fix's to prevent deadlock situations
[SCSI] mptfusion: bug fix's for raid components adding/deleting
[SCSI] aic7xxx: ahc_pci_write_config() fix
[SCSI] megaraid: unused variable
[SCSI] qla2xxx: only free_irq() after request_irq() succeeds
[SCSI] Overrun in drivers/scsi/sim710.c
[SCSI] lpfc 8.1.5 : Change version number to 8.1.5
[SCSI] lpfc 8.1.5 : Misc small fixes
[SCSI] lpfc 8.1.5 : Additional fixes to LOGO, PLOGI, and RSCN processing
...

+633 -384
+25
Documentation/scsi/ChangeLog.megaraid
··· 1 + Release Date : Mon Apr 11 12:27:22 EST 2006 - Seokmann Ju <sju@lsil.com> 2 + Current Version : 2.20.4.8 (scsi module), 2.20.2.6 (cmm module) 3 + Older Version : 2.20.4.7 (scsi module), 2.20.2.6 (cmm module) 4 + 5 + 1. Fixed a bug in megaraid_reset_handler(). 6 + Customer reported "Unable to handle kernel NULL pointer dereference 7 + at virtual address 00000000" when system goes to reset condition 8 + for some reason. It happened randomly. 9 + Root Cause: in the megaraid_reset_handler(), there is possibility not 10 + returning pending packets in the pend_list if there are multiple 11 + pending packets. 12 + Fix: Made the change in the driver so that it will return all packets 13 + in the pend_list. 14 + 15 + 2. Added change request. 16 + As found in the following URL, rmb() only didn't help the 17 + problem. I had to increase the loop counter to 0xFFFFFF. (6 F's) 18 + http://marc.theaimsgroup.com/?l=linux-scsi&m=110971060502497&w=2 19 + 20 + I attached a patch for your reference, too. 21 + Could you check and get this fix in your driver? 22 + 23 + Best Regards, 24 + Jun'ichi Nomura 25 + 1 26 Release Date : Fri Nov 11 12:27:22 EST 2005 - Seokmann Ju <sju@lsil.com> 2 27 Current Version : 2.20.4.7 (scsi module), 2.20.2.6 (cmm module) 3 28 Older Version : 2.20.4.6 (scsi module), 2.20.2.6 (cmm module)
+37 -26
drivers/message/fusion/mptbase.c
··· 1189 1189 ioc->diagPending = 0; 1190 1190 spin_lock_init(&ioc->diagLock); 1191 1191 spin_lock_init(&ioc->fc_rescan_work_lock); 1192 - spin_lock_init(&ioc->fc_rport_lock); 1193 1192 spin_lock_init(&ioc->initializing_hba_lock); 1194 1193 1195 1194 /* Initialize the event logging. ··· 5735 5736 return rc; 5736 5737 } 5737 5738 5739 + # define EVENT_DESCR_STR_SZ 100 5740 + 5738 5741 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5739 5742 static void 5740 5743 EventDescriptionStr(u8 event, u32 evData0, char *evStr) 5741 5744 { 5742 - char *ds; 5745 + char *ds = NULL; 5743 5746 5744 5747 switch(event) { 5745 5748 case MPI_EVENT_NONE: ··· 5778 5777 if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LIP) 5779 5778 ds = "Loop State(LIP) Change"; 5780 5779 else if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LPE) 5781 - ds = "Loop State(LPE) Change"; /* ??? */ 5780 + ds = "Loop State(LPE) Change"; /* ??? */ 5782 5781 else 5783 - ds = "Loop State(LPB) Change"; /* ??? */ 5782 + ds = "Loop State(LPB) Change"; /* ??? */ 5784 5783 break; 5785 5784 case MPI_EVENT_LOGOUT: 5786 5785 ds = "Logout"; ··· 5842 5841 break; 5843 5842 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: 5844 5843 { 5845 - char buf[50]; 5846 5844 u8 id = (u8)(evData0); 5847 5845 u8 ReasonCode = (u8)(evData0 >> 16); 5848 5846 switch (ReasonCode) { 5849 5847 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: 5850 - sprintf(buf,"SAS Device Status Change: Added: id=%d", id); 5848 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5849 + "SAS Device Status Change: Added: id=%d", id); 5851 5850 break; 5852 5851 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: 5853 - sprintf(buf,"SAS Device Status Change: Deleted: id=%d", id); 5852 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5853 + "SAS Device Status Change: Deleted: id=%d", id); 5854 5854 break; 5855 5855 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA: 5856 - sprintf(buf,"SAS Device Status Change: SMART Data: id=%d", id); 5856 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5857 + "SAS Device Status Change: SMART Data: id=%d", 5858 + id); 5857 5859 break; 5858 5860 case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED: 5859 - sprintf(buf,"SAS Device Status Change: No Persistancy Added: id=%d", id); 5861 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5862 + "SAS Device Status Change: No Persistancy " 5863 + "Added: id=%d", id); 5860 5864 break; 5861 5865 default: 5862 - sprintf(buf,"SAS Device Status Change: Unknown: id=%d", id); 5863 - break; 5866 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5867 + "SAS Device Status Change: Unknown: id=%d", id); 5868 + break; 5864 5869 } 5865 - ds = buf; 5866 5870 break; 5867 5871 } 5868 5872 case MPI_EVENT_ON_BUS_TIMER_EXPIRED: ··· 5884 5878 break; 5885 5879 case MPI_EVENT_SAS_PHY_LINK_STATUS: 5886 5880 { 5887 - char buf[50]; 5888 5881 u8 LinkRates = (u8)(evData0 >> 8); 5889 5882 u8 PhyNumber = (u8)(evData0); 5890 5883 LinkRates = (LinkRates & MPI_EVENT_SAS_PLS_LR_CURRENT_MASK) >> 5891 5884 MPI_EVENT_SAS_PLS_LR_CURRENT_SHIFT; 5892 5885 switch (LinkRates) { 5893 5886 case MPI_EVENT_SAS_PLS_LR_RATE_UNKNOWN: 5894 - sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5887 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5888 + "SAS PHY Link Status: Phy=%d:" 5895 5889 " Rate Unknown",PhyNumber); 5896 5890 break; 5897 5891 case MPI_EVENT_SAS_PLS_LR_RATE_PHY_DISABLED: 5898 - sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5892 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5893 + "SAS PHY Link Status: Phy=%d:" 5899 5894 " Phy Disabled",PhyNumber); 5900 5895 break; 5901 5896 case MPI_EVENT_SAS_PLS_LR_RATE_FAILED_SPEED_NEGOTIATION: 5902 - sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5897 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5898 + "SAS PHY Link Status: Phy=%d:" 5903 5899 " Failed Speed Nego",PhyNumber); 5904 5900 break; 5905 5901 case MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE: 5906 - sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5902 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5903 + "SAS PHY Link Status: Phy=%d:" 5907 5904 " Sata OOB Completed",PhyNumber); 5908 5905 break; 5909 5906 case MPI_EVENT_SAS_PLS_LR_RATE_1_5: 5910 - sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5907 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5908 + "SAS PHY Link Status: Phy=%d:" 5911 5909 " Rate 1.5 Gbps",PhyNumber); 5912 5910 break; 5913 5911 case MPI_EVENT_SAS_PLS_LR_RATE_3_0: 5914 - sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5912 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5913 + "SAS PHY Link Status: Phy=%d:" 5915 5914 " Rate 3.0 Gpbs",PhyNumber); 5916 5915 break; 5917 5916 default: 5918 - sprintf(buf,"SAS PHY Link Status: Phy=%d", PhyNumber); 5917 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5918 + "SAS PHY Link Status: Phy=%d", PhyNumber); 5919 5919 break; 5920 5920 } 5921 - ds = buf; 5922 5921 break; 5923 5922 } 5924 5923 case MPI_EVENT_SAS_DISCOVERY_ERROR: ··· 5932 5921 case MPI_EVENT_IR_RESYNC_UPDATE: 5933 5922 { 5934 5923 u8 resync_complete = (u8)(evData0 >> 16); 5935 - char buf[40]; 5936 - sprintf(buf,"IR Resync Update: Complete = %d:",resync_complete); 5937 - ds = buf; 5924 + snprintf(evStr, EVENT_DESCR_STR_SZ, 5925 + "IR Resync Update: Complete = %d:",resync_complete); 5938 5926 break; 5939 5927 } 5940 5928 case MPI_EVENT_IR2: ··· 5986 5976 ds = "Unknown"; 5987 5977 break; 5988 5978 } 5989 - strcpy(evStr,ds); 5979 + if (ds) 5980 + strncpy(evStr, ds, EVENT_DESCR_STR_SZ); 5990 5981 } 5991 5982 5992 5983 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ ··· 6009 5998 int ii; 6010 5999 int r = 0; 6011 6000 int handlers = 0; 6012 - char evStr[100]; 6001 + char evStr[EVENT_DESCR_STR_SZ]; 6013 6002 u8 event; 6014 6003 6015 6004 /*
+4 -6
drivers/message/fusion/mptbase.h
··· 76 76 #define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR 77 77 #endif 78 78 79 - #define MPT_LINUX_VERSION_COMMON "3.03.08" 80 - #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.08" 79 + #define MPT_LINUX_VERSION_COMMON "3.03.09" 80 + #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.09" 81 81 #define WHAT_MAGIC_STRING "@" "(" "#" ")" 82 82 83 83 #define show_mptmod_ver(s,ver) \ ··· 489 489 490 490 #define MPT_RPORT_INFO_FLAGS_REGISTERED 0x01 /* rport registered */ 491 491 #define MPT_RPORT_INFO_FLAGS_MISSING 0x02 /* missing from DevPage0 scan */ 492 - #define MPT_RPORT_INFO_FLAGS_MAPPED_VDEV 0x04 /* target mapped in vdev */ 493 492 494 493 /* 495 494 * data allocated for each fc rport device ··· 500 501 struct scsi_target *starget; 501 502 FCDevicePage0_t pg0; 502 503 u8 flags; 503 - u8 remap_needed; 504 504 }; 505 505 506 506 /* ··· 626 628 struct work_struct mptscsih_persistTask; 627 629 628 630 struct list_head fc_rports; 629 - spinlock_t fc_rport_lock; /* list and ri flags */ 630 631 spinlock_t fc_rescan_work_lock; 631 632 int fc_rescan_work_count; 632 633 struct work_struct fc_rescan_work; 633 - 634 + char fc_rescan_work_q_name[KOBJ_NAME_LEN]; 635 + struct workqueue_struct *fc_rescan_work_q; 634 636 } MPT_ADAPTER; 635 637 636 638 /*
+84 -52
drivers/message/fusion/mptfc.c
··· 341 341 rid->port_name = ((u64)pg0->WWPN.High) << 32 | (u64)pg0->WWPN.Low; 342 342 rid->port_id = pg0->PortIdentifier; 343 343 rid->roles = FC_RPORT_ROLE_UNKNOWN; 344 - rid->roles |= FC_RPORT_ROLE_FCP_TARGET; 345 - if (pg0->Protocol & MPI_FC_DEVICE_PAGE0_PROT_FCP_INITIATOR) 346 - rid->roles |= FC_RPORT_ROLE_FCP_INITIATOR; 347 344 348 345 return 0; 349 346 } ··· 352 355 struct fc_rport *rport; 353 356 struct mptfc_rport_info *ri; 354 357 int new_ri = 1; 355 - u64 pn; 356 - unsigned long flags; 358 + u64 pn, nn; 357 359 VirtTarget *vtarget; 360 + u32 roles = FC_RPORT_ROLE_UNKNOWN; 358 361 359 362 if (mptfc_generate_rport_ids(pg0, &rport_ids) < 0) 360 363 return; 361 364 365 + roles |= FC_RPORT_ROLE_FCP_TARGET; 366 + if (pg0->Protocol & MPI_FC_DEVICE_PAGE0_PROT_FCP_INITIATOR) 367 + roles |= FC_RPORT_ROLE_FCP_INITIATOR; 368 + 362 369 /* scan list looking for a match */ 363 - spin_lock_irqsave(&ioc->fc_rport_lock, flags); 364 370 list_for_each_entry(ri, &ioc->fc_rports, list) { 365 371 pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; 366 372 if (pn == rport_ids.port_name) { /* match */ ··· 373 373 } 374 374 } 375 375 if (new_ri) { /* allocate one */ 376 - spin_unlock_irqrestore(&ioc->fc_rport_lock, flags); 377 376 ri = kzalloc(sizeof(struct mptfc_rport_info), GFP_KERNEL); 378 377 if (!ri) 379 378 return; 380 - spin_lock_irqsave(&ioc->fc_rport_lock, flags); 381 379 list_add_tail(&ri->list, &ioc->fc_rports); 382 380 } 383 381 ··· 385 387 /* MPT_RPORT_INFO_FLAGS_REGISTERED - rport not previously deleted */ 386 388 if (!(ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED)) { 387 389 ri->flags |= MPT_RPORT_INFO_FLAGS_REGISTERED; 388 - spin_unlock_irqrestore(&ioc->fc_rport_lock, flags); 389 390 rport = fc_remote_port_add(ioc->sh, channel, &rport_ids); 390 - spin_lock_irqsave(&ioc->fc_rport_lock, flags); 391 391 if (rport) { 392 392 ri->rport = rport; 393 393 if (new_ri) /* may have been reset by user */ 394 394 rport->dev_loss_tmo = mptfc_dev_loss_tmo; 395 - *((struct mptfc_rport_info **)rport->dd_data) = ri; 396 395 /* 397 396 * if already mapped, remap here. If not mapped, 398 397 * target_alloc will allocate vtarget and map, ··· 401 406 vtarget->target_id = pg0->CurrentTargetID; 402 407 vtarget->bus_id = pg0->CurrentBus; 403 408 } 404 - ri->remap_needed = 0; 405 409 } 410 + *((struct mptfc_rport_info **)rport->dd_data) = ri; 411 + /* scan will be scheduled once rport becomes a target */ 412 + fc_remote_port_rolechg(rport,roles); 413 + 414 + pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; 415 + nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low; 406 416 dfcprintk ((MYIOC_s_INFO_FMT 407 417 "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, " 408 418 "rport tid %d, tmo %d\n", 409 419 ioc->name, 410 420 ioc->sh->host_no, 411 421 pg0->PortIdentifier, 412 - pg0->WWNN, 413 - pg0->WWPN, 422 + (unsigned long long)nn, 423 + (unsigned long long)pn, 414 424 pg0->CurrentTargetID, 415 425 ri->rport->scsi_target_id, 416 426 ri->rport->dev_loss_tmo)); ··· 425 425 ri = NULL; 426 426 } 427 427 } 428 - spin_unlock_irqrestore(&ioc->fc_rport_lock,flags); 429 - 430 428 } 431 429 432 430 /* ··· 474 476 vtarget->target_id = ri->pg0.CurrentTargetID; 475 477 vtarget->bus_id = ri->pg0.CurrentBus; 476 478 ri->starget = starget; 477 - ri->remap_needed = 0; 478 479 rc = 0; 479 480 } 480 481 } ··· 499 502 VirtDevice *vdev; 500 503 struct scsi_target *starget; 501 504 struct fc_rport *rport; 502 - unsigned long flags; 503 505 504 506 505 - rport = starget_to_rport(scsi_target(sdev)); 507 + starget = scsi_target(sdev); 508 + rport = starget_to_rport(starget); 506 509 507 510 if (!rport || fc_remote_port_chkready(rport)) 508 511 return -ENXIO; ··· 516 519 return -ENOMEM; 517 520 } 518 521 519 - spin_lock_irqsave(&hd->ioc->fc_rport_lock,flags); 520 522 521 523 sdev->hostdata = vdev; 522 - starget = scsi_target(sdev); 523 524 vtarget = starget->hostdata; 524 525 525 526 if (vtarget->num_luns == 0) { ··· 530 535 vdev->vtarget = vtarget; 531 536 vdev->lun = sdev->lun; 532 537 533 - spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags); 534 - 535 538 vtarget->num_luns++; 536 539 540 + 537 541 #ifdef DMPT_DEBUG_FC 538 - { 542 + { 543 + u64 nn, pn; 539 544 struct mptfc_rport_info *ri; 540 545 ri = *((struct mptfc_rport_info **)rport->dd_data); 546 + pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; 547 + nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low; 541 548 dfcprintk ((MYIOC_s_INFO_FMT 542 549 "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, " 543 550 "CurrentTargetID %d, %x %llx %llx\n", ··· 547 550 sdev->host->host_no, 548 551 vtarget->num_luns, 549 552 sdev->id, ri->pg0.CurrentTargetID, 550 - ri->pg0.PortIdentifier, ri->pg0.WWPN, ri->pg0.WWNN)); 553 + ri->pg0.PortIdentifier, 554 + (unsigned long long)pn, 555 + (unsigned long long)nn)); 551 556 } 552 557 #endif 553 558 ··· 569 570 done(SCpnt); 570 571 return 0; 571 572 } 572 - ri = *((struct mptfc_rport_info **)rport->dd_data); 573 - if (unlikely(ri->remap_needed)) 574 - return SCSI_MLQUEUE_HOST_BUSY; 575 573 576 - return mptscsih_qcmd(SCpnt,done); 574 + /* dd_data is null until finished adding target */ 575 + ri = *((struct mptfc_rport_info **)rport->dd_data); 576 + if (unlikely(!ri)) { 577 + dfcprintk ((MYIOC_s_INFO_FMT 578 + "mptfc_qcmd.%d: %d:%d, dd_data is null.\n", 579 + ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name, 580 + ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no, 581 + SCpnt->device->id,SCpnt->device->lun)); 582 + SCpnt->result = DID_IMM_RETRY << 16; 583 + done(SCpnt); 584 + return 0; 585 + } 586 + 587 + err = mptscsih_qcmd(SCpnt,done); 588 + #ifdef DMPT_DEBUG_FC 589 + if (unlikely(err)) { 590 + dfcprintk ((MYIOC_s_INFO_FMT 591 + "mptfc_qcmd.%d: %d:%d, mptscsih_qcmd returns non-zero.\n", 592 + ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name, 593 + ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no, 594 + SCpnt->device->id,SCpnt->device->lun)); 595 + } 596 + #endif 597 + return err; 577 598 } 578 599 579 600 static void ··· 634 615 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; 635 616 int ii; 636 617 int work_to_do; 618 + u64 pn; 637 619 unsigned long flags; 638 620 struct mptfc_rport_info *ri; 639 621 640 622 do { 641 623 /* start by tagging all ports as missing */ 642 - spin_lock_irqsave(&ioc->fc_rport_lock,flags); 643 624 list_for_each_entry(ri, &ioc->fc_rports, list) { 644 625 if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) { 645 626 ri->flags |= MPT_RPORT_INFO_FLAGS_MISSING; 646 627 } 647 628 } 648 - spin_unlock_irqrestore(&ioc->fc_rport_lock,flags); 649 629 650 630 /* 651 631 * now rescan devices known to adapter, ··· 657 639 } 658 640 659 641 /* delete devices still missing */ 660 - spin_lock_irqsave(&ioc->fc_rport_lock, flags); 661 642 list_for_each_entry(ri, &ioc->fc_rports, list) { 662 643 /* if newly missing, delete it */ 663 - if ((ri->flags & (MPT_RPORT_INFO_FLAGS_REGISTERED | 664 - MPT_RPORT_INFO_FLAGS_MISSING)) 665 - == (MPT_RPORT_INFO_FLAGS_REGISTERED | 666 - MPT_RPORT_INFO_FLAGS_MISSING)) { 644 + if (ri->flags & MPT_RPORT_INFO_FLAGS_MISSING) { 667 645 668 646 ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED| 669 647 MPT_RPORT_INFO_FLAGS_MISSING); 670 - ri->remap_needed = 1; 671 - fc_remote_port_delete(ri->rport); 672 - /* 673 - * remote port not really deleted 'cause 674 - * binding is by WWPN and driver only 675 - * registers FCP_TARGETs but cannot trust 676 - * data structures. 677 - */ 648 + fc_remote_port_delete(ri->rport); /* won't sleep */ 678 649 ri->rport = NULL; 650 + 651 + pn = (u64)ri->pg0.WWPN.High << 32 | 652 + (u64)ri->pg0.WWPN.Low; 679 653 dfcprintk ((MYIOC_s_INFO_FMT 680 654 "mptfc_rescan.%d: %llx deleted\n", 681 655 ioc->name, 682 656 ioc->sh->host_no, 683 - ri->pg0.WWPN)); 657 + (unsigned long long)pn)); 684 658 } 685 659 } 686 - spin_unlock_irqrestore(&ioc->fc_rport_lock,flags); 687 660 688 661 /* 689 662 * allow multiple passes as target state ··· 879 870 goto out_mptfc_probe; 880 871 } 881 872 882 - for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { 883 - mptfc_init_host_attr(ioc,ii); 884 - mptfc_GetFcDevPage0(ioc,ii,mptfc_register_dev); 885 - } 873 + /* initialize workqueue */ 874 + 875 + snprintf(ioc->fc_rescan_work_q_name, KOBJ_NAME_LEN, "mptfc_wq_%d", 876 + sh->host_no); 877 + ioc->fc_rescan_work_q = 878 + create_singlethread_workqueue(ioc->fc_rescan_work_q_name); 879 + if (!ioc->fc_rescan_work_q) 880 + goto out_mptfc_probe; 881 + 882 + /* 883 + * scan for rports - 884 + * by doing it via the workqueue, some locking is eliminated 885 + */ 886 + 887 + ioc->fc_rescan_work_count = 1; 888 + queue_work(ioc->fc_rescan_work_q, &ioc->fc_rescan_work); 889 + flush_workqueue(ioc->fc_rescan_work_q); 886 890 887 891 return 0; 888 892 ··· 971 949 static void __devexit 972 950 mptfc_remove(struct pci_dev *pdev) 973 951 { 974 - MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 975 - struct mptfc_rport_info *p, *n; 952 + MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 953 + struct mptfc_rport_info *p, *n; 954 + struct workqueue_struct *work_q; 955 + unsigned long flags; 956 + 957 + /* destroy workqueue */ 958 + if ((work_q=ioc->fc_rescan_work_q)) { 959 + spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); 960 + ioc->fc_rescan_work_q = NULL; 961 + spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); 962 + destroy_workqueue(work_q); 963 + } 976 964 977 965 fc_remove_host(ioc->sh); 978 966
+71 -28
drivers/message/fusion/mptsas.c
··· 91 91 MPTSAS_DEL_DEVICE, 92 92 MPTSAS_ADD_RAID, 93 93 MPTSAS_DEL_RAID, 94 + MPTSAS_IGNORE_EVENT, 94 95 }; 95 96 96 97 struct mptsas_hotplug_event { ··· 297 296 } 298 297 out: 299 298 return rc; 299 + } 300 + 301 + /* 302 + * Returns true if there is a scsi end device 303 + */ 304 + static inline int 305 + mptsas_is_end_device(struct mptsas_devinfo * attached) 306 + { 307 + if ((attached->handle) && 308 + (attached->device_info & 309 + MPI_SAS_DEVICE_INFO_END_DEVICE) && 310 + ((attached->device_info & 311 + MPI_SAS_DEVICE_INFO_SSP_TARGET) | 312 + (attached->device_info & 313 + MPI_SAS_DEVICE_INFO_STP_TARGET) | 314 + (attached->device_info & 315 + MPI_SAS_DEVICE_INFO_SATA_DEVICE))) 316 + return 1; 317 + else 318 + return 0; 300 319 } 301 320 302 321 static int ··· 893 872 SasDevicePage0_t *buffer; 894 873 dma_addr_t dma_handle; 895 874 __le64 sas_address; 896 - int error; 875 + int error=0; 876 + 877 + if (ioc->sas_discovery_runtime && 878 + mptsas_is_end_device(device_info)) 879 + goto out; 897 880 898 881 hdr.PageVersion = MPI_SASDEVICE0_PAGEVERSION; 899 882 hdr.ExtPageLength = 0; ··· 1034 1009 CONFIGPARMS cfg; 1035 1010 SasExpanderPage1_t *buffer; 1036 1011 dma_addr_t dma_handle; 1037 - int error; 1012 + int error=0; 1013 + 1014 + if (ioc->sas_discovery_runtime && 1015 + mptsas_is_end_device(&phy_info->attached)) 1016 + goto out; 1038 1017 1039 1018 hdr.PageVersion = MPI_SASEXPANDER0_PAGEVERSION; 1040 1019 hdr.ExtPageLength = 0; ··· 1095 1066 buffer, dma_handle); 1096 1067 out: 1097 1068 return error; 1098 - } 1099 - 1100 - /* 1101 - * Returns true if there is a scsi end device 1102 - */ 1103 - static inline int 1104 - mptsas_is_end_device(struct mptsas_devinfo * attached) 1105 - { 1106 - if ((attached->handle) && 1107 - (attached->device_info & 1108 - MPI_SAS_DEVICE_INFO_END_DEVICE) && 1109 - ((attached->device_info & 1110 - MPI_SAS_DEVICE_INFO_SSP_TARGET) | 1111 - (attached->device_info & 1112 - MPI_SAS_DEVICE_INFO_STP_TARGET) | 1113 - (attached->device_info & 1114 - MPI_SAS_DEVICE_INFO_SATA_DEVICE))) 1115 - return 1; 1116 - else 1117 - return 0; 1118 1069 } 1119 1070 1120 1071 static void ··· 1746 1737 break; 1747 1738 case MPTSAS_ADD_DEVICE: 1748 1739 1740 + if (ev->phys_disk_num_valid) 1741 + mpt_findImVolumes(ioc); 1742 + 1749 1743 /* 1750 1744 * Refresh sas device pg0 data 1751 1745 */ ··· 1880 1868 scsi_device_put(sdev); 1881 1869 mpt_findImVolumes(ioc); 1882 1870 break; 1871 + case MPTSAS_IGNORE_EVENT: 1872 + default: 1873 + break; 1883 1874 } 1884 1875 1885 1876 kfree(ev); ··· 1955 1940 EVENT_DATA_RAID *raid_event_data) 1956 1941 { 1957 1942 struct mptsas_hotplug_event *ev; 1958 - RAID_VOL0_STATUS * volumeStatus; 1943 + int status = le32_to_cpu(raid_event_data->SettingsStatus); 1944 + int state = (status >> 8) & 0xff; 1959 1945 1960 1946 if (ioc->bus_type != SAS) 1961 1947 return; ··· 1971 1955 INIT_WORK(&ev->work, mptsas_hotplug_work, ev); 1972 1956 ev->ioc = ioc; 1973 1957 ev->id = raid_event_data->VolumeID; 1958 + ev->event_type = MPTSAS_IGNORE_EVENT; 1974 1959 1975 1960 switch (raid_event_data->ReasonCode) { 1976 1961 case MPI_EVENT_RAID_RC_PHYSDISK_DELETED: ··· 1983 1966 ev->phys_disk_num = raid_event_data->PhysDiskNum; 1984 1967 ev->event_type = MPTSAS_DEL_DEVICE; 1985 1968 break; 1969 + case MPI_EVENT_RAID_RC_PHYSDISK_STATUS_CHANGED: 1970 + switch (state) { 1971 + case MPI_PD_STATE_ONLINE: 1972 + ioc->raid_data.isRaid = 1; 1973 + ev->phys_disk_num_valid = 1; 1974 + ev->phys_disk_num = raid_event_data->PhysDiskNum; 1975 + ev->event_type = MPTSAS_ADD_DEVICE; 1976 + break; 1977 + case MPI_PD_STATE_MISSING: 1978 + case MPI_PD_STATE_NOT_COMPATIBLE: 1979 + case MPI_PD_STATE_OFFLINE_AT_HOST_REQUEST: 1980 + case MPI_PD_STATE_FAILED_AT_HOST_REQUEST: 1981 + case MPI_PD_STATE_OFFLINE_FOR_ANOTHER_REASON: 1982 + ev->event_type = MPTSAS_DEL_DEVICE; 1983 + break; 1984 + default: 1985 + break; 1986 + } 1987 + break; 1986 1988 case MPI_EVENT_RAID_RC_VOLUME_DELETED: 1987 1989 ev->event_type = MPTSAS_DEL_RAID; 1988 1990 break; ··· 2009 1973 ev->event_type = MPTSAS_ADD_RAID; 2010 1974 break; 2011 1975 case MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED: 2012 - volumeStatus = (RAID_VOL0_STATUS *) & 2013 - raid_event_data->SettingsStatus; 2014 - ev->event_type = (volumeStatus->State == 2015 - MPI_RAIDVOL0_STATUS_STATE_FAILED) ? 2016 - MPTSAS_DEL_RAID : MPTSAS_ADD_RAID; 1976 + switch (state) { 1977 + case MPI_RAIDVOL0_STATUS_STATE_FAILED: 1978 + case MPI_RAIDVOL0_STATUS_STATE_MISSING: 1979 + ev->event_type = MPTSAS_DEL_RAID; 1980 + break; 1981 + case MPI_RAIDVOL0_STATUS_STATE_OPTIMAL: 1982 + case MPI_RAIDVOL0_STATUS_STATE_DEGRADED: 1983 + ev->event_type = MPTSAS_ADD_RAID; 1984 + break; 1985 + default: 1986 + break; 1987 + } 2017 1988 break; 2018 1989 default: 2019 1990 break;
+27 -23
drivers/message/fusion/mptscsih.c
··· 632 632 633 633 case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */ 634 634 /* Spoof to SCSI Selection Timeout! */ 635 - sc->result = DID_NO_CONNECT << 16; 635 + if (ioc->bus_type != FC) 636 + sc->result = DID_NO_CONNECT << 16; 637 + /* else fibre, just stall until rescan event */ 638 + else 639 + sc->result = DID_REQUEUE << 16; 636 640 637 641 if (hd->sel_timeout[pScsiReq->TargetID] < 0xFFFF) 638 642 hd->sel_timeout[pScsiReq->TargetID]++; ··· 881 877 struct scsi_cmnd *sc; 882 878 883 879 dsprintk((KERN_INFO MYNAM ": search_running target %d lun %d max %d\n", 884 - vdevice->target_id, vdevice->lun, max)); 880 + vdevice->vtarget->target_id, vdevice->lun, max)); 885 881 886 882 for (ii=0; ii < max; ii++) { 887 883 if ((sc = hd->ScsiLookup[ii]) != NULL) { ··· 1649 1645 mptscsih_abort(struct scsi_cmnd * SCpnt) 1650 1646 { 1651 1647 MPT_SCSI_HOST *hd; 1652 - MPT_ADAPTER *ioc; 1653 1648 MPT_FRAME_HDR *mf; 1654 1649 u32 ctx2abort; 1655 1650 int scpnt_idx; ··· 1666 1663 return FAILED; 1667 1664 } 1668 1665 1669 - ioc = hd->ioc; 1670 - if (hd->resetPending) { 1671 - return FAILED; 1672 - } 1673 - 1674 - if (hd->timeouts < -1) 1675 - hd->timeouts++; 1676 - 1677 1666 /* Find this command 1678 1667 */ 1679 1668 if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) { ··· 1678 1683 hd->ioc->name, SCpnt)); 1679 1684 return SUCCESS; 1680 1685 } 1686 + 1687 + if (hd->resetPending) { 1688 + return FAILED; 1689 + } 1690 + 1691 + if (hd->timeouts < -1) 1692 + hd->timeouts++; 1681 1693 1682 1694 printk(KERN_WARNING MYNAM ": %s: attempting task abort! (sc=%p)\n", 1683 1695 hd->ioc->name, SCpnt); ··· 1705 1703 vdev = SCpnt->device->hostdata; 1706 1704 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, 1707 1705 vdev->vtarget->bus_id, vdev->vtarget->target_id, vdev->lun, 1708 - ctx2abort, mptscsih_get_tm_timeout(ioc)); 1706 + ctx2abort, mptscsih_get_tm_timeout(hd->ioc)); 1709 1707 1710 1708 printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", 1711 1709 hd->ioc->name, ··· 2523 2521 2524 2522 /* 7. FC: Rescan for blocked rports which might have returned. 2525 2523 */ 2526 - else if (ioc->bus_type == FC) { 2527 - int work_count; 2528 - unsigned long flags; 2529 - 2524 + if (ioc->bus_type == FC) { 2530 2525 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); 2531 - work_count = ++ioc->fc_rescan_work_count; 2526 + if (ioc->fc_rescan_work_q) { 2527 + if (ioc->fc_rescan_work_count++ == 0) { 2528 + queue_work(ioc->fc_rescan_work_q, 2529 + &ioc->fc_rescan_work); 2530 + } 2531 + } 2532 2532 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); 2533 - if (work_count == 1) 2534 - schedule_work(&ioc->fc_rescan_work); 2535 2533 } 2536 2534 dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name)); 2537 2535 ··· 2546 2544 { 2547 2545 MPT_SCSI_HOST *hd; 2548 2546 u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; 2549 - int work_count; 2550 2547 unsigned long flags; 2551 2548 2552 2549 devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n", ··· 2570 2569 2571 2570 case MPI_EVENT_RESCAN: /* 06 */ 2572 2571 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); 2573 - work_count = ++ioc->fc_rescan_work_count; 2572 + if (ioc->fc_rescan_work_q) { 2573 + if (ioc->fc_rescan_work_count++ == 0) { 2574 + queue_work(ioc->fc_rescan_work_q, 2575 + &ioc->fc_rescan_work); 2576 + } 2577 + } 2574 2578 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); 2575 - if (work_count == 1) 2576 - schedule_work(&ioc->fc_rescan_work); 2577 2579 break; 2578 2580 2579 2581 /*
+66 -2
drivers/message/fusion/mptspi.c
··· 783 783 }; 784 784 MODULE_DEVICE_TABLE(pci, mptspi_pci_table); 785 785 786 + 787 + /* 788 + * renegotiate for a given target 789 + */ 790 + static void 791 + mptspi_dv_renegotiate_work(void *data) 792 + { 793 + struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data; 794 + struct _MPT_SCSI_HOST *hd = wqw->hd; 795 + struct scsi_device *sdev; 796 + 797 + kfree(wqw); 798 + 799 + shost_for_each_device(sdev, hd->ioc->sh) 800 + mptspi_dv_device(hd, sdev); 801 + } 802 + 803 + static void 804 + mptspi_dv_renegotiate(struct _MPT_SCSI_HOST *hd) 805 + { 806 + struct work_queue_wrapper *wqw = kmalloc(sizeof(*wqw), GFP_ATOMIC); 807 + 808 + if (!wqw) 809 + return; 810 + 811 + INIT_WORK(&wqw->work, mptspi_dv_renegotiate_work, wqw); 812 + wqw->hd = hd; 813 + 814 + schedule_work(&wqw->work); 815 + } 816 + 817 + /* 818 + * spi module reset handler 819 + */ 820 + static int 821 + mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) 822 + { 823 + struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata; 824 + int rc; 825 + 826 + rc = mptscsih_ioc_reset(ioc, reset_phase); 827 + 828 + if (reset_phase == MPT_IOC_POST_RESET) 829 + mptspi_dv_renegotiate(hd); 830 + 831 + return rc; 832 + } 833 + 834 + /* 835 + * spi module resume handler 836 + */ 837 + static int 838 + mptspi_resume(struct pci_dev *pdev) 839 + { 840 + MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 841 + struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata; 842 + int rc; 843 + 844 + rc = mptscsih_resume(pdev); 845 + mptspi_dv_renegotiate(hd); 846 + 847 + return rc; 848 + } 849 + 786 850 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 787 851 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 788 852 /* ··· 1096 1032 .shutdown = mptscsih_shutdown, 1097 1033 #ifdef CONFIG_PM 1098 1034 .suspend = mptscsih_suspend, 1099 - .resume = mptscsih_resume, 1035 + .resume = mptspi_resume, 1100 1036 #endif 1101 1037 }; 1102 1038 ··· 1125 1061 ": Registered for IOC event notifications\n")); 1126 1062 } 1127 1063 1128 - if (mpt_reset_register(mptspiDoneCtx, mptscsih_ioc_reset) == 0) { 1064 + if (mpt_reset_register(mptspiDoneCtx, mptspi_ioc_reset) == 0) { 1129 1065 dprintk((KERN_INFO MYNAM 1130 1066 ": Registered for IOC reset notifications\n")); 1131 1067 }
+1
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
··· 219 219 ahc->flags |= AHC_39BIT_ADDRESSING; 220 220 } else { 221 221 if (dma_set_mask(dev, DMA_32BIT_MASK)) { 222 + ahc_free(ahc); 222 223 printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n"); 223 224 return (-ENODEV); 224 225 }
+6 -6
drivers/scsi/aic7xxx/aic7xxx_pci.c
··· 2036 2036 * that the OS doesn't know about and rely on our chip 2037 2037 * reset handler to handle the rest. 2038 2038 */ 2039 - ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4, 2040 - ahc->bus_softc.pci_softc.devconfig); 2041 - ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1, 2042 - ahc->bus_softc.pci_softc.command); 2043 - ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1, 2044 - ahc->bus_softc.pci_softc.csize_lattime); 2039 + ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, 2040 + ahc->bus_softc.pci_softc.devconfig, /*bytes*/4); 2041 + ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, 2042 + ahc->bus_softc.pci_softc.command, /*bytes*/1); 2043 + ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, 2044 + ahc->bus_softc.pci_softc.csize_lattime, /*bytes*/1); 2045 2045 if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) { 2046 2046 struct seeprom_descriptor sd; 2047 2047 u_int sxfrctl1;
+18 -12
drivers/scsi/ibmvscsi/ibmvscsi.c
··· 739 739 { 740 740 struct viosrp_adapter_info *req; 741 741 struct srp_event_struct *evt_struct; 742 - 742 + dma_addr_t addr; 743 + 743 744 evt_struct = get_event_struct(&hostdata->pool); 744 745 if (!evt_struct) { 745 746 printk(KERN_ERR "ibmvscsi: couldn't allocate an event " ··· 758 757 759 758 req->common.type = VIOSRP_ADAPTER_INFO_TYPE; 760 759 req->common.length = sizeof(hostdata->madapter_info); 761 - req->buffer = dma_map_single(hostdata->dev, 762 - &hostdata->madapter_info, 763 - sizeof(hostdata->madapter_info), 764 - DMA_BIDIRECTIONAL); 760 + req->buffer = addr = dma_map_single(hostdata->dev, 761 + &hostdata->madapter_info, 762 + sizeof(hostdata->madapter_info), 763 + DMA_BIDIRECTIONAL); 765 764 766 765 if (dma_mapping_error(req->buffer)) { 767 766 printk(KERN_ERR ··· 771 770 return; 772 771 } 773 772 774 - if (ibmvscsi_send_srp_event(evt_struct, hostdata)) 773 + if (ibmvscsi_send_srp_event(evt_struct, hostdata)) { 775 774 printk(KERN_ERR "ibmvscsi: couldn't send ADAPTER_INFO_REQ!\n"); 775 + dma_unmap_single(hostdata->dev, 776 + addr, 777 + sizeof(hostdata->madapter_info), 778 + DMA_BIDIRECTIONAL); 779 + } 776 780 }; 777 781 778 782 /** ··· 1265 1259 { 1266 1260 struct viosrp_host_config *host_config; 1267 1261 struct srp_event_struct *evt_struct; 1262 + dma_addr_t addr; 1268 1263 int rc; 1269 1264 1270 1265 evt_struct = get_event_struct(&hostdata->pool); ··· 1286 1279 memset(host_config, 0x00, sizeof(*host_config)); 1287 1280 host_config->common.type = VIOSRP_HOST_CONFIG_TYPE; 1288 1281 host_config->common.length = length; 1289 - host_config->buffer = dma_map_single(hostdata->dev, buffer, length, 1290 - DMA_BIDIRECTIONAL); 1282 + host_config->buffer = addr = dma_map_single(hostdata->dev, buffer, 1283 + length, 1284 + DMA_BIDIRECTIONAL); 1291 1285 1292 1286 if (dma_mapping_error(host_config->buffer)) { 1293 1287 printk(KERN_ERR ··· 1299 1291 1300 1292 init_completion(&evt_struct->comp); 1301 1293 rc = ibmvscsi_send_srp_event(evt_struct, hostdata); 1302 - if (rc == 0) { 1294 + if (rc == 0) 1303 1295 wait_for_completion(&evt_struct->comp); 1304 - dma_unmap_single(hostdata->dev, host_config->buffer, 1305 - length, DMA_BIDIRECTIONAL); 1306 - } 1296 + dma_unmap_single(hostdata->dev, addr, length, DMA_BIDIRECTIONAL); 1307 1297 1308 1298 return rc; 1309 1299 }
-1
drivers/scsi/lpfc/lpfc_crtn.h
··· 27 27 int lpfc_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *); 28 28 void lpfc_read_config(struct lpfc_hba *, LPFC_MBOXQ_t *); 29 29 void lpfc_read_lnk_stat(struct lpfc_hba *, LPFC_MBOXQ_t *); 30 - void lpfc_set_slim(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t); 31 30 int lpfc_reg_login(struct lpfc_hba *, uint32_t, uint8_t *, LPFC_MBOXQ_t *, 32 31 uint32_t); 33 32 void lpfc_unreg_login(struct lpfc_hba *, uint32_t, LPFC_MBOXQ_t *);
+1
drivers/scsi/lpfc/lpfc_disc.h
··· 113 113 #define NLP_NPR_ADISC 0x2000000 /* Issue ADISC when dq'ed from 114 114 NPR list */ 115 115 #define NLP_DELAY_REMOVE 0x4000000 /* Defer removal till end of DSM */ 116 + #define NLP_NODEV_REMOVE 0x8000000 /* Defer removal till discovery ends */ 116 117 117 118 /* Defines for list searchs */ 118 119 #define NLP_SEARCH_MAPPED 0x1 /* search mapped */
+54 -41
drivers/scsi/lpfc/lpfc_els.c
··· 302 302 if (lpfc_reg_login(phba, Fabric_DID, (uint8_t *) sp, mbox, 0)) 303 303 goto fail_free_mbox; 304 304 305 - /* 306 - * set_slim mailbox command needs to execute first, 307 - * queue this command to be processed later. 308 - */ 309 305 mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login; 310 306 mbox->context2 = ndlp; 311 307 ··· 777 781 if (disc && phba->num_disc_nodes) { 778 782 /* Check to see if there are more PLOGIs to be sent */ 779 783 lpfc_more_plogi(phba); 780 - } 781 784 782 - if (phba->num_disc_nodes == 0) { 783 - spin_lock_irq(phba->host->host_lock); 784 - phba->fc_flag &= ~FC_NDISC_ACTIVE; 785 - spin_unlock_irq(phba->host->host_lock); 785 + if (phba->num_disc_nodes == 0) { 786 + spin_lock_irq(phba->host->host_lock); 787 + phba->fc_flag &= ~FC_NDISC_ACTIVE; 788 + spin_unlock_irq(phba->host->host_lock); 786 789 787 - lpfc_can_disctmo(phba); 788 - if (phba->fc_flag & FC_RSCN_MODE) { 789 - /* Check to see if more RSCNs came in while we were 790 - * processing this one. 791 - */ 792 - if ((phba->fc_rscn_id_cnt == 0) && 793 - (!(phba->fc_flag & FC_RSCN_DISCOVERY))) { 794 - spin_lock_irq(phba->host->host_lock); 795 - phba->fc_flag &= ~FC_RSCN_MODE; 796 - spin_unlock_irq(phba->host->host_lock); 797 - } else { 798 - lpfc_els_handle_rscn(phba); 790 + lpfc_can_disctmo(phba); 791 + if (phba->fc_flag & FC_RSCN_MODE) { 792 + /* 793 + * Check to see if more RSCNs came in while 794 + * we were processing this one. 795 + */ 796 + if ((phba->fc_rscn_id_cnt == 0) && 797 + (!(phba->fc_flag & FC_RSCN_DISCOVERY))) { 798 + spin_lock_irq(phba->host->host_lock); 799 + phba->fc_flag &= ~FC_RSCN_MODE; 800 + spin_unlock_irq(phba->host->host_lock); 801 + } else { 802 + lpfc_els_handle_rscn(phba); 803 + } 799 804 } 800 805 } 801 806 } ··· 1260 1263 psli = &phba->sli; 1261 1264 pring = &psli->ring[LPFC_ELS_RING]; 1262 1265 1263 - cmdsize = 2 * (sizeof (uint32_t) + sizeof (struct lpfc_name)); 1266 + cmdsize = (2 * sizeof (uint32_t)) + sizeof (struct lpfc_name); 1264 1267 elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, 1265 1268 ndlp->nlp_DID, ELS_CMD_LOGO); 1266 1269 if (!elsiocb) ··· 1448 1451 * PLOGIs to be sent 1449 1452 */ 1450 1453 lpfc_more_plogi(phba); 1451 - } 1452 1454 1453 - if (phba->num_disc_nodes == 0) { 1454 - phba->fc_flag &= ~FC_NDISC_ACTIVE; 1455 - lpfc_can_disctmo(phba); 1456 - if (phba->fc_flag & FC_RSCN_MODE) { 1457 - /* Check to see if more RSCNs 1458 - * came in while we were 1459 - * processing this one. 1460 - */ 1461 - if((phba->fc_rscn_id_cnt==0) && 1462 - (!(phba->fc_flag & FC_RSCN_DISCOVERY))) { 1463 - phba->fc_flag &= ~FC_RSCN_MODE; 1464 - } 1465 - else { 1466 - lpfc_els_handle_rscn(phba); 1455 + if (phba->num_disc_nodes == 0) { 1456 + phba->fc_flag &= ~FC_NDISC_ACTIVE; 1457 + lpfc_can_disctmo(phba); 1458 + if (phba->fc_flag & FC_RSCN_MODE) { 1459 + /* 1460 + * Check to see if more RSCNs 1461 + * came in while we were 1462 + * processing this one. 1463 + */ 1464 + if((phba->fc_rscn_id_cnt==0) && 1465 + !(phba->fc_flag & FC_RSCN_DISCOVERY)) { 1466 + phba->fc_flag &= ~FC_RSCN_MODE; 1467 + } 1468 + else { 1469 + lpfc_els_handle_rscn(phba); 1470 + } 1467 1471 } 1468 1472 } 1469 1473 } ··· 1870 1872 if (mbox) { 1871 1873 if ((rspiocb->iocb.ulpStatus == 0) 1872 1874 && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { 1873 - /* set_slim mailbox command needs to execute first, 1874 - * queue this command to be processed later. 1875 - */ 1876 1875 lpfc_unreg_rpi(phba, ndlp); 1877 1876 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; 1878 1877 mbox->context2 = ndlp; ··· 1915 1920 uint8_t *pcmd; 1916 1921 uint16_t cmdsize; 1917 1922 int rc; 1923 + ELS_PKT *els_pkt_ptr; 1918 1924 1919 1925 psli = &phba->sli; 1920 1926 pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */ ··· 1953 1957 *((uint32_t *) (pcmd)) = ELS_CMD_ACC; 1954 1958 pcmd += sizeof (uint32_t); 1955 1959 memcpy(pcmd, &phba->fc_sparam, sizeof (struct serv_parm)); 1960 + break; 1961 + case ELS_CMD_PRLO: 1962 + cmdsize = sizeof (uint32_t) + sizeof (PRLO); 1963 + elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, oldiocb->retry, 1964 + ndlp, ndlp->nlp_DID, ELS_CMD_PRLO); 1965 + if (!elsiocb) 1966 + return 1; 1967 + 1968 + icmd = &elsiocb->iocb; 1969 + icmd->ulpContext = oldcmd->ulpContext; /* Xri */ 1970 + pcmd = (((struct lpfc_dmabuf *) elsiocb->context2)->virt); 1971 + 1972 + memcpy(pcmd, ((struct lpfc_dmabuf *) oldiocb->context2)->virt, 1973 + sizeof (uint32_t) + sizeof (PRLO)); 1974 + *((uint32_t *) (pcmd)) = ELS_CMD_PRLO_ACC; 1975 + els_pkt_ptr = (ELS_PKT *) pcmd; 1976 + els_pkt_ptr->un.prlo.acceptRspCode = PRLO_REQ_EXECUTED; 1956 1977 break; 1957 1978 default: 1958 1979 return 1; ··· 2511 2498 /* If we are about to begin discovery, just ACC the RSCN. 2512 2499 * Discovery processing will satisfy it. 2513 2500 */ 2514 - if (phba->hba_state < LPFC_NS_QRY) { 2501 + if (phba->hba_state <= LPFC_NS_QRY) { 2515 2502 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 2516 2503 newnode); 2517 2504 return 0;
+10 -8
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 311 311 evtp->evt_arg2 = arg2; 312 312 evtp->evt = evt; 313 313 314 - list_add_tail(&evtp->evt_listp, &phba->work_list); 315 314 spin_lock_irq(phba->host->host_lock); 315 + list_add_tail(&evtp->evt_listp, &phba->work_list); 316 316 if (phba->work_wait) 317 317 wake_up(phba->work_wait); 318 318 spin_unlock_irq(phba->host->host_lock); ··· 1071 1071 /* initialize static port data */ 1072 1072 rport->maxframe_size = ndlp->nlp_maxframe; 1073 1073 rport->supported_classes = ndlp->nlp_class_sup; 1074 - if ((rport->scsi_target_id != -1) && 1075 - (rport->scsi_target_id < MAX_FCP_TARGET)) { 1076 - ndlp->nlp_sid = rport->scsi_target_id; 1077 - } 1078 1074 rdata = rport->dd_data; 1079 1075 rdata->pnode = ndlp; 1080 1076 ··· 1083 1087 if (rport_ids.roles != FC_RPORT_ROLE_UNKNOWN) 1084 1088 fc_remote_port_rolechg(rport, rport_ids.roles); 1085 1089 1090 + if ((rport->scsi_target_id != -1) && 1091 + (rport->scsi_target_id < MAX_FCP_TARGET)) { 1092 + ndlp->nlp_sid = rport->scsi_target_id; 1093 + } 1086 1094 1087 1095 return; 1088 1096 } ··· 1238 1238 evt_listp); 1239 1239 1240 1240 } 1241 + nlp->nlp_flag &= ~NLP_NODEV_REMOVE; 1241 1242 nlp->nlp_type |= NLP_FC_NODE; 1242 1243 break; 1243 1244 case NLP_MAPPED_LIST: ··· 1259 1258 evt_listp); 1260 1259 1261 1260 } 1261 + nlp->nlp_flag &= ~NLP_NODEV_REMOVE; 1262 1262 break; 1263 1263 case NLP_NPR_LIST: 1264 1264 nlp->nlp_flag |= list; ··· 1404 1402 if (icmd->ulpContext == (volatile ushort)ndlp->nlp_rpi) 1405 1403 return 1; 1406 1404 case CMD_ELS_REQUEST64_CR: 1405 + if (icmd->un.elsreq64.remoteID == ndlp->nlp_DID) 1406 + return 1; 1407 1407 case CMD_XMIT_ELS_RSP64_CX: 1408 1408 if (iocb->context1 == (uint8_t *) ndlp) 1409 1409 return 1; ··· 1905 1901 */ 1906 1902 if (ndlp->nlp_flag & NLP_DELAY_TMO) 1907 1903 lpfc_cancel_retry_delay_tmo(phba, ndlp); 1908 - } else { 1909 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1904 + } else 1910 1905 ndlp = NULL; 1911 - } 1912 1906 } else { 1913 1907 flg = ndlp->nlp_flag & NLP_LIST_MASK; 1914 1908 if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST))
+3
drivers/scsi/lpfc/lpfc_hw.h
··· 449 449 #define ELS_CMD_RRQ 0x12000000 450 450 #define ELS_CMD_PRLI 0x20100014 451 451 #define ELS_CMD_PRLO 0x21100014 452 + #define ELS_CMD_PRLO_ACC 0x02100014 452 453 #define ELS_CMD_PDISC 0x50000000 453 454 #define ELS_CMD_FDISC 0x51000000 454 455 #define ELS_CMD_ADISC 0x52000000 ··· 485 484 #define ELS_CMD_RRQ 0x12 486 485 #define ELS_CMD_PRLI 0x14001020 487 486 #define ELS_CMD_PRLO 0x14001021 487 + #define ELS_CMD_PRLO_ACC 0x14001002 488 488 #define ELS_CMD_PDISC 0x50 489 489 #define ELS_CMD_FDISC 0x51 490 490 #define ELS_CMD_ADISC 0x52 ··· 1541 1539 1542 1540 #define FLAGS_TOPOLOGY_FAILOVER 0x0400 /* Bit 10 */ 1543 1541 #define FLAGS_LINK_SPEED 0x0800 /* Bit 11 */ 1542 + #define FLAGS_IMED_ABORT 0x04000 /* Bit 14 */ 1544 1543 1545 1544 uint32_t link_speed; 1546 1545 #define LINK_SPEED_AUTO 0 /* Auto selection */
+10 -12
drivers/scsi/lpfc/lpfc_init.c
··· 294 294 } 295 295 } 296 296 297 - /* This should turn on DELAYED ABTS for ELS timeouts */ 298 - lpfc_set_slim(phba, pmb, 0x052198, 0x1); 299 - if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { 300 - phba->hba_state = LPFC_HBA_ERROR; 301 - mempool_free( pmb, phba->mbox_mem_pool); 302 - return -EIO; 303 - } 304 - 305 - 306 297 lpfc_read_config(phba, pmb); 307 298 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { 308 299 lpfc_printf_log(phba, ··· 795 804 int max_speed; 796 805 char * ports; 797 806 char * bus; 798 - } m; 807 + } m = {"<Unknown>", 0, "", ""}; 799 808 800 809 pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype); 801 810 ports = (hdrtype == 0x80) ? "2-port " : ""; ··· 1618 1627 1619 1628 error = lpfc_alloc_sysfs_attr(phba); 1620 1629 if (error) 1621 - goto out_kthread_stop; 1630 + goto out_remove_host; 1622 1631 1623 1632 error = request_irq(phba->pcidev->irq, lpfc_intr_handler, SA_SHIRQ, 1624 1633 LPFC_DRIVER_NAME, phba); ··· 1635 1644 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; 1636 1645 1637 1646 error = lpfc_sli_hba_setup(phba); 1638 - if (error) 1647 + if (error) { 1648 + error = -ENODEV; 1639 1649 goto out_free_irq; 1650 + } 1640 1651 1641 1652 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { 1642 1653 spin_lock_irq(phba->host->host_lock); ··· 1693 1700 free_irq(phba->pcidev->irq, phba); 1694 1701 out_free_sysfs_attr: 1695 1702 lpfc_free_sysfs_attr(phba); 1703 + out_remove_host: 1704 + fc_remove_host(phba->host); 1705 + scsi_remove_host(phba->host); 1696 1706 out_kthread_stop: 1697 1707 kthread_stop(phba->worker_thread); 1698 1708 out_free_iocbq: ··· 1717 1721 out_idr_remove: 1718 1722 idr_remove(&lpfc_hba_index, phba->brd_no); 1719 1723 out_put_host: 1724 + phba->host = NULL; 1720 1725 scsi_host_put(host); 1721 1726 out_release_regions: 1722 1727 pci_release_regions(pdev); 1723 1728 out_disable_device: 1724 1729 pci_disable_device(pdev); 1725 1730 out: 1731 + pci_set_drvdata(pdev, NULL); 1726 1732 return error; 1727 1733 } 1728 1734
+3 -30
drivers/scsi/lpfc/lpfc_mbox.c
··· 200 200 break; 201 201 } 202 202 203 + /* Enable asynchronous ABTS responses from firmware */ 204 + mb->un.varInitLnk.link_flags |= FLAGS_IMED_ABORT; 205 + 203 206 /* NEW_FEATURE 204 207 * Setting up the link speed 205 208 */ ··· 291 288 mb->un.varUnregDID.did = did; 292 289 293 290 mb->mbxCommand = MBX_UNREG_D_ID; 294 - mb->mbxOwner = OWN_HOST; 295 - return; 296 - } 297 - 298 - /***********************************************/ 299 - 300 - /* command to write slim */ 301 - /***********************************************/ 302 - void 303 - lpfc_set_slim(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, uint32_t addr, 304 - uint32_t value) 305 - { 306 - MAILBOX_t *mb; 307 - 308 - mb = &pmb->mb; 309 - memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); 310 - 311 - /* addr = 0x090597 is AUTO ABTS disable for ELS commands */ 312 - /* addr = 0x052198 is DELAYED ABTS enable for ELS commands */ 313 - 314 - /* 315 - * Always turn on DELAYED ABTS for ELS timeouts 316 - */ 317 - if ((addr == 0x052198) && (value == 0)) 318 - value = 1; 319 - 320 - mb->un.varWords[0] = addr; 321 - mb->un.varWords[1] = value; 322 - 323 - mb->mbxCommand = MBX_SET_SLIM; 324 291 mb->mbxOwner = OWN_HOST; 325 292 return; 326 293 }
+94 -40
drivers/scsi/lpfc/lpfc_nportdisc.c
··· 465 465 static int 466 466 lpfc_rcv_logo(struct lpfc_hba * phba, 467 467 struct lpfc_nodelist * ndlp, 468 - struct lpfc_iocbq *cmdiocb) 468 + struct lpfc_iocbq *cmdiocb, 469 + uint32_t els_cmd) 469 470 { 470 471 /* Put ndlp on NPR list with 1 sec timeout for plogi, ACC logo */ 471 472 /* Only call LOGO ACC for first LOGO, this avoids sending unnecessary 472 473 * PLOGIs during LOGO storms from a device. 473 474 */ 474 475 ndlp->nlp_flag |= NLP_LOGO_ACC; 475 - lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 476 + if (els_cmd == ELS_CMD_PRLO) 477 + lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); 478 + else 479 + lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 476 480 477 481 if (!(ndlp->nlp_type & NLP_FABRIC) || 478 482 (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) { ··· 685 681 /* software abort outstanding PLOGI */ 686 682 lpfc_els_abort(phba, ndlp, 1); 687 683 688 - lpfc_rcv_logo(phba, ndlp, cmdiocb); 684 + lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); 689 685 return ndlp->nlp_state; 690 686 } 691 687 ··· 792 788 if (lpfc_reg_login 793 789 (phba, irsp->un.elsreq64.remoteID, 794 790 (uint8_t *) sp, mbox, 0) == 0) { 795 - /* set_slim mailbox command needs to 796 - * execute first, queue this command to 797 - * be processed later. 798 - */ 799 791 switch (ndlp->nlp_DID) { 800 792 case NameServer_DID: 801 793 mbox->mbox_cmpl = ··· 832 832 lpfc_device_rm_plogi_issue(struct lpfc_hba * phba, 833 833 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 834 834 { 835 - /* software abort outstanding PLOGI */ 836 - lpfc_els_abort(phba, ndlp, 1); 835 + if(ndlp->nlp_flag & NLP_NPR_2B_DISC) { 836 + ndlp->nlp_flag |= NLP_NODEV_REMOVE; 837 + return ndlp->nlp_state; 838 + } 839 + else { 840 + /* software abort outstanding PLOGI */ 841 + lpfc_els_abort(phba, ndlp, 1); 837 842 838 - lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 839 - return NLP_STE_FREED_NODE; 843 + lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 844 + return NLP_STE_FREED_NODE; 845 + } 840 846 } 841 847 842 848 static uint32_t ··· 857 851 ndlp->nlp_state = NLP_STE_NPR_NODE; 858 852 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 859 853 spin_lock_irq(phba->host->host_lock); 860 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 854 + ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 861 855 spin_unlock_irq(phba->host->host_lock); 862 856 863 857 return ndlp->nlp_state; ··· 911 905 /* software abort outstanding ADISC */ 912 906 lpfc_els_abort(phba, ndlp, 0); 913 907 914 - lpfc_rcv_logo(phba, ndlp, cmdiocb); 908 + lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); 915 909 return ndlp->nlp_state; 916 910 } 917 911 ··· 938 932 cmdiocb = (struct lpfc_iocbq *) arg; 939 933 940 934 /* Treat like rcv logo */ 941 - lpfc_rcv_logo(phba, ndlp, cmdiocb); 935 + lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_PRLO); 942 936 return ndlp->nlp_state; 943 937 } 944 938 ··· 993 987 struct lpfc_nodelist * ndlp, void *arg, 994 988 uint32_t evt) 995 989 { 996 - /* software abort outstanding ADISC */ 997 - lpfc_els_abort(phba, ndlp, 1); 990 + if(ndlp->nlp_flag & NLP_NPR_2B_DISC) { 991 + ndlp->nlp_flag |= NLP_NODEV_REMOVE; 992 + return ndlp->nlp_state; 993 + } 994 + else { 995 + /* software abort outstanding ADISC */ 996 + lpfc_els_abort(phba, ndlp, 1); 998 997 999 - lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1000 - return NLP_STE_FREED_NODE; 998 + lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 999 + return NLP_STE_FREED_NODE; 1000 + } 1001 1001 } 1002 1002 1003 1003 static uint32_t ··· 1018 1006 ndlp->nlp_state = NLP_STE_NPR_NODE; 1019 1007 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1020 1008 spin_lock_irq(phba->host->host_lock); 1021 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1009 + ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1022 1010 ndlp->nlp_flag |= NLP_NPR_ADISC; 1023 1011 spin_unlock_irq(phba->host->host_lock); 1024 1012 ··· 1060 1048 1061 1049 cmdiocb = (struct lpfc_iocbq *) arg; 1062 1050 1063 - lpfc_rcv_logo(phba, ndlp, cmdiocb); 1051 + lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); 1064 1052 return ndlp->nlp_state; 1065 1053 } 1066 1054 ··· 1085 1073 struct lpfc_iocbq *cmdiocb; 1086 1074 1087 1075 cmdiocb = (struct lpfc_iocbq *) arg; 1088 - lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 1076 + lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); 1089 1077 return ndlp->nlp_state; 1090 1078 } 1091 1079 ··· 1145 1133 struct lpfc_nodelist * ndlp, void *arg, 1146 1134 uint32_t evt) 1147 1135 { 1148 - lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1149 - return NLP_STE_FREED_NODE; 1136 + if(ndlp->nlp_flag & NLP_NPR_2B_DISC) { 1137 + ndlp->nlp_flag |= NLP_NODEV_REMOVE; 1138 + return ndlp->nlp_state; 1139 + } 1140 + else { 1141 + lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1142 + return NLP_STE_FREED_NODE; 1143 + } 1150 1144 } 1151 1145 1152 1146 static uint32_t ··· 1164 1146 ndlp->nlp_state = NLP_STE_NPR_NODE; 1165 1147 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1166 1148 spin_lock_irq(phba->host->host_lock); 1167 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1149 + ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1168 1150 spin_unlock_irq(phba->host->host_lock); 1169 1151 return ndlp->nlp_state; 1170 1152 } ··· 1204 1186 /* Software abort outstanding PRLI before sending acc */ 1205 1187 lpfc_els_abort(phba, ndlp, 1); 1206 1188 1207 - lpfc_rcv_logo(phba, ndlp, cmdiocb); 1189 + lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); 1208 1190 return ndlp->nlp_state; 1209 1191 } 1210 1192 ··· 1232 1214 struct lpfc_iocbq *cmdiocb; 1233 1215 1234 1216 cmdiocb = (struct lpfc_iocbq *) arg; 1235 - lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 1217 + lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); 1236 1218 return ndlp->nlp_state; 1237 1219 } 1238 1220 ··· 1296 1278 lpfc_device_rm_prli_issue(struct lpfc_hba * phba, 1297 1279 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 1298 1280 { 1299 - /* software abort outstanding PRLI */ 1300 - lpfc_els_abort(phba, ndlp, 1); 1281 + if(ndlp->nlp_flag & NLP_NPR_2B_DISC) { 1282 + ndlp->nlp_flag |= NLP_NODEV_REMOVE; 1283 + return ndlp->nlp_state; 1284 + } 1285 + else { 1286 + /* software abort outstanding PLOGI */ 1287 + lpfc_els_abort(phba, ndlp, 1); 1301 1288 1302 - lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1303 - return NLP_STE_FREED_NODE; 1289 + lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1290 + return NLP_STE_FREED_NODE; 1291 + } 1304 1292 } 1305 1293 1306 1294 ··· 1337 1313 ndlp->nlp_state = NLP_STE_NPR_NODE; 1338 1314 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1339 1315 spin_lock_irq(phba->host->host_lock); 1340 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1316 + ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1341 1317 spin_unlock_irq(phba->host->host_lock); 1342 1318 return ndlp->nlp_state; 1343 1319 } ··· 1375 1351 1376 1352 cmdiocb = (struct lpfc_iocbq *) arg; 1377 1353 1378 - lpfc_rcv_logo(phba, ndlp, cmdiocb); 1354 + lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); 1379 1355 return ndlp->nlp_state; 1380 1356 } 1381 1357 ··· 1399 1375 1400 1376 cmdiocb = (struct lpfc_iocbq *) arg; 1401 1377 1402 - lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 1378 + lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); 1403 1379 return ndlp->nlp_state; 1404 1380 } 1405 1381 ··· 1410 1386 ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE; 1411 1387 ndlp->nlp_state = NLP_STE_NPR_NODE; 1412 1388 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1413 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1389 + ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1414 1390 lpfc_disc_set_adisc(phba, ndlp); 1415 1391 1416 1392 return ndlp->nlp_state; ··· 1448 1424 1449 1425 cmdiocb = (struct lpfc_iocbq *) arg; 1450 1426 1451 - lpfc_rcv_logo(phba, ndlp, cmdiocb); 1427 + lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); 1452 1428 return ndlp->nlp_state; 1453 1429 } 1454 1430 ··· 1480 1456 spin_unlock_irq(phba->host->host_lock); 1481 1457 1482 1458 /* Treat like rcv logo */ 1483 - lpfc_rcv_logo(phba, ndlp, cmdiocb); 1459 + lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_PRLO); 1484 1460 return ndlp->nlp_state; 1485 1461 } 1486 1462 ··· 1493 1469 ndlp->nlp_state = NLP_STE_NPR_NODE; 1494 1470 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1495 1471 spin_lock_irq(phba->host->host_lock); 1496 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1472 + ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1497 1473 spin_unlock_irq(phba->host->host_lock); 1498 1474 lpfc_disc_set_adisc(phba, ndlp); 1499 1475 return ndlp->nlp_state; ··· 1575 1551 1576 1552 cmdiocb = (struct lpfc_iocbq *) arg; 1577 1553 1578 - lpfc_rcv_logo(phba, ndlp, cmdiocb); 1554 + lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); 1579 1555 return ndlp->nlp_state; 1580 1556 } 1581 1557 ··· 1641 1617 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 1642 1618 { 1643 1619 struct lpfc_iocbq *cmdiocb, *rspiocb; 1620 + IOCB_t *irsp; 1644 1621 1645 1622 cmdiocb = (struct lpfc_iocbq *) arg; 1646 1623 rspiocb = cmdiocb->context_un.rsp_iocb; 1624 + 1625 + irsp = &rspiocb->iocb; 1626 + if (irsp->ulpStatus) { 1627 + lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1628 + return NLP_STE_FREED_NODE; 1629 + } 1647 1630 return ndlp->nlp_state; 1648 1631 } 1649 1632 ··· 1659 1628 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 1660 1629 { 1661 1630 struct lpfc_iocbq *cmdiocb, *rspiocb; 1631 + IOCB_t *irsp; 1662 1632 1663 1633 cmdiocb = (struct lpfc_iocbq *) arg; 1664 1634 rspiocb = cmdiocb->context_un.rsp_iocb; 1635 + 1636 + irsp = &rspiocb->iocb; 1637 + if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { 1638 + lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1639 + return NLP_STE_FREED_NODE; 1640 + } 1665 1641 return ndlp->nlp_state; 1666 1642 } 1667 1643 ··· 1687 1649 uint32_t evt) 1688 1650 { 1689 1651 struct lpfc_iocbq *cmdiocb, *rspiocb; 1652 + IOCB_t *irsp; 1690 1653 1691 1654 cmdiocb = (struct lpfc_iocbq *) arg; 1692 1655 rspiocb = cmdiocb->context_un.rsp_iocb; 1656 + 1657 + irsp = &rspiocb->iocb; 1658 + if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { 1659 + lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1660 + return NLP_STE_FREED_NODE; 1661 + } 1693 1662 return ndlp->nlp_state; 1694 1663 } 1695 1664 ··· 1713 1668 1714 1669 if (!mb->mbxStatus) 1715 1670 ndlp->nlp_rpi = mb->un.varWords[0]; 1716 - 1671 + else { 1672 + if (ndlp->nlp_flag & NLP_NODEV_REMOVE) { 1673 + lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1674 + return NLP_STE_FREED_NODE; 1675 + } 1676 + } 1717 1677 return ndlp->nlp_state; 1718 1678 } 1719 1679 ··· 1727 1677 struct lpfc_nodelist * ndlp, void *arg, 1728 1678 uint32_t evt) 1729 1679 { 1680 + if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { 1681 + ndlp->nlp_flag |= NLP_NODEV_REMOVE; 1682 + return ndlp->nlp_state; 1683 + } 1730 1684 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1731 1685 return NLP_STE_FREED_NODE; 1732 1686 } ··· 1741 1687 uint32_t evt) 1742 1688 { 1743 1689 spin_lock_irq(phba->host->host_lock); 1744 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1690 + ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1745 1691 spin_unlock_irq(phba->host->host_lock); 1746 1692 if (ndlp->nlp_flag & NLP_DELAY_TMO) { 1747 1693 lpfc_cancel_retry_delay_tmo(phba, ndlp);
+19 -49
drivers/scsi/lpfc/lpfc_scsi.c
··· 629 629 struct lpfc_iocbq *piocbq; 630 630 IOCB_t *piocb; 631 631 struct fcp_cmnd *fcp_cmnd; 632 - struct scsi_device *scsi_dev = lpfc_cmd->pCmd->device; 633 - struct lpfc_rport_data *rdata = scsi_dev->hostdata; 632 + struct lpfc_rport_data *rdata = lpfc_cmd->rdata; 634 633 struct lpfc_nodelist *ndlp = rdata->pnode; 635 634 636 635 if ((ndlp == NULL) || (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) { ··· 664 665 piocb->ulpTimeout = lpfc_cmd->timeout; 665 666 } 666 667 667 - lpfc_cmd->rdata = rdata; 668 - 669 - switch (task_mgmt_cmd) { 670 - case FCP_LUN_RESET: 671 - /* Issue LUN Reset to TGT <num> LUN <num> */ 672 - lpfc_printf_log(phba, 673 - KERN_INFO, 674 - LOG_FCP, 675 - "%d:0703 Issue LUN Reset to TGT %d LUN %d " 676 - "Data: x%x x%x\n", 677 - phba->brd_no, 678 - scsi_dev->id, scsi_dev->lun, 679 - ndlp->nlp_rpi, ndlp->nlp_flag); 680 - 681 - break; 682 - case FCP_ABORT_TASK_SET: 683 - /* Issue Abort Task Set to TGT <num> LUN <num> */ 684 - lpfc_printf_log(phba, 685 - KERN_INFO, 686 - LOG_FCP, 687 - "%d:0701 Issue Abort Task Set to TGT %d LUN %d " 688 - "Data: x%x x%x\n", 689 - phba->brd_no, 690 - scsi_dev->id, scsi_dev->lun, 691 - ndlp->nlp_rpi, ndlp->nlp_flag); 692 - 693 - break; 694 - case FCP_TARGET_RESET: 695 - /* Issue Target Reset to TGT <num> */ 696 - lpfc_printf_log(phba, 697 - KERN_INFO, 698 - LOG_FCP, 699 - "%d:0702 Issue Target Reset to TGT %d " 700 - "Data: x%x x%x\n", 701 - phba->brd_no, 702 - scsi_dev->id, ndlp->nlp_rpi, 703 - ndlp->nlp_flag); 704 - break; 705 - } 706 - 707 668 return (1); 708 669 } 709 670 710 671 static int 711 - lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba) 672 + lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba, 673 + unsigned tgt_id, struct lpfc_rport_data *rdata) 712 674 { 713 675 struct lpfc_iocbq *iocbq; 714 676 struct lpfc_iocbq *iocbqrsp; 715 677 int ret; 716 678 679 + lpfc_cmd->rdata = rdata; 717 680 ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_TARGET_RESET); 718 681 if (!ret) 719 682 return FAILED; ··· 686 725 687 726 if (!iocbqrsp) 688 727 return FAILED; 728 + 729 + /* Issue Target Reset to TGT <num> */ 730 + lpfc_printf_log(phba, KERN_INFO, LOG_FCP, 731 + "%d:0702 Issue Target Reset to TGT %d " 732 + "Data: x%x x%x\n", 733 + phba->brd_no, tgt_id, rdata->pnode->nlp_rpi, 734 + rdata->pnode->nlp_flag); 689 735 690 736 ret = lpfc_sli_issue_iocb_wait(phba, 691 737 &phba->sli.ring[phba->sli.fcp_ring], ··· 989 1021 lpfc_cmd->pCmd = cmnd; 990 1022 lpfc_cmd->timeout = 60; 991 1023 lpfc_cmd->scsi_hba = phba; 1024 + lpfc_cmd->rdata = rdata; 992 1025 993 1026 ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_LUN_RESET); 994 1027 if (!ret) ··· 1001 1032 iocbqrsp = lpfc_sli_get_iocbq(phba); 1002 1033 if (iocbqrsp == NULL) 1003 1034 goto out_free_scsi_buf; 1035 + 1036 + lpfc_printf_log(phba, KERN_INFO, LOG_FCP, 1037 + "%d:0703 Issue LUN Reset to TGT %d LUN %d " 1038 + "Data: x%x x%x\n", phba->brd_no, cmnd->device->id, 1039 + cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag); 1004 1040 1005 1041 ret = lpfc_sli_issue_iocb_wait(phba, 1006 1042 &phba->sli.ring[phba->sli.fcp_ring], ··· 1078 1104 int match; 1079 1105 int ret = FAILED, i, err_count = 0; 1080 1106 int cnt, loopcnt; 1081 - unsigned int midlayer_id = 0; 1082 1107 struct lpfc_scsi_buf * lpfc_cmd; 1083 1108 1084 1109 lpfc_block_requests(phba); ··· 1097 1124 * targets known to the driver. Should any target reset 1098 1125 * fail, this routine returns failure to the midlayer. 1099 1126 */ 1100 - midlayer_id = cmnd->device->id; 1101 1127 for (i = 0; i < MAX_FCP_TARGET; i++) { 1102 1128 /* Search the mapped list for this target ID */ 1103 1129 match = 0; ··· 1109 1137 if (!match) 1110 1138 continue; 1111 1139 1112 - lpfc_cmd->pCmd->device->id = i; 1113 - lpfc_cmd->pCmd->device->hostdata = ndlp->rport->dd_data; 1114 - ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba); 1140 + ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba, 1141 + i, ndlp->rport->dd_data); 1115 1142 if (ret != SUCCESS) { 1116 1143 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1117 1144 "%d:0713 Bus Reset on target %d failed\n", ··· 1129 1158 * the targets. Unfortunately, some targets do not abide by 1130 1159 * this forcing the driver to double check. 1131 1160 */ 1132 - cmnd->device->id = midlayer_id; 1133 1161 cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], 1134 1162 0, 0, LPFC_CTX_HOST); 1135 1163 if (cnt)
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 18 18 * included with this package. * 19 19 *******************************************************************/ 20 20 21 - #define LPFC_DRIVER_VERSION "8.1.4" 21 + #define LPFC_DRIVER_VERSION "8.1.6" 22 22 23 23 #define LPFC_DRIVER_NAME "lpfc" 24 24
-1
drivers/scsi/megaraid.c
··· 4471 4471 { 4472 4472 Scsi_Cmnd *scmd; 4473 4473 struct scsi_device *sdev; 4474 - unsigned long flags = 0; 4475 4474 scb_t *scb; 4476 4475 int rval; 4477 4476
+41 -18
drivers/scsi/megaraid/megaraid_mbox.c
··· 10 10 * 2 of the License, or (at your option) any later version. 11 11 * 12 12 * FILE : megaraid_mbox.c 13 - * Version : v2.20.4.7 (Nov 14 2005) 13 + * Version : v2.20.4.8 (Apr 11 2006) 14 14 * 15 15 * Authors: 16 16 * Atul Mukker <Atul.Mukker@lsil.com> ··· 2278 2278 unsigned long flags; 2279 2279 uint8_t c; 2280 2280 int status; 2281 + uioc_t *kioc; 2281 2282 2282 2283 2283 2284 if (!adapter) return; ··· 2320 2319 2321 2320 // remove from local clist 2322 2321 list_del_init(&scb->list); 2322 + 2323 + kioc = (uioc_t *)scb->gp; 2324 + kioc->status = 0; 2323 2325 2324 2326 megaraid_mbox_mm_done(adapter, scb); 2325 2327 ··· 2640 2636 int recovery_window; 2641 2637 int recovering; 2642 2638 int i; 2639 + uioc_t *kioc; 2643 2640 2644 2641 adapter = SCP2ADAPTER(scp); 2645 2642 raid_dev = ADAP2RAIDDEV(adapter); ··· 2660 2655 // Also, reset all the commands currently owned by the driver 2661 2656 spin_lock_irqsave(PENDING_LIST_LOCK(adapter), flags); 2662 2657 list_for_each_entry_safe(scb, tmp, &adapter->pend_list, list) { 2663 - 2664 2658 list_del_init(&scb->list); // from pending list 2665 2659 2666 - con_log(CL_ANN, (KERN_WARNING 2667 - "megaraid: %ld:%d[%d:%d], reset from pending list\n", 2668 - scp->serial_number, scb->sno, 2669 - scb->dev_channel, scb->dev_target)); 2660 + if (scb->sno >= MBOX_MAX_SCSI_CMDS) { 2661 + con_log(CL_ANN, (KERN_WARNING 2662 + "megaraid: IOCTL packet with %d[%d:%d] being reset\n", 2663 + scb->sno, scb->dev_channel, scb->dev_target)); 2670 2664 2671 - scp->result = (DID_RESET << 16); 2672 - scp->scsi_done(scp); 2665 + scb->status = -1; 2673 2666 2674 - megaraid_dealloc_scb(adapter, scb); 2667 + kioc = (uioc_t *)scb->gp; 2668 + kioc->status = -EFAULT; 2669 + 2670 + megaraid_mbox_mm_done(adapter, scb); 2671 + } else { 2672 + if (scb->scp == scp) { // Found command 2673 + con_log(CL_ANN, (KERN_WARNING 2674 + "megaraid: %ld:%d[%d:%d], reset from pending list\n", 2675 + scp->serial_number, scb->sno, 2676 + scb->dev_channel, scb->dev_target)); 2677 + } else { 2678 + con_log(CL_ANN, (KERN_WARNING 2679 + "megaraid: IO packet with %d[%d:%d] being reset\n", 2680 + scb->sno, scb->dev_channel, scb->dev_target)); 2681 + } 2682 + 2683 + scb->scp->result = (DID_RESET << 16); 2684 + scb->scp->scsi_done(scb->scp); 2685 + 2686 + megaraid_dealloc_scb(adapter, scb); 2687 + } 2675 2688 } 2676 2689 spin_unlock_irqrestore(PENDING_LIST_LOCK(adapter), flags); 2677 2690 2678 2691 if (adapter->outstanding_cmds) { 2679 2692 con_log(CL_ANN, (KERN_NOTICE 2680 2693 "megaraid: %d outstanding commands. Max wait %d sec\n", 2681 - adapter->outstanding_cmds, MBOX_RESET_WAIT)); 2694 + adapter->outstanding_cmds, 2695 + (MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT))); 2682 2696 } 2683 2697 2684 2698 recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT; 2685 2699 2686 2700 recovering = adapter->outstanding_cmds; 2687 2701 2688 - for (i = 0; i < recovery_window && adapter->outstanding_cmds; i++) { 2702 + for (i = 0; i < recovery_window; i++) { 2689 2703 2690 2704 megaraid_ack_sequence(adapter); 2691 2705 ··· 2713 2689 con_log(CL_ANN, ( 2714 2690 "megaraid mbox: Wait for %d commands to complete:%d\n", 2715 2691 adapter->outstanding_cmds, 2716 - MBOX_RESET_WAIT - i)); 2692 + (MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT) - i)); 2717 2693 } 2718 2694 2719 2695 // bailout if no recovery happended in reset time 2720 - if ((i == MBOX_RESET_WAIT) && 2721 - (recovering == adapter->outstanding_cmds)) { 2696 + if (adapter->outstanding_cmds == 0) { 2722 2697 break; 2723 2698 } 2724 2699 ··· 2941 2918 wmb(); 2942 2919 WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1); 2943 2920 2944 - for (i = 0; i < 0xFFFFF; i++) { 2921 + for (i = 0; i < MBOX_SYNC_WAIT_CNT; i++) { 2945 2922 if (mbox->numstatus != 0xFF) break; 2946 2923 rmb(); 2924 + udelay(MBOX_SYNC_DELAY_200); 2947 2925 } 2948 2926 2949 - if (i == 0xFFFFF) { 2927 + if (i == MBOX_SYNC_WAIT_CNT) { 2950 2928 // We may need to re-calibrate the counter 2951 2929 con_log(CL_ANN, (KERN_CRIT 2952 2930 "megaraid: fast sync command timed out\n")); ··· 3499 3475 adp.drvr_data = (unsigned long)adapter; 3500 3476 adp.pdev = adapter->pdev; 3501 3477 adp.issue_uioc = megaraid_mbox_mm_handler; 3502 - adp.timeout = 300; 3478 + adp.timeout = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT; 3503 3479 adp.max_kioc = MBOX_MAX_USER_CMDS; 3504 3480 3505 3481 if ((rval = mraid_mm_register_adp(&adp)) != 0) { ··· 3726 3702 unsigned long flags; 3727 3703 3728 3704 kioc = (uioc_t *)scb->gp; 3729 - kioc->status = 0; 3730 3705 mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf; 3731 3706 mbox64->mbox32.status = scb->status; 3732 3707 raw_mbox = (uint8_t *)&mbox64->mbox32;
+5 -2
drivers/scsi/megaraid/megaraid_mbox.h
··· 21 21 #include "megaraid_ioctl.h" 22 22 23 23 24 - #define MEGARAID_VERSION "2.20.4.7" 25 - #define MEGARAID_EXT_VERSION "(Release Date: Mon Nov 14 12:27:22 EST 2005)" 24 + #define MEGARAID_VERSION "2.20.4.8" 25 + #define MEGARAID_EXT_VERSION "(Release Date: Mon Apr 11 12:27:22 EST 2006)" 26 26 27 27 28 28 /* ··· 100 100 #define MBOX_BUSY_WAIT 10 // max usec to wait for busy mailbox 101 101 #define MBOX_RESET_WAIT 180 // wait these many seconds in reset 102 102 #define MBOX_RESET_EXT_WAIT 120 // extended wait reset 103 + #define MBOX_SYNC_WAIT_CNT 0xFFFF // wait loop index for synchronous mode 104 + 105 + #define MBOX_SYNC_DELAY_200 200 // 200 micro-seconds 103 106 104 107 /* 105 108 * maximum transfer that can happen through the firmware commands issued
+2 -4
drivers/scsi/megaraid/megaraid_mm.c
··· 898 898 899 899 adapter = kmalloc(sizeof(mraid_mmadp_t), GFP_KERNEL); 900 900 901 - if (!adapter) { 902 - rval = -ENOMEM; 903 - goto memalloc_error; 904 - } 901 + if (!adapter) 902 + return -ENOMEM; 905 903 906 904 memset(adapter, 0, sizeof(mraid_mmadp_t)); 907 905
+11 -8
drivers/scsi/qla2xxx/qla_os.c
··· 599 599 * Either SUCCESS or FAILED. 600 600 * 601 601 * Note: 602 + * Only return FAILED if command not returned by firmware. 602 603 **************************************************************************/ 603 604 int 604 605 qla2xxx_eh_abort(struct scsi_cmnd *cmd) ··· 610 609 unsigned int id, lun; 611 610 unsigned long serial; 612 611 unsigned long flags; 612 + int wait = 0; 613 613 614 614 if (!CMD_SP(cmd)) 615 - return FAILED; 615 + return SUCCESS; 616 616 617 - ret = FAILED; 617 + ret = SUCCESS; 618 618 619 619 id = cmd->device->id; 620 620 lun = cmd->device->lun; ··· 644 642 } else { 645 643 DEBUG3(printk("%s(%ld): abort_command " 646 644 "mbx success.\n", __func__, ha->host_no)); 647 - ret = SUCCESS; 645 + wait = 1; 648 646 } 649 647 spin_lock_irqsave(&ha->hardware_lock, flags); 650 648 ··· 653 651 spin_unlock_irqrestore(&ha->hardware_lock, flags); 654 652 655 653 /* Wait for the command to be returned. */ 656 - if (ret == SUCCESS) { 654 + if (wait) { 657 655 if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) { 658 656 qla_printk(KERN_ERR, ha, 659 657 "scsi(%ld:%d:%d): Abort handler timed out -- %lx " 660 658 "%x.\n", ha->host_no, id, lun, serial, ret); 659 + ret = FAILED; 661 660 } 662 661 } 663 662 664 663 qla_printk(KERN_INFO, ha, 665 - "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no, 666 - id, lun, serial, ret); 664 + "scsi(%ld:%d:%d): Abort command issued -- %d %lx %x.\n", 665 + ha->host_no, id, lun, wait, serial, ret); 667 666 668 667 return ret; 669 668 } ··· 1703 1700 ha->flags.online = 0; 1704 1701 1705 1702 /* Detach interrupts */ 1706 - if (ha->pdev->irq) 1707 - free_irq(ha->pdev->irq, ha); 1703 + if (ha->host->irq) 1704 + free_irq(ha->host->irq, ha); 1708 1705 1709 1706 /* release io space registers */ 1710 1707 if (ha->iobase)
+2
drivers/scsi/scsi_devinfo.c
··· 56 56 {"DENON", "DRD-25X", "V", BLIST_NOLUN}, /* locks up */ 57 57 {"HITACHI", "DK312C", "CM81", BLIST_NOLUN}, /* responds to all lun */ 58 58 {"HITACHI", "DK314C", "CR21", BLIST_NOLUN}, /* responds to all lun */ 59 + {"IBM", "2104-DU3", NULL, BLIST_NOLUN}, /* locks up */ 60 + {"IBM", "2104-TU3", NULL, BLIST_NOLUN}, /* locks up */ 59 61 {"IMS", "CDD521/10", "2.06", BLIST_NOLUN}, /* locks up */ 60 62 {"MAXTOR", "XT-3280", "PR02", BLIST_NOLUN}, /* locks up */ 61 63 {"MAXTOR", "XT-4380S", "B3C", BLIST_NOLUN}, /* locks up */
+20 -7
drivers/scsi/scsi_lib.c
··· 1067 1067 break; 1068 1068 case NOT_READY: 1069 1069 /* 1070 - * If the device is in the process of becoming ready, 1071 - * retry. 1070 + * If the device is in the process of becoming 1071 + * ready, or has a temporary blockage, retry. 1072 1072 */ 1073 - if (sshdr.asc == 0x04 && sshdr.ascq == 0x01) { 1074 - scsi_requeue_command(q, cmd); 1075 - return; 1073 + if (sshdr.asc == 0x04) { 1074 + switch (sshdr.ascq) { 1075 + case 0x01: /* becoming ready */ 1076 + case 0x04: /* format in progress */ 1077 + case 0x05: /* rebuild in progress */ 1078 + case 0x06: /* recalculation in progress */ 1079 + case 0x07: /* operation in progress */ 1080 + case 0x08: /* Long write in progress */ 1081 + case 0x09: /* self test in progress */ 1082 + scsi_requeue_command(q, cmd); 1083 + return; 1084 + default: 1085 + break; 1086 + } 1076 1087 } 1077 - if (!(req->flags & REQ_QUIET)) 1088 + if (!(req->flags & REQ_QUIET)) { 1078 1089 scmd_printk(KERN_INFO, cmd, 1079 - "Device not ready.\n"); 1090 + "Device not ready: "); 1091 + scsi_print_sense_hdr("", &sshdr); 1092 + } 1080 1093 scsi_end_request(cmd, 0, this_count, 1); 1081 1094 return; 1082 1095 case VOLUME_OVERFLOW:
+1 -1
drivers/scsi/sim710.c
··· 75 75 else if(!strncmp(pos, "id:", 3)) { 76 76 if(slot == -1) { 77 77 printk(KERN_WARNING "sim710: Must specify slot for id parameter\n"); 78 - } else if(slot > MAX_SLOTS) { 78 + } else if(slot >= MAX_SLOTS) { 79 79 printk(KERN_WARNING "sim710: Illegal slot %d for id %d\n", slot, val); 80 80 } else { 81 81 id_array[slot] = val;
+17 -6
include/scsi/srp.h
··· 95 95 96 96 /* 97 97 * We need the packed attribute because the SRP spec puts the list of 98 - * descriptors at an offset of 20, which is not aligned to the size 99 - * of struct srp_direct_buf. 98 + * descriptors at an offset of 20, which is not aligned to the size of 99 + * struct srp_direct_buf. The whole structure must be packed to avoid 100 + * having the 20-byte structure padded to 24 bytes on 64-bit architectures. 100 101 */ 101 102 struct srp_indirect_buf { 102 103 struct srp_direct_buf table_desc; 103 104 __be32 len; 104 - struct srp_direct_buf desc_list[0] __attribute__((packed)); 105 - }; 105 + struct srp_direct_buf desc_list[0]; 106 + } __attribute__((packed)); 106 107 107 108 enum { 108 109 SRP_MULTICHAN_SINGLE = 0, ··· 123 122 u8 target_port_id[16]; 124 123 }; 125 124 125 + /* 126 + * The SRP spec defines the size of the LOGIN_RSP structure to be 52 127 + * bytes, so it needs to be packed to avoid having it padded to 56 128 + * bytes on 64-bit architectures. 129 + */ 126 130 struct srp_login_rsp { 127 131 u8 opcode; 128 132 u8 reserved1[3]; ··· 138 132 __be16 buf_fmt; 139 133 u8 rsp_flags; 140 134 u8 reserved2[25]; 141 - }; 135 + } __attribute__((packed)); 142 136 143 137 struct srp_login_rej { 144 138 u8 opcode; ··· 213 207 SRP_RSP_FLAG_DIUNDER = 1 << 5 214 208 }; 215 209 210 + /* 211 + * The SRP spec defines the size of the RSP structure to be 36 bytes, 212 + * so it needs to be packed to avoid having it padded to 40 bytes on 213 + * 64-bit architectures. 214 + */ 216 215 struct srp_rsp { 217 216 u8 opcode; 218 217 u8 sol_not; ··· 232 221 __be32 sense_data_len; 233 222 __be32 resp_data_len; 234 223 u8 data[0]; 235 - }; 224 + } __attribute__((packed)); 236 225 237 226 #endif /* SCSI_SRP_H */