Date: Fri, 23 Feb 2001 13:15:18 +0800 From: Rex Luo <rexluo@synology.com> To: freebsd-scsi@FreeBSD.ORG Subject: residual count not zero in target mode Message-ID: <200102230515.NAA00874@synology.com>
next in thread | raw e-mail | index | archive | help
Dear all, I have a programming problem, hope someone knows that. I have two scsi channel, one(0) is configured to as initiator mode, and another(1) is target mode. I modified FreeBSD kernel(4.1) to let target drive behave as a direct-accessed disk.(targctor() T_PROCESSOR --> T_DIRECT). Furthermore, I add READ_6, WRITE_6 opcode in targdone()(original is SEND, RECEIVE), and it runs smoothly. I also modified /usr/src/share/examples/scsi_targ/scsi_target.c to add new ioctl commands to attach another real drive, and get i/o request offset, and length.(If you want to know more detail, I can show what I modified.) Then, I use "scsi_targ -o /dev/ad0s2b -p 1 -t 8 -l 0" to enable channel 1 as target mode.(I modified "-o" option to let input, output files are the same) I can use "camcontrol rescan 0" to rescan bus 0, then I get a scsi da drive. I try to use sysinstall to open and issue i/o request to the drive, however, I found that the issued i/o request's residual is not zero. It's code stack is ahc_intr() ---> ahc_run_qoutfifo() ---> if (scb->hscb->residual_SG_count != 0) ahc_calc_residual(scb) ---> resid = hscb->residual_data_count[2] << 16 .... .... and it's value is not zero. If scb->ccb->csio.resid = resid is not zero, the i/o request will be failed (it's set in dadone()), then open drive fail. Does anyone know who will set residual_data_count[0-2]? and how to set that? In my opinion, I think sequencer should update these values automatically, and targetmode driver should inform initiator sequencer to update these values. Actually, I have no idea about that, if you have some information or document about that, or you know where I am wrong. Please let me know, thanks, Sincerely, Rex Luo To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102230515.NAA00874>