aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>2017-10-31 08:32:35 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2017-11-03 12:20:52 -0400
commit6ce2f1d16cac243fa00ede738d0f1567df13ad8c (patch)
treefdd27acf537baf793b5c8b1c25fc45b0648b7a0a
parentec051e5a4bbaa98994ca7512eac68565406cfe8b (diff)
scsi: mpt3sas: Add-Task-management-debug-info-for-NVMe-drives.
Added debug information for NVMe/PCIe drives in target rest path Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com> Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_scsih.c80
1 files changed, 71 insertions, 9 deletions
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 09f90f133fd3..9c2492a2a628 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -2928,6 +2928,7 @@ _scsih_tm_display_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd)
2928 struct scsi_target *starget = scmd->device->sdev_target; 2928 struct scsi_target *starget = scmd->device->sdev_target;
2929 struct MPT3SAS_TARGET *priv_target = starget->hostdata; 2929 struct MPT3SAS_TARGET *priv_target = starget->hostdata;
2930 struct _sas_device *sas_device = NULL; 2930 struct _sas_device *sas_device = NULL;
2931 struct _pcie_device *pcie_device = NULL;
2931 unsigned long flags; 2932 unsigned long flags;
2932 char *device_str = NULL; 2933 char *device_str = NULL;
2933 2934
@@ -2944,6 +2945,31 @@ _scsih_tm_display_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd)
2944 "%s handle(0x%04x), %s wwid(0x%016llx)\n", 2945 "%s handle(0x%04x), %s wwid(0x%016llx)\n",
2945 device_str, priv_target->handle, 2946 device_str, priv_target->handle,
2946 device_str, (unsigned long long)priv_target->sas_address); 2947 device_str, (unsigned long long)priv_target->sas_address);
2948
2949 } else if (priv_target->flags & MPT_TARGET_FLAGS_PCIE_DEVICE) {
2950 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
2951 pcie_device = __mpt3sas_get_pdev_from_target(ioc, priv_target);
2952 if (pcie_device) {
2953 starget_printk(KERN_INFO, starget,
2954 "handle(0x%04x), wwid(0x%016llx), port(%d)\n",
2955 pcie_device->handle,
2956 (unsigned long long)pcie_device->wwid,
2957 pcie_device->port_num);
2958 if (pcie_device->enclosure_handle != 0)
2959 starget_printk(KERN_INFO, starget,
2960 "enclosure logical id(0x%016llx), slot(%d)\n",
2961 (unsigned long long)
2962 pcie_device->enclosure_logical_id,
2963 pcie_device->slot);
2964 if (pcie_device->connector_name[0] != '\0')
2965 starget_printk(KERN_INFO, starget,
2966 "enclosure level(0x%04x), connector name( %s)\n",
2967 pcie_device->enclosure_level,
2968 pcie_device->connector_name);
2969 pcie_device_put(pcie_device);
2970 }
2971 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
2972
2947 } else { 2973 } else {
2948 spin_lock_irqsave(&ioc->sas_device_lock, flags); 2974 spin_lock_irqsave(&ioc->sas_device_lock, flags);
2949 sas_device = __mpt3sas_get_sdev_from_target(ioc, priv_target); 2975 sas_device = __mpt3sas_get_sdev_from_target(ioc, priv_target);
@@ -3679,18 +3705,14 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle)
3679 Mpi2SCSITaskManagementRequest_t *mpi_request; 3705 Mpi2SCSITaskManagementRequest_t *mpi_request;
3680 u16 smid; 3706 u16 smid;
3681 struct _sas_device *sas_device = NULL; 3707 struct _sas_device *sas_device = NULL;
3708 struct _pcie_device *pcie_device = NULL;
3682 struct MPT3SAS_TARGET *sas_target_priv_data = NULL; 3709 struct MPT3SAS_TARGET *sas_target_priv_data = NULL;
3683 u64 sas_address = 0; 3710 u64 sas_address = 0;
3684 unsigned long flags; 3711 unsigned long flags;
3685 struct _tr_list *delayed_tr; 3712 struct _tr_list *delayed_tr;
3686 u32 ioc_state; 3713 u32 ioc_state;
3687 3714
3688 if (ioc->remove_host) { 3715 if (ioc->pci_error_recovery) {
3689 dewtprintk(ioc, pr_info(MPT3SAS_FMT
3690 "%s: host has been removed: handle(0x%04x)\n",
3691 __func__, ioc->name, handle));
3692 return;
3693 } else if (ioc->pci_error_recovery) {
3694 dewtprintk(ioc, pr_info(MPT3SAS_FMT 3716 dewtprintk(ioc, pr_info(MPT3SAS_FMT
3695 "%s: host in pci error recovery: handle(0x%04x)\n", 3717 "%s: host in pci error recovery: handle(0x%04x)\n",
3696 __func__, ioc->name, 3718 __func__, ioc->name,
@@ -3721,14 +3743,52 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle)
3721 sas_address = sas_device->sas_address; 3743 sas_address = sas_device->sas_address;
3722 } 3744 }
3723 spin_unlock_irqrestore(&ioc->sas_device_lock, flags); 3745 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
3724 3746 if (!sas_device) {
3747 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
3748 pcie_device = __mpt3sas_get_pdev_by_handle(ioc, handle);
3749 if (pcie_device && pcie_device->starget &&
3750 pcie_device->starget->hostdata) {
3751 sas_target_priv_data = pcie_device->starget->hostdata;
3752 sas_target_priv_data->deleted = 1;
3753 sas_address = pcie_device->wwid;
3754 }
3755 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
3756 }
3725 if (sas_target_priv_data) { 3757 if (sas_target_priv_data) {
3726 dewtprintk(ioc, pr_info(MPT3SAS_FMT 3758 dewtprintk(ioc, pr_info(MPT3SAS_FMT
3727 "setting delete flag: handle(0x%04x), sas_addr(0x%016llx)\n", 3759 "setting delete flag: handle(0x%04x), sas_addr(0x%016llx)\n",
3728 ioc->name, handle, 3760 ioc->name, handle,
3729 (unsigned long long)sas_address)); 3761 (unsigned long long)sas_address));
3730 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, 3762 if (sas_device) {
3731 sas_device, NULL, NULL)); 3763 if (sas_device->enclosure_handle != 0)
3764 dewtprintk(ioc, pr_info(MPT3SAS_FMT
3765 "setting delete flag:enclosure logical "
3766 "id(0x%016llx), slot(%d)\n", ioc->name,
3767 (unsigned long long)
3768 sas_device->enclosure_logical_id,
3769 sas_device->slot));
3770 if (sas_device->connector_name[0] != '\0')
3771 dewtprintk(ioc, pr_info(MPT3SAS_FMT
3772 "setting delete flag: enclosure "
3773 "level(0x%04x), connector name( %s)\n",
3774 ioc->name, sas_device->enclosure_level,
3775 sas_device->connector_name));
3776 } else if (pcie_device) {
3777 if (pcie_device->enclosure_handle != 0)
3778 dewtprintk(ioc, pr_info(MPT3SAS_FMT
3779 "setting delete flag: logical "
3780 "id(0x%016llx), slot(%d)\n", ioc->name,
3781 (unsigned long long)
3782 pcie_device->enclosure_logical_id,
3783 pcie_device->slot));
3784 if (pcie_device->connector_name[0] != '\0')
3785 dewtprintk(ioc, pr_info(MPT3SAS_FMT
3786 "setting delete flag:, enclosure "
3787 "level(0x%04x), "
3788 "connector name( %s)\n", ioc->name,
3789 pcie_device->enclosure_level,
3790 pcie_device->connector_name));
3791 }
3732 _scsih_ublock_io_device(ioc, sas_address); 3792 _scsih_ublock_io_device(ioc, sas_address);
3733 sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE; 3793 sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE;
3734 } 3794 }
@@ -3763,6 +3823,8 @@ _scsih_tm_tr_send(struct MPT3SAS_ADAPTER *ioc, u16 handle)
3763out: 3823out:
3764 if (sas_device) 3824 if (sas_device)
3765 sas_device_put(sas_device); 3825 sas_device_put(sas_device);
3826 if (pcie_device)
3827 pcie_device_put(pcie_device);
3766} 3828}
3767 3829
3768/** 3830/**