From owner-svn-src-stable-9@FreeBSD.ORG Wed Jul 10 17:16:11 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 97E0E4DC; Wed, 10 Jul 2013 17:16:11 +0000 (UTC) (envelope-from sbruno@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 6F6321EB2; Wed, 10 Jul 2013 17:16:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6AHGBEb015627; Wed, 10 Jul 2013 17:16:11 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6AHGBK6015626; Wed, 10 Jul 2013 17:16:11 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201307101716.r6AHGBK6015626@svn.freebsd.org> From: Sean Bruno Date: Wed, 10 Jul 2013 17:16:11 +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: r253160 - stable/9/sys/dev/ciss 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, 10 Jul 2013 17:16:11 -0000 Author: sbruno Date: Wed Jul 10 17:16:10 2013 New Revision: 253160 URL: http://svnweb.freebsd.org/changeset/base/253160 Log: Jump on the 9.2r MFC bonanza and update ciss(4) r250031 - zero a data structure for notifications r250022 r249977 r249947 r249908 - handle cases of controllers advertising an sg_list of less than CISS_MAX_SG_ELEMENTS. Fixes ciss(4) ZMR cases. Modified: stable/9/sys/dev/ciss/ciss.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ciss/ciss.c ============================================================================== --- stable/9/sys/dev/ciss/ciss.c Wed Jul 10 16:28:24 2013 (r253159) +++ stable/9/sys/dev/ciss/ciss.c Wed Jul 10 17:16:10 2013 (r253160) @@ -2487,6 +2487,7 @@ ciss_preen_command(struct ciss_request * cc->header.sg_total = 0; cc->header.host_tag = cr->cr_tag << 2; cc->header.host_tag_zeroes = 0; + bzero(&(cc->sg[0]), CISS_COMMAND_ALLOC_SIZE - sizeof(struct ciss_command)); cmdphys = cr->cr_ccphys; cc->error_info.error_info_address = cmdphys + sizeof(struct ciss_command); cc->error_info.error_info_length = CISS_COMMAND_ALLOC_SIZE - sizeof(struct ciss_command); @@ -2985,6 +2986,7 @@ ciss_cam_action(struct cam_sim *sim, uni case XPT_PATH_INQ: { struct ccb_pathinq *cpi = &ccb->cpi; + int sg_length; debug(1, "XPT_PATH_INQ %d:%d:%d", cam_sim_bus(sim), ccb->ccb_h.target_id, ccb->ccb_h.target_lun); @@ -3005,7 +3007,22 @@ ciss_cam_action(struct cam_sim *sim, uni cpi->transport_version = 2; cpi->protocol = PROTO_SCSI; cpi->protocol_version = SCSI_REV_2; - cpi->maxio = (CISS_MAX_SG_ELEMENTS - 1) * PAGE_SIZE; + if (sc->ciss_cfg->max_sg_length == 0) { + sg_length = 17; + } else { + /* XXX Fix for ZMR cards that advertise max_sg_length == 32 + * Confusing bit here. max_sg_length is usually a power of 2. We always + * need to subtract 1 to account for partial pages. Then we need to + * align on a valid PAGE_SIZE so we round down to the nearest power of 2. + * Add 1 so we can then subtract it out in the assignment to maxio. + * The reason for all these shenanigans is to create a maxio value that + * creates IO operations to volumes that yield consistent operations + * with good performance. + */ + sg_length = sc->ciss_cfg->max_sg_length - 1; + sg_length = (1 << (fls(sg_length) - 1)) + 1; + } + cpi->maxio = (min(CISS_MAX_SG_ELEMENTS, sg_length) - 1) * PAGE_SIZE; ccb->ccb_h.status = CAM_REQ_CMP; break; }