[7331] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: Scsi mid level changes in 2.3.19

daemon@ATHENA.MIT.EDU (Matthew Jacob)
Wed Oct 6 12:52:17 1999

Date:   Wed, 6 Oct 1999 09:19:26 -0700 (PDT)
From:   Matthew Jacob <mjacob@feral.com>
Reply-To: mjacob@feral.com
To:     Douglas Gilbert <dgilbert@interlog.com>
cc:     linux-scsi@vger.rutgers.edu, bobf@advansys.com, eric@andante.org
In-Reply-To: <37FB4C0C.6E76905B@interlog.com>
Message-ID: <Pine.BSF.4.10.9910060918020.58348-100000@beppo.feral.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII


> As foreshadowed in a previous posting to this group, some
> changes have been made to the SCSI mid level command structure
> [struct scsi_cmnd] in 2.3.19
>   - the sense_buffer array has been increased from 16 to 64 bytes
>   - a new int member called "resid" has been added.
> 
> The "resid" member is for the residual DMA count from data 
> transfers. It is initialized to 0 and is set currently by no
> adapter drivers [hint]. It is defined (as per CAM) as the
> requested data transfer length less the number of bytes
> actually transferred. In practice, it should be used to indicate
> underrun (which will yield a positive number). [Hopefully


Right on. From my qlogic FC/SCSI driver:

isplinux_cdone(Scsi_Cmnd *Cmnd)
{   
    struct ispsoftc *isp = (struct ispsoftc *) (Cmnd->host->hostdata);
    
    /*
     * Internal bookkeeping
     */
    Cmnd->SCp.phase = 1;
    
    /*
     *
     */
    Cmnd->result &= ~0xff;
    Cmnd->result |= Cmnd->SCp.Status;

    if (host_byte(Cmnd->result) == DID_OK) {
        /* Never have can_queue go to zero. */
        int cq = ISP_QAVAIL(isp->isp_reqidx, isp->isp_reqodx,
            min(MAXISPREQUEST, isp->isp_maxcmds)); 
        Cmnd->host->can_queue = (cq != 0)? cq : 1;
        if (IS_FC(isp))
            Cmnd->host->sg_tablesize = SGSZ_2X00(Cmnd->host->can_queue);
        else
            Cmnd->host->sg_tablesize = SGSZ_1XX0(Cmnd->host->can_queue);
#if     LINUX_VERSION_CODE < KERNEL_VERSION(2,1,75)
        /* host_busy is an unsigned char for 2.0.X */
        cq = min(cq, 255);
#endif      
    }           
    /*      
     * If we had a way handling residuals, this is where we'd do it
     */         

    /*          
     * Queue command on completion queue.
     */     
    if (isp->isp_osinfo.dqnext == NULL) {
        isp->isp_osinfo.dqnext = isp->isp_osinfo.dqtail = Cmnd;
    } else {
        isp->isp_osinfo.dqtail->host_scribble = (unsigned char *) Cmnd; 
    }       
    Cmnd->host_scribble = NULL;
}           



-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post