Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755145AbXI1USZ (ORCPT ); Fri, 28 Sep 2007 16:18:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752157AbXI1USP (ORCPT ); Fri, 28 Sep 2007 16:18:15 -0400 Received: from mail0.lsil.com ([147.145.40.20]:51734 "EHLO mail0.lsil.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751647AbXI1USO (ORCPT ); Fri, 28 Sep 2007 16:18:14 -0400 Subject: [PATCH 4/8] scsi: megaraid_sas - check max_sgl reported by FW for setting max_sectors_per_req From: bo yang To: linux-scsi@vger.kernel.org Cc: James.Bottomley@SteelEye.com, akpm@osdl.org, linux-kernel@vger.kernel.org, Bo.yang@lsi.com, Sumant.patro@lsi.com Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Wed, 26 Sep 2007 11:35:36 -0400 Message-Id: <1190820936.5955.17.camel@dhcp-75-534.se.lsil.com> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-35.el4) X-OriginalArrivalTime: 28 Sep 2007 20:18:02.0023 (UTC) FILETIME=[AB803B70:01C8020C] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2985 Lines: 70 1. Setting the max_sectors_per_req based on max SGL supported by the FW. Prior versions calculated this value from controller info's max_sectors_1, max_sectors_2. For certain controllers/FW, this was resulting in a value greater than max SGL supported by the FW. Now we take the min of max sgl from FW and max_sectors calculation. 2. Increased MFI_POLL_TIMEOUT_SECS to 60 seconds from 10. FW may take a max of 60 seconds to respond to the INIT cmd. Signed-off-by: Bo Yang --- drivers/scsi/megaraid/megaraid_sas.c | 13 +++++++++---- drivers/scsi/megaraid/megaraid_sas.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff -uprN linux-2.6.22_orig/drivers/scsi/megaraid/megaraid_sas.c linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c --- linux-2.6.22_orig/drivers/scsi/megaraid/megaraid_sas.c 2007-09-27 20:40:14.000000000 -0700 +++ linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.c 2007-09-27 04:39:44.000000000 -0700 @@ -1960,6 +1960,7 @@ static int megasas_init_mfi(struct megas u32 reply_q_sz; u32 max_sectors_1; u32 max_sectors_2; + u32 tmp_sectors; struct megasas_register_set __iomem *reg_set; struct megasas_ctrl_info *ctrl_info; /* @@ -2052,17 +2053,21 @@ static int megasas_init_mfi(struct megas * Note that older firmwares ( < FW ver 30) didn't report information * to calculate max_sectors_1. So the number ended up as zero always. */ + tmp_sectors = 0; if (ctrl_info && !megasas_get_ctrl_info(instance, ctrl_info)) { max_sectors_1 = (1 << ctrl_info->stripe_sz_ops.min) * ctrl_info->max_strips_per_io; max_sectors_2 = ctrl_info->max_request_size; - instance->max_sectors_per_req = (max_sectors_1 < max_sectors_2) + tmp_sectors = (max_sectors_1 < max_sectors_2) ? max_sectors_1 : max_sectors_2; - } else - instance->max_sectors_per_req = instance->max_num_sge * - PAGE_SIZE / 512; + } + + instance->max_sectors_per_req = instance->max_num_sge * + PAGE_SIZE / 512; + if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors)) + instance->max_sectors_per_req = tmp_sectors; kfree(ctrl_info); diff -uprN linux-2.6.22_orig/drivers/scsi/megaraid/megaraid_sas.h linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.h --- linux-2.6.22_orig/drivers/scsi/megaraid/megaraid_sas.h 2007-09-26 13:40:36.000000000 -0700 +++ linux-2.6.22_new/drivers/scsi/megaraid/megaraid_sas.h 2007-09-26 14:10:59.000000000 -0700 @@ -572,7 +572,7 @@ struct megasas_ctrl_info { #define IS_DMA64 (sizeof(dma_addr_t) == 8) #define MFI_OB_INTR_STATUS_MASK 0x00000002 -#define MFI_POLL_TIMEOUT_SECS 10 +#define MFI_POLL_TIMEOUT_SECS 60 #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/