From patchwork Mon Apr 20 12:32:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Saxena X-Patchwork-Id: 6241811 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC143BF4A6 for ; Mon, 20 Apr 2015 12:49:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B84CD2034E for ; Mon, 20 Apr 2015 12:49:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 32DE62034A for ; Mon, 20 Apr 2015 12:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755298AbbDTMte (ORCPT ); Mon, 20 Apr 2015 08:49:34 -0400 Received: from mail-by2lp0235.outbound.protection.outlook.com ([207.46.163.235]:29293 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755180AbbDTMtd (ORCPT ); Mon, 20 Apr 2015 08:49:33 -0400 Received: from BLUPR07CA0043.namprd07.prod.outlook.com (10.255.223.156) by BLUPR07MB356.namprd07.prod.outlook.com (10.141.26.26) with Microsoft SMTP Server (TLS) id 15.1.136.25; Mon, 20 Apr 2015 12:33:36 +0000 Received: from BN1AFFO11OLC002.protection.gbl (2a01:111:f400:7c10::155) by BLUPR07CA0043.outlook.office365.com (2a01:111:e400:841::28) with Microsoft SMTP Server (TLS) id 15.1.136.25 via Frontend Transport; Mon, 20 Apr 2015 12:33:36 +0000 Authentication-Results: spf=softfail (sender IP is 192.19.192.197) smtp.mailfrom=avagotech.com; parallels.com; dkim=none (message not signed) header.d=none; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning avagotech.com discourages use of 192.19.192.197 as permitted sender) Received: from PALEXCH12.lsi.com (192.19.192.197) by BN1AFFO11OLC002.mail.protection.outlook.com (10.58.53.73) with Microsoft SMTP Server (TLS) id 15.1.148.11 via Frontend Transport; Mon, 20 Apr 2015 12:33:35 +0000 Received: from palmhbs0.lsi.com (128.94.222.181) by PALEXCH12-EXT.lsi.com (128.94.222.103) with Microsoft SMTP Server id 14.3.158.1; Mon, 20 Apr 2015 08:33:19 -0400 Received: from localhost (dhcp-135-24-192-138.lsi.com [135.24.192.138]) by palmhbs0.lsi.com (8.13.8/8.12.11) with ESMTP id t3KCYqUk016436; Mon, 20 Apr 2015 08:34:53 -0400 From: Message-ID: <201504201234.t3KCYqUk016436@palmhbs0.lsi.com> Date: Mon, 20 Apr 2015 18:02:40 +0530 To: Subject: [PATCH RESEND 2/18] megaraid_sas : Add separate function for refiring MFI commands CC: , , , , , User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.19.192.197; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; BMV:1; SFV:NSPM; SFS:(10009020)(6009001)(189002)(199003)(76506005)(92566002)(16796002)(50466002)(50986999)(2220100001)(106466001)(4001350100001)(46406003)(57986006)(54356999)(229853001)(46102003)(23726002)(62966003)(77156002)(19580405001)(97756001)(83506001)(6806004)(87936001)(47776003)(86362001)(86152002)(2351001)(110136001)(105596002)(19580395003)(4001430100001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR07MB356; H:PALEXCH12.lsi.com; FPR:; SPF:SoftFail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR07MB356; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(5002010); SRVR:BLUPR07MB356; BCL:0; PCL:0; RULEID:; SRVR:BLUPR07MB356; X-Forefront-PRVS: 05529C6FDB X-OriginatorOrg: lsicorp.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2015 12:33:35.4556 (UTC) X-MS-Exchange-CrossTenant-Id: 33102e38-078a-4484-9fb5-731e8b59db69 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=33102e38-078a-4484-9fb5-731e8b59db69; Ip=[192.19.192.197]; Helo=[PALEXCH12.lsi.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR07MB356 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch will add separate function for refiring MFI commands in Fusion adapters's OCR code. Signed-off-by: Kashyap Desai Signed-off-by: Sumit Saxena Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 80 +++++++++++++-------------- 1 files changed, 39 insertions(+), 41 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 675b5e7..6637bea 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -2508,6 +2508,43 @@ void megasas_reset_reply_desc(struct megasas_instance *instance) reply_desc->Words = ULLONG_MAX; } +/* + * megasas_refire_mgmt_cmd : Re-fire management commands + * @instance: Controller's soft instance +*/ +void megasas_refire_mgmt_cmd(struct megasas_instance *instance) +{ + int j; + struct megasas_cmd_fusion *cmd_fusion; + struct fusion_context *fusion; + struct megasas_cmd *cmd_mfi; + union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc; + u16 smid; + + fusion = instance->ctrl_context; + + /* Re-fire management commands. + * Do not traverse complet MPT frame pool. Start from max_scsi_cmds. + */ + for (j = instance->max_scsi_cmds ; j < instance->max_fw_cmds; j++) { + cmd_fusion = fusion->cmd_list[j]; + cmd_mfi = instance->cmd_list[cmd_fusion->sync_cmd_idx]; + smid = le16_to_cpu(cmd_mfi->context.smid); + + if (!smid) + continue; + req_desc = megasas_get_request_descriptor + (instance, smid - 1); + if (req_desc && (cmd_mfi->frame->dcmd.opcode != + cpu_to_le32(MR_DCMD_LD_MAP_GET_INFO))) { + instance->instancet->fire_cmd(instance, + req_desc->u.low, req_desc->u.high, + instance->reg_set); + } else + megasas_return_cmd(instance, cmd_mfi); + } +} + /* Check for a second path that is currently UP */ int megasas_check_mpio_paths(struct megasas_instance *instance, struct scsi_cmnd *scmd) @@ -2535,12 +2572,10 @@ out: /* Core fusion reset function */ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout) { - int retval = SUCCESS, i, j, retry = 0, convert = 0; + int retval = SUCCESS, i, retry = 0, convert = 0; struct megasas_instance *instance; struct megasas_cmd_fusion *cmd_fusion; struct fusion_context *fusion; - struct megasas_cmd *cmd_mfi; - union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc; u32 host_diag, abs_state, status_reg, reset_adapter; u32 io_timeout_in_crash_mode = 0; @@ -2787,44 +2822,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout) continue; } - /* Re-fire management commands */ - for (j = 0 ; j < instance->max_fw_cmds; j++) { - cmd_fusion = fusion->cmd_list[j]; - if (cmd_fusion->sync_cmd_idx != - (u32)ULONG_MAX) { - cmd_mfi = - instance-> - cmd_list[cmd_fusion->sync_cmd_idx]; - if (cmd_mfi->frame->dcmd.opcode == - cpu_to_le32(MR_DCMD_LD_MAP_GET_INFO)) { - megasas_return_mfi_mpt_pthr(instance, cmd_mfi, cmd_fusion); - } else { - req_desc = - megasas_get_request_descriptor( - instance, - cmd_mfi->context.smid - -1); - if (!req_desc) { - printk(KERN_WARNING - "req_desc NULL" - " for scsi%d\n", - instance->host->host_no); - /* Return leaked MPT - frame */ - megasas_return_cmd_fusion(instance, cmd_fusion); - } else { - instance->instancet-> - fire_cmd(instance, - req_desc-> - u.low, - req_desc-> - u.high, - instance-> - reg_set); - } - } - } - } + megasas_refire_mgmt_cmd(instance); if (megasas_get_ctrl_info(instance)) { dev_info(&instance->pdev->dev,