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

[SCSI] mpt fusion: Queue full event handling

FW will report Queue full event to Driver and driver will handle this queue
full event to SCSI Mid layer.

Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

authored by

Kashyap, Desai and committed by
James Bottomley
57e98513 a7938b0b

+139
+133
drivers/message/fusion/mptsas.c
··· 121 121 static void mptsas_send_expander_event(struct fw_event_work *fw_event); 122 122 static void mptsas_not_responding_devices(MPT_ADAPTER *ioc); 123 123 static void mptsas_scan_sas_topology(MPT_ADAPTER *ioc); 124 + static void mptsas_handle_queue_full_event(struct fw_event_work *fw_event); 124 125 static void mptsas_volume_delete(MPT_ADAPTER *ioc, u8 id); 125 126 126 127 static void mptsas_print_phy_data(MPT_ADAPTER *ioc, ··· 681 680 mptsas_add_device_component_by_fw(ioc, phys_disk.PhysDiskBus, 682 681 phys_disk.PhysDiskID); 683 682 683 + mutex_lock(&ioc->sas_device_info_mutex); 684 + list_for_each_entry(sas_info, &ioc->sas_device_info_list, 685 + list) { 686 + if (!sas_info->is_logical_volume && 687 + (sas_info->fw.channel == phys_disk.PhysDiskBus && 688 + sas_info->fw.id == phys_disk.PhysDiskID)) { 689 + sas_info->is_hidden_raid_component = 1; 690 + sas_info->volume_id = starget->id; 691 + } 692 + } 693 + mutex_unlock(&ioc->sas_device_info_mutex); 694 + 684 695 } 685 696 686 697 /* ··· 757 744 phy_info->attached.id, phy_info->attached.sas_address, 758 745 phy_info->attached.device_info, 759 746 phy_info->attached.slot, enclosure_info.enclosure_logical_id); 747 + } 748 + 749 + /** 750 + * mptsas_del_device_component_by_os - Once a device has been removed, we 751 + * mark the entry in the list as being cached 752 + * @ioc: Pointer to MPT_ADAPTER structure 753 + * @channel: os mapped id's 754 + * @id: 755 + * 756 + **/ 757 + static void 758 + mptsas_del_device_component_by_os(MPT_ADAPTER *ioc, u8 channel, u8 id) 759 + { 760 + struct mptsas_device_info *sas_info, *next; 761 + 762 + /* 763 + * Set is_cached flag 764 + */ 765 + list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list, 766 + list) { 767 + if (sas_info->os.channel == channel && sas_info->os.id == id) 768 + sas_info->is_cached = 1; 769 + } 760 770 } 761 771 762 772 /** ··· 1612 1576 case MPI_EVENT_SAS_PHY_LINK_STATUS: 1613 1577 mptsas_send_link_status_event(fw_event); 1614 1578 break; 1579 + case MPI_EVENT_QUEUE_FULL: 1580 + mptsas_handle_queue_full_event(fw_event); 1581 + break; 1615 1582 } 1616 1583 } 1617 1584 ··· 1743 1704 return; 1744 1705 1745 1706 vtarget = starget->hostdata; 1707 + 1708 + mptsas_del_device_component_by_os(ioc, starget->channel, 1709 + starget->id); 1746 1710 1747 1711 1748 1712 if (starget->channel == MPTSAS_RAID_CHANNEL) ··· 3440 3398 mutex_lock(&ioc->sas_device_info_mutex); 3441 3399 redo_device_scan: 3442 3400 list_for_each_entry(sas_info, &ioc->sas_device_info_list, list) { 3401 + if (sas_info->is_cached) 3402 + continue; 3443 3403 if (!sas_info->is_logical_volume) { 3444 3404 sas_device.handle = 0; 3445 3405 retry_count = 0; ··· 3655 3611 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0); 3656 3612 } 3657 3613 } 3614 + 3615 + 3616 + static void 3617 + mptsas_handle_queue_full_event(struct fw_event_work *fw_event) 3618 + { 3619 + MPT_ADAPTER *ioc; 3620 + EventDataQueueFull_t *qfull_data; 3621 + struct mptsas_device_info *sas_info; 3622 + struct scsi_device *sdev; 3623 + int depth; 3624 + int id = -1; 3625 + int channel = -1; 3626 + int fw_id, fw_channel; 3627 + u16 current_depth; 3628 + 3629 + 3630 + ioc = fw_event->ioc; 3631 + qfull_data = (EventDataQueueFull_t *)fw_event->event_data; 3632 + fw_id = qfull_data->TargetID; 3633 + fw_channel = qfull_data->Bus; 3634 + current_depth = le16_to_cpu(qfull_data->CurrentDepth); 3635 + 3636 + /* if hidden raid component, look for the volume id */ 3637 + mutex_lock(&ioc->sas_device_info_mutex); 3638 + if (mptscsih_is_phys_disk(ioc, fw_channel, fw_id)) { 3639 + list_for_each_entry(sas_info, &ioc->sas_device_info_list, 3640 + list) { 3641 + if (sas_info->is_cached || 3642 + sas_info->is_logical_volume) 3643 + continue; 3644 + if (sas_info->is_hidden_raid_component && 3645 + (sas_info->fw.channel == fw_channel && 3646 + sas_info->fw.id == fw_id)) { 3647 + id = sas_info->volume_id; 3648 + channel = MPTSAS_RAID_CHANNEL; 3649 + goto out; 3650 + } 3651 + } 3652 + } else { 3653 + list_for_each_entry(sas_info, &ioc->sas_device_info_list, 3654 + list) { 3655 + if (sas_info->is_cached || 3656 + sas_info->is_hidden_raid_component || 3657 + sas_info->is_logical_volume) 3658 + continue; 3659 + if (sas_info->fw.channel == fw_channel && 3660 + sas_info->fw.id == fw_id) { 3661 + id = sas_info->os.id; 3662 + channel = sas_info->os.channel; 3663 + goto out; 3664 + } 3665 + } 3666 + 3667 + } 3668 + 3669 + out: 3670 + mutex_unlock(&ioc->sas_device_info_mutex); 3671 + 3672 + if (id != -1) { 3673 + shost_for_each_device(sdev, ioc->sh) { 3674 + if (sdev->id == id && sdev->channel == channel) { 3675 + if (current_depth > sdev->queue_depth) { 3676 + sdev_printk(KERN_INFO, sdev, 3677 + "strange observation, the queue " 3678 + "depth is (%d) meanwhile fw queue " 3679 + "depth (%d)\n", sdev->queue_depth, 3680 + current_depth); 3681 + continue; 3682 + } 3683 + depth = scsi_track_queue_full(sdev, 3684 + current_depth - 1); 3685 + if (depth > 0) 3686 + sdev_printk(KERN_INFO, sdev, 3687 + "Queue depth reduced to (%d)\n", 3688 + depth); 3689 + else if (depth < 0) 3690 + sdev_printk(KERN_INFO, sdev, 3691 + "Tagged Command Queueing is being " 3692 + "disabled\n"); 3693 + else if (depth == 0) 3694 + sdev_printk(KERN_INFO, sdev, 3695 + "Queue depth not changed yet\n"); 3696 + } 3697 + } 3698 + } 3699 + 3700 + mptsas_free_fw_event(ioc, fw_event); 3701 + } 3702 + 3658 3703 3659 3704 static struct mptsas_phyinfo * 3660 3705 mptsas_find_phyinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address)
+6
drivers/message/fusion/mptsas.h
··· 83 83 u16 slot; /* enclosure slot id */ 84 84 u64 enclosure_logical_id; /*enclosure address */ 85 85 u8 is_logical_volume; /* is this logical volume */ 86 + /* this belongs to volume */ 87 + u8 is_hidden_raid_component; 88 + /* this valid when is_hidden_raid_component set */ 89 + u8 volume_id; 90 + /* cached data for a removed device */ 91 + u8 is_cached; 86 92 }; 87 93 88 94 struct mptsas_hotplug_event {