aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Saxena <sumit.saxena@broadcom.com>2016-04-15 03:23:32 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-04-15 16:53:21 -0400
commitbd23d4abe5edf09dfba086d44b7972cf73c14b0b (patch)
tree4530382437e79b6fbe769bba5e04d59c6ff05b74
parent64d0b8e4a6f7e9a3c366c2df93ec1f003d180ca3 (diff)
megaraid_sas: task management code optimizations
This patch will do code optmization for task management functions. Below are key changes: 1. Remove reset_device hook as it was not being used and driver was setting this to NULL. 2. Create wrapper functions for task abort and target reset and inside these functions adapter specific calls be made. e.g. fusion adapters support task abort and target reset so task abort and target reset should be issued to fusion adapters only and for MFI adapters, print a message saying feature not supported. Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c67
1 files changed, 46 insertions, 21 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 858820255dcb..b84756c1d230 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -2670,17 +2670,6 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)
2670} 2670}
2671 2671
2672/** 2672/**
2673 * megasas_reset_device - Device reset handler entry point
2674 */
2675static int megasas_reset_device(struct scsi_cmnd *scmd)
2676{
2677 /*
2678 * First wait for all commands to complete
2679 */
2680 return megasas_generic_reset(scmd);
2681}
2682
2683/**
2684 * megasas_reset_bus_host - Bus & host reset handler entry point 2673 * megasas_reset_bus_host - Bus & host reset handler entry point
2685 */ 2674 */
2686static int megasas_reset_bus_host(struct scsi_cmnd *scmd) 2675static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
@@ -2702,6 +2691,50 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
2702} 2691}
2703 2692
2704/** 2693/**
2694 * megasas_task_abort - Issues task abort request to firmware
2695 * (supported only for fusion adapters)
2696 * @scmd: SCSI command pointer
2697 */
2698static int megasas_task_abort(struct scsi_cmnd *scmd)
2699{
2700 int ret;
2701 struct megasas_instance *instance;
2702
2703 instance = (struct megasas_instance *)scmd->device->host->hostdata;
2704
2705 if (instance->ctrl_context)
2706 ret = megasas_task_abort_fusion(scmd);
2707 else {
2708 sdev_printk(KERN_NOTICE, scmd->device, "TASK ABORT not supported\n");
2709 ret = FAILED;
2710 }
2711
2712 return ret;
2713}
2714
2715/**
2716 * megasas_reset_target: Issues target reset request to firmware
2717 * (supported only for fusion adapters)
2718 * @scmd: SCSI command pointer
2719 */
2720static int megasas_reset_target(struct scsi_cmnd *scmd)
2721{
2722 int ret;
2723 struct megasas_instance *instance;
2724
2725 instance = (struct megasas_instance *)scmd->device->host->hostdata;
2726
2727 if (instance->ctrl_context)
2728 ret = megasas_reset_target_fusion(scmd);
2729 else {
2730 sdev_printk(KERN_NOTICE, scmd->device, "TARGET RESET not supported\n");
2731 ret = FAILED;
2732 }
2733
2734 return ret;
2735}
2736
2737/**
2705 * megasas_bios_param - Returns disk geometry for a disk 2738 * megasas_bios_param - Returns disk geometry for a disk
2706 * @sdev: device handle 2739 * @sdev: device handle
2707 * @bdev: block device 2740 * @bdev: block device
@@ -2969,8 +3002,8 @@ static struct scsi_host_template megasas_template = {
2969 .slave_alloc = megasas_slave_alloc, 3002 .slave_alloc = megasas_slave_alloc,
2970 .slave_destroy = megasas_slave_destroy, 3003 .slave_destroy = megasas_slave_destroy,
2971 .queuecommand = megasas_queue_command, 3004 .queuecommand = megasas_queue_command,
2972 .eh_device_reset_handler = megasas_reset_device, 3005 .eh_target_reset_handler = megasas_reset_target,
2973 .eh_bus_reset_handler = megasas_reset_bus_host, 3006 .eh_abort_handler = megasas_task_abort,
2974 .eh_host_reset_handler = megasas_reset_bus_host, 3007 .eh_host_reset_handler = megasas_reset_bus_host,
2975 .eh_timed_out = megasas_reset_timer, 3008 .eh_timed_out = megasas_reset_timer,
2976 .shost_attrs = megaraid_host_attrs, 3009 .shost_attrs = megaraid_host_attrs,
@@ -5598,14 +5631,6 @@ static int megasas_io_attach(struct megasas_instance *instance)
5598 host->max_lun = MEGASAS_MAX_LUN; 5631 host->max_lun = MEGASAS_MAX_LUN;
5599 host->max_cmd_len = 16; 5632 host->max_cmd_len = 16;
5600 5633
5601 /* Fusion only supports host reset */
5602 if (instance->ctrl_context) {
5603 host->hostt->eh_device_reset_handler = NULL;
5604 host->hostt->eh_bus_reset_handler = NULL;
5605 host->hostt->eh_target_reset_handler = megasas_reset_target_fusion;
5606 host->hostt->eh_abort_handler = megasas_task_abort_fusion;
5607 }
5608
5609 /* 5634 /*
5610 * Notify the mid-layer about the new controller 5635 * Notify the mid-layer about the new controller
5611 */ 5636 */