From owner-freebsd-scsi@FreeBSD.ORG Fri Aug 25 08:29:16 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 156F616A4DD; Fri, 25 Aug 2006 08:29:16 +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 9915C43D49; Fri, 25 Aug 2006 08:29:15 +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 1GGX3y-0005gm-6p; Fri, 25 Aug 2006 11:29:14 +0300 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: "Kenneth D. Merry" In-reply-to: Your message of Thu, 24 Aug 2006 09:15:28 -0600 . Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 25 Aug 2006 11:29:14 +0300 From: Danny Braniss Message-ID: Cc: 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: Fri, 25 Aug 2006 08:29:16 -0000 > On Thu, Aug 24, 2006 at 18:05:41 +0300, Danny Braniss wrote: > > hi, > > this target (Wasabi) is returning Check Condition for > > a INQ. LUN 1, (which probably is ok, since it does not exist), I return > > ccb_h->status = CAM_SCSI_STATUS_ERROR; > > but it seems that the CAM is ignoring it, since it will try again, and > > again, etc. [or i'm doing something wrong :-] > > If this is a result of the inquiry on initial probe (most likely), you > shouldn't get any more than 4 retries. > > What SCSI status byte, sense key, ASC and ASCQ are you returning? > this function seems to be doing the correct thing, when the target is NetAPP, and some others. 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); } thanks, danny