Bug 209700 - [iscsi] ctld advertises support for tagged queuing but does not appear to support it
Summary: [iscsi] ctld advertises support for tagged queuing but does not appear to sup...
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.2-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: Edward Tomasz Napierala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-22 21:05 UTC by Aaron J. Grier
Modified: 2016-08-21 18:06 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron J. Grier 2016-05-22 21:05:33 UTC
Using NetBSD-7 iscsi initiator to FreeBSD-10.2-RELEASE ctld target fails with check condition, overlapped commands attempted, even though ctld claims that it supports tagged queueing.

packet captures available at http://poofygoof.com/~agrier/attic/freebsd_iscsi.cap.bz2 .

for comparison, the same client connecting to a smartOS (illumOS/opensolaris) iSCSI target is at http://poofygoof.com/~agrier/attic/smartos_iscsi.cap.bz2 , which works correctly.

current workaround is to add a quirk to the NetBSD initiator for the FreeBSD target to disable tagged queuing support.  it is expected that this hurts throughput, since by definition it disables opportunities for pipelining.
Comment 1 Edward Tomasz Napierala freebsd_committer freebsd_triage 2016-06-11 11:42:14 UTC
It supports tagged queueing of commands marked as tagged.  For some reason the NetBSD initiator sets the "flags" field of SCSI Command PDU to Untagged (0).  Not sure what the SCSI spec says, to be honest, but it might it be an initiator error?
Comment 2 Aaron J. Grier 2016-06-13 19:44:24 UTC
initiator bug is simplest explanation.  :)  I will follow-up on NetBSD side and see if I can implement a code change there.

thanks for the troubleshooting assistance.
Comment 3 Edward Tomasz Napierala freebsd_committer freebsd_triage 2016-06-14 18:42:56 UTC
Thanks!  Please leave a note here when the situation gets resolved.
Comment 4 Aaron J. Grier 2016-08-18 07:15:13 UTC
In http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=51037 Michael van Elst writes:

 In [NetBSD]-current I did some signficant changes to the iSCSI initiator
 including how tagging is handled.

 The first attempt was to mark all requests as tagged and simply
 ordered but I ignored the actual tag values, this stopped the
 'illegal request' errors immediately.

 Now it passes tags from scsipi to the iSCSI layer which is probably
 the right thing to do if you support taggging.

 IMHO the FreeBSD target has an issue in how it handles untagged
 requests, but I haven't found anything suspicious when looking
 at the FreeBSD code.

So we're back to protocol interpretation regarding handling of overlapping untagged commands (which IllumOS supports), but that could be opened as a new bug if anybody cares.

I did a minimal back-port of Michael's tagging changes from NetBSD-current, and believe this bug can be closed.
Comment 5 Alexander Motin freebsd_committer freebsd_triage 2016-08-18 17:25:22 UTC
I agree with Edward that it is an initiator bug.  Old SAM-2 specification states: "An untagged task does not include a tag in its I_T_L nexus, thus restricting the number of concurrent untagged tasks in a single task set to one per SCSI initiator port.", that is exactly what CTL enforces.  Attempt to send more then one untagged command at a time causes error.  If initiator uses untagged commands, that it must execute them one at a time.  Latest SAM-5 specification obsoletes untagged tasks completely, so they just should not be used in new implementations.
Comment 6 Edward Tomasz Napierala freebsd_committer freebsd_triage 2016-08-21 18:06:45 UTC
Closing this, as it really looks like an initiator bug.  Please reopen if you disagree.  Thanks :-)