From owner-svn-src-stable-9@FreeBSD.ORG Wed Dec 12 00:39:05 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 87E07B27; Wed, 12 Dec 2012 00:39:05 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6AF478FC16; Wed, 12 Dec 2012 00:39:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBC0d5xP026317; Wed, 12 Dec 2012 00:39:05 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBC0d594026316; Wed, 12 Dec 2012 00:39:05 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201212120039.qBC0d594026316@svn.freebsd.org> From: Jim Harris Date: Wed, 12 Dec 2012 00:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244128 - stable/9/sys/dev/isci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Dec 2012 00:39:05 -0000 Author: jimharris Date: Wed Dec 12 00:39:04 2012 New Revision: 244128 URL: http://svnweb.freebsd.org/changeset/base/244128 Log: MFC r243904: Don't call bus_dmamap_load in CAM_DIR_NONE case, since there is nothing to map, and technically this isn't allowed. Functionally, it works OK (at least on x86) to call bus_dmamap_load with a NULL data pointer and zero length, so this is primarily for correctness and consistency with other drivers. While here, remove check in isci_io_request_construct for nseg==0. Previously, bus_dmamap_load would pass nseg==1, even for case where buffer is NULL and length = 0, which allowed CAM_DIR_NONE CCBs to get processed. This check is not correct though, and needed to be removed both for the changes elsewhere in this patch, as well as jeff's preliminary bus_dmamap_load_ccb patch (which uncovered all of this in the first place). Modified: stable/9/sys/dev/isci/isci_io_request.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/isci/isci_io_request.c ============================================================================== --- stable/9/sys/dev/isci/isci_io_request.c Tue Dec 11 23:59:14 2012 (r244127) +++ stable/9/sys/dev/isci/isci_io_request.c Wed Dec 12 00:39:04 2012 (r244128) @@ -670,8 +670,7 @@ isci_io_request_construct(void *arg, bus io_request->sge = seg; ccb = io_request->ccb; - /* XXX More cleanup is needed here */ - if ((nseg == 0) || (error != 0)) { + if (error != 0) { ccb->ccb_h.status = CAM_REQ_INVALID; xpt_done(ccb); return; @@ -757,18 +756,21 @@ isci_io_request_execute_scsi_io(union cc panic("Unexpected CAM_DATA_PHYS flag! flags = 0x%x\n", ccb->ccb_h.flags); - error = bus_dmamap_load(io_request->parent.dma_tag, - io_request->parent.dma_map, csio->data_ptr, csio->dxfer_len, - isci_io_request_construct, io_request, 0x0); - - /* A resource shortage from BUSDMA will be automatically - * continued at a later point, pushing the CCB processing - * forward, which will in turn unfreeze the simq. - */ - if (error == EINPROGRESS) { - xpt_freeze_simq(controller->sim, 1); - ccb->ccb_h.flags |= CAM_RELEASE_SIMQ; - } + if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { + error = bus_dmamap_load(io_request->parent.dma_tag, + io_request->parent.dma_map, csio->data_ptr, csio->dxfer_len, + isci_io_request_construct, io_request, 0x0); + + /* A resource shortage from BUSDMA will be automatically + * continued at a later point, pushing the CCB processing + * forward, which will in turn unfreeze the simq. + */ + if (error == EINPROGRESS) { + xpt_freeze_simq(controller->sim, 1); + ccb->ccb_h.flags |= CAM_RELEASE_SIMQ; + } + } else + isci_io_request_construct(io_request, NULL, 0, 0); } void