From patchwork Fri Jun 12 09:42:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 6596841 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 EC51FC0020 for ; Fri, 12 Jun 2015 09:46:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2654720685 for ; Fri, 12 Jun 2015 09:46:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3137120680 for ; Fri, 12 Jun 2015 09:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932604AbbFLJoN (ORCPT ); Fri, 12 Jun 2015 05:44:13 -0400 Received: from mail-qk0-f179.google.com ([209.85.220.179]:33315 "EHLO mail-qk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932547AbbFLJoF (ORCPT ); Fri, 12 Jun 2015 05:44:05 -0400 Received: by qkhg32 with SMTP id g32so14884853qkh.0 for ; Fri, 12 Jun 2015 02:44:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=avagotech.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bUqXlmS8PcNaP9VkICj6mhrdbw6jmVrR9Faj/CHv85o=; b=GPdxojF4ucZj3rtMZ/iokwdYvaNAtYx54XNtwIqf59XaX7JU5D2AhHlAzCMilC1Inr etA1X7VX9GBt+ObI1/5Gqy/pzoh69Hf3oTI3gTTGUAduCS5Ng+ASDHhQZFQYQvyvJruY 9j2Ghoas1X5i/ZIOUt7lxNXGOe847wUaEbQt4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bUqXlmS8PcNaP9VkICj6mhrdbw6jmVrR9Faj/CHv85o=; b=bT5Ow/6MiVuZwyG1p+uNW2uEN6YSHEooKM/yIuMS/zww+2yCmuqvVl8uVm2R9ey9lk gTJumz4aixxKyCFJps6+S1XSCadRo2wtzgkWvLmnNkcHS6a89W3LI0/vSUgUk6KZhHNz skRMYqEVqrF05XOYtV8HSrT/dAEN0CZbMqFr7PjqJU2gFlChLwXKmPBIgZT+0o+Wrj3y E8f7Uk0/Cjt/nrqBOMtdY4cXVp2vH0OktMjQSdQwUXu1rfqwptNI7J43Y9iBuS/dbj2f 3GJvjpLyrfCZ4MfZFlCHFqLgZ3AMH6yOrdpVeUf+9DYeDgXJc0JQEGgEvczw2LRlBtQ8 cYbQ== X-Gm-Message-State: ALoCoQnkf4yP0oBsV/Agckbf3a4t3wFfJw7UMbP52jWp0qKDT9A0ySz04ypU5z17DlmPFCa/kUGx X-Received: by 10.140.34.81 with SMTP id k75mr17032729qgk.56.1434102244461; Fri, 12 Jun 2015 02:44:04 -0700 (PDT) Received: from host1.lsi.com ([192.19.239.250]) by mx.google.com with ESMTPSA id 18sm1466219qgh.40.2015.06.12.02.43.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jun 2015 02:44:03 -0700 (PDT) From: Sreekanth Reddy X-Google-Original-From: Sreekanth Reddy To: jejb@kernel.org, hch@infradead.org Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, JBottomley@Parallels.com, Sathya.Prakash@avagotech.com, linux-kernel@vger.kernel.org, Sreekanth Reddy Subject: [PATCH 15/20] [SCSI] mpt3sas: Return host busy error status to SML when DMA mapping of scatter gather list fails for a SCSI command Date: Fri, 12 Jun 2015 15:12:27 +0530 Message-Id: <1434102153-38581-16-git-send-email-Sreekanth.Reddy@avagotech.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1434102153-38581-1-git-send-email-Sreekanth.Reddy@avagotech.com> References: <1434102153-38581-1-git-send-email-Sreekanth.Reddy@avagotech.com> 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,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 scsi_dma_map API will return a negative value (i.e. -ENOMEM) if DMA mapping of sg lists fails and zero if the sg list in the SCSI cmd is NULL. But drivers doesn't handled sg list DMA mapping failure case properly. So, Updated the code to return host busy error status to SCSI MID Layer(SML), when DMA mapping of scatter gather list fails for a SCSI command. So that SML will retry this SCSI cmd after some time. Signed-off-by: Sreekanth Reddy Reviewed-by: Johannes Thumshirn Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/mpt3sas_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 267e489..0b26c8d 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1345,7 +1345,7 @@ _base_build_sg_scmd_ieee(struct MPT3SAS_ADAPTER *ioc, sg_scmd = scsi_sglist(scmd); sges_left = scsi_dma_map(scmd); - if (!sges_left) { + if (!sges_left < 0) { sdev_printk(KERN_ERR, scmd->device, "pci_map_sg failed: request for %d bytes!\n", scsi_bufflen(scmd)); @@ -1414,7 +1414,7 @@ _base_build_sg_scmd_ieee(struct MPT3SAS_ADAPTER *ioc, fill_in_last_segment: /* fill the last segment */ - while (sges_left) { + while (sges_left > 0) { if (sges_left == 1) _base_add_sg_single_ieee(sg_local, simple_sgl_flags_last, 0, sg_dma_len(sg_scmd),