Date: Wed, 10 Jul 2013 17:16:11 +0000 (UTC) From: Sean Bruno <sbruno@FreeBSD.org> 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 Message-ID: <201307101716.r6AHGBK6015626@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307101716.r6AHGBK6015626>