From owner-freebsd-scsi@FreeBSD.ORG Sun Aug 27 13:37:10 2006 Return-Path: X-Original-To: scsi@freebsd.org Delivered-To: freebsd-scsi@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 171E216A4DE; Sun, 27 Aug 2006 13:37:10 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from cs1.cs.huji.ac.il (cs1.cs.huji.ac.il [132.65.16.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 990F543D5E; Sun, 27 Aug 2006 13:37:09 +0000 (GMT) (envelope-from danny@cs.huji.ac.il) Received: from pampa.cs.huji.ac.il ([132.65.80.32]) by cs1.cs.huji.ac.il with esmtp id 1GHKp2-000Dcf-FQ; Sun, 27 Aug 2006 16:37:08 +0300 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: Scott Long In-reply-to: Your message of Sun, 27 Aug 2006 07:01:44 -0600 . Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 27 Aug 2006 16:37:08 +0300 From: Danny Braniss Message-ID: Cc: "Kenneth D. Merry" , scsi@freebsd.org Subject: Re: iSCSI/luns/check-condition X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Aug 2006 13:37:10 -0000 > Danny Braniss wrote: > > [...] > > > >>>sorry to barge in :-) > >>>but my initial problem was that the driver went into a loop. > >>> 0- cam starts lun discovery > >>> 1- cam sends inq > >>> 2- target replies 'condition check' > >>> 3- cam ignores, > >>> 4- back to 1 > >> > >>This is only going to happen if the SIM is returning CAM_REQ_CMP. > >>You should be returning CAM_REQ_CMP_ERROR. An ASC of 0x24 will set > >>SS_FATAL, which will cause probedone() to break out of the probe > >>sequence. > > > > > > I was returning CAM_SCSI_STATUS_ERROR. now im returning CAM_REQ_CMP_ERR > > and the loop is broken, thanks. Couldn't figure out how to > > deal with 'ASC of 0x24' - maybe after coffee. > > > > Actually, CAM_SCSI_STATUS_ERROR should have worked. Did you set > CAM_AUTOSNS_VALID? If not, then that probably caused the loop. i do!, here is the relevant code: /* | under construction ... */ static void getSenseData(u_int status, union ccb *ccb, pduq_t *pq) { pdu_t *pp = &pq->pdu; struct ccb_scsiio *scsi = (struct ccb_scsiio *)ccb; struct scsi_sense_data *sense = &scsi->sense_data; struct ccb_hdr *ccb_h = &ccb->ccb_h; caddr_t bp = mtod(pq->mp, caddr_t); struct mbuf *m = pq->mp; scsi_rsp_t *cmd = &pp->ipdu.scsi_rsp; int sense_len, mustfree = 0; sense_len = scsi_2btoul(bp); /* | according to the specs, the sense data cannot | be larger than 252 ... */ if(sense_len > m->m_len) { bp = malloc(sense_len, M_ISCSI, M_WAITOK); debug(3, "calling i_mbufcopy(len=%d)", sense_len); i_mbufcopy(pq->mp, bp, sense_len); mustfree++; } scsi->scsi_status = status; bcopy(bp+2, sense, min(sense_len, scsi->sense_len)); scsi->sense_resid = 0; if(cmd->flag & (BIT(1)|BIT(2))) scsi->sense_resid = ntohl(pp->ipdu.scsi_rsp.rcnt); debug(3, "sense_len=%d rcnt=%d sense_resid=%d dsl=%d error_code=%x flags=%x", sense_len, ntohl(pp->ipdu.scsi_rsp.rcnt), scsi->sense_resid, pp->ds_len, sense->error_code, sense->flags); ccb_h->status |= CAM_AUTOSNS_VALID; if(mustfree) free(bp, M_ISCSI); } and ... case 0x02: // Check Condition if(pq != NULL) // XXX: check for data ... getSenseData(status, ccb, pq); case 0x14: // Intermediate-Condition Met case 0x10: // Intermediate case 0x04: // Condition Met ccb_h->status = CAM_REQ_CMP_ERR; //CAM_SCSI_STATUS_ERROR; break; ... danny