Date: Mon, 30 Aug 2021 13:12:23 -0400 From: Alexander Motin <mav@FreeBSD.org> To: "Kenneth D. Merry" <ken@FreeBSD.ORG>, ??? ?????? <yamori813@yahoo.co.jp> Cc: "freebsd-scsi@freebsd.org" <freebsd-scsi@freebsd.org> Subject: Re: targ dir issue Message-ID: <31a7cb3c-fb0e-7773-578b-b3d2108d611e@FreeBSD.org> In-Reply-To: <20210830165133.GA54578@mithlond.kdm.org> References: <141829693.2600976.1629832478856.JavaMail.yahoo.ref@mail.yahoo.co.jp> <141829693.2600976.1629832478856.JavaMail.yahoo@mail.yahoo.co.jp> <20210830165133.GA54578@mithlond.kdm.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, On 30.08.2021 12:51, Kenneth D. Merry wrote: > On Wed, Aug 25, 2021 at 04:14:38 +0900, ??? ?????? wrote: >> * { margin: 0; font-size: 13px; font-family: 'MS P????????????', sans-serif;}a { color: #0064c8; text-decoration: none;}a:hover { color: #0057af; text-decoration: underline;}a:active { color: #004c98;} >> Hi >> >> I port ncv to eps for NCR53C500. And Support targ at esp. >> >> I have question for targ. >> >> inquery data is send by scsi_target apprication by CAM_DIR_IN. >> >> But CAM_DIR_IN not copyin. >> >> https://svnweb.freebsd.org/base/head/sys/cam/cam_periph.c?view=markup#l929 >> >> Why different ? > > I think that may be a bug. I see that if you have an XPT_CONT_TARGET_IO > CCB, for an INQUIRY, as you would in your case, it would be CAM_DIR_IN, but > would need to copy the data from userland into the kernel. > > It looks like it changed in SVN revision 345656. > > I have CCed Alexander Motin, he originally wrote that change and can take a > look at it. It seems like a bug indeed. XPT_CONT_TARGET_IO has opposite meaning of IN/OUT, since those are always interpreted as seen by initiator, so the dirs[i] != CAM_DIR_IN should become dirs[i] != CAM_DIR_OUT for XPT_CONT_TARGET_IO, and respectively b_iocmd setting below and in cam_periph_unmapmem(). It went unnoticed because CTL does not use this code, while I don't know anybody using user-space target targ(4) API. It would be good to both fix this issue for targ(4) (I'd appreciate a tested patch, since I am not using targ(4)), and if you are testing esp(4) in target mode, test it with CTL also. -- Alexander Motin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?31a7cb3c-fb0e-7773-578b-b3d2108d611e>