Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Aug 2006 11:29:14 +0300
From:      Danny Braniss <danny@cs.huji.ac.il>
To:        "Kenneth D. Merry" <ken@freebsd.org>
Cc:        scsi@freebsd.org
Subject:   Re: iSCSI/luns/check-condition 
Message-ID:  <E1GGX3y-0005gm-6p@cs1.cs.huji.ac.il>
In-Reply-To: Your message of Thu, 24 Aug 2006 09:15:28 -0600 .

next in thread | raw e-mail | index | archive | help
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1GGX3y-0005gm-6p>