From nobody Mon Aug 30 17:12:23 2021 X-Original-To: freebsd-scsi@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 974B6178C969 for ; Mon, 30 Aug 2021 17:12:26 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GyxhV3NbTz3plP; Mon, 30 Aug 2021 17:12:26 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qk1-x730.google.com with SMTP id f22so16458438qkm.5; Mon, 30 Aug 2021 10:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=g0sVCpdUXrJ5sSelvkQn7dElgdLNJAvPyN2s1cg1mHA=; b=TskWSy30NdBdS2Oe6611EOKQZiRfYfS1EKkFpw8+HS3xC2XMdRNr60rWfpWaVeKPfT JixdUCnq9UnFtpn1frd49zDZbIVeENqr2psQcUFxzd7CUAbMMn85q83UMFeda9zjt2Dh plcZyICP5CANQjhzt7VEj7wR1mLvAicBgMPNZwWbn9Es/Q5PSPPqHOD7gEHNrhhY1JSD Gn1wgiM/t87NTfd2/Y30ySJrBRYOsJm5LNE1oT/DebgjacMMtJjMJHe+iJTKWTNwbvzR UTOkvlFTEFI9WR0Zu88sht5NV1zFAsWpBienXNZi2Epvs3b3fi5dq/9dzuVNNMityYA3 mcpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=g0sVCpdUXrJ5sSelvkQn7dElgdLNJAvPyN2s1cg1mHA=; b=GZMTg6X9MwpNzWmqwsQGgjPHCIp80/LnJ+ixD6PssFxVZuYXj3dhfxgcF8SPzAYPsy 3url66ctabEkeTdkrNy1vHIsZMzMTE9j7dsHOI/PrO9uHkJdyGBgYdEddNK9nGDd68at xK8Ih8ZNbRjIrt+WFWtj5ONAu9MO1RXxU3eBHE5chc+08BBogo3tRWF21cLJhn/W9wpQ OFwBIcxHhGtnAvyQM6GdmT0pAx/v+L0ZhrGjVjDuTxjMxwbSHK84ew1pXuV0vD1MVwwM TTaGkhTpUBqsxEocmk1cxANEkYYlXieR+Y2RXZGwri3SXjI5aJORQHO618HqX6XIcRRr glzw== X-Gm-Message-State: AOAM533UDhvMzWNPjJHOPymjFkIf1n/Z0rmKe6X4ZlKek/btghb76yUB IrvWeO2gHQccj4T35Y+JD8crUtmKU4A= X-Google-Smtp-Source: ABdhPJzZKD69dkCIsSJsbjuxTtcT9dPlPyNrnhr2IobGG5X+WCjZ9G931FPiLl7TSr4N7UL/U15FJg== X-Received: by 2002:a05:620a:166d:: with SMTP id d13mr12021692qko.491.1630343545250; Mon, 30 Aug 2021 10:12:25 -0700 (PDT) Received: from mavoffice.ixsystems.com ([38.32.73.2]) by smtp.gmail.com with ESMTPSA id e15sm2503566qtp.33.2021.08.30.10.12.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Aug 2021 10:12:24 -0700 (PDT) Subject: Re: targ dir issue To: "Kenneth D. Merry" , ??? ?????? Cc: "freebsd-scsi@freebsd.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> From: Alexander Motin Message-ID: <31a7cb3c-fb0e-7773-578b-b3d2108d611e@FreeBSD.org> Date: Mon, 30 Aug 2021 13:12:23 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 List-Id: SCSI subsystem List-Archive: https://lists.freebsd.org/archives/freebsd-scsi List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-scsi@freebsd.org X-BeenThere: freebsd-scsi@freebsd.org MIME-Version: 1.0 In-Reply-To: <20210830165133.GA54578@mithlond.kdm.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GyxhV3NbTz3plP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N 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