From patchwork Tue Jun 30 06:55:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 6694061 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 CB542C05AC for ; Tue, 30 Jun 2015 06:59:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF4C4202B4 for ; Tue, 30 Jun 2015 06:59:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 154C120279 for ; Tue, 30 Jun 2015 06:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753629AbbF3G7m (ORCPT ); Tue, 30 Jun 2015 02:59:42 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:32859 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753201AbbF3G43 (ORCPT ); Tue, 30 Jun 2015 02:56:29 -0400 Received: by pacws9 with SMTP id ws9so726049pac.0 for ; Mon, 29 Jun 2015 23:56:29 -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=nCAXmKgOREfNXbduySKQgWeYtS0cL4BoBwGh4Vl0hI8=; b=RupgfSWYPYoHuf019heeyj5af8dKfRU2TAEhX4IvSEJHWAqWZGrCcrWrpaf332MQJC DVY+EdvS1hosRTvkbQIjOs0NFPxirzD205QtcNBL4c8g+Jo/N5jE9jhhUu681AOhPBrP vV8GKYK9pqs2KB618TZh/Xbe55Li35KijBvlY= 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=nCAXmKgOREfNXbduySKQgWeYtS0cL4BoBwGh4Vl0hI8=; b=TdQZp2mMx8heB7ZLhFmlYvLU8m0z3vNPqiDVO/v8pUWO+8dbwdfxK7bGPaIFaLG92m HHPZNeOiiWZqEibSbONRyqIDPb7RZGML7Xz6AwgFoyjniCYcBp3a5nT9Ic9KSfxOckiG i8zybyphzLmeDOhpA09nxuQ5gN72h8d8QdspGDnDYS0LyeYmt3GvQjyKXZDu9H8IugEs Ta7MC+6NIPKevepL5A3rM/U1n3nJip0xrsq0Pr2eBkjdRN3LcSa3FZuoXyi2adljYGJt 8wbdFl5IoHm4oz3dGHaJeS3QVrR59INBTT+uIkqcAR1vw8jVdrUFwPBm87WNjtoHb8VS +JTQ== X-Gm-Message-State: ALoCoQn/nK7jPYY0SrNCd6Kzv6+zUnZ8omyjQobpAZbkNkEp3TqvIdO7oGtyUKJqnLQb3D8mTeWJ X-Received: by 10.66.161.135 with SMTP id xs7mr41330011pab.154.1435647389268; Mon, 29 Jun 2015 23:56:29 -0700 (PDT) Received: from host1.lsi.com ([192.19.239.250]) by mx.google.com with ESMTPSA id 1sm935543pds.79.2015.06.29.23.56.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Jun 2015 23:56:28 -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, jthumshirn@suse.de, Sreekanth Reddy Subject: [PATCH v2 15/20] [SCSI] mpt3sas: Return host busy error status to SML when DMA mapping of scatter gather list fails for a SCSI command Date: Tue, 30 Jun 2015 12:25:01 +0530 Message-Id: <1435647306-36956-16-git-send-email-Sreekanth.Reddy@avagotech.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1435647306-36956-1-git-send-email-Sreekanth.Reddy@avagotech.com> References: <1435647306-36956-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=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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. Changes in v2: Corrected the typo mistake from "(!sges_left < 0)" to "(sges_left < 0)". Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen Reviewed-by: Johannes Thumshirn --- 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 4f82687..6e44370 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1360,7 +1360,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)); @@ -1429,7 +1429,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),