Re: PATCH: scsi device queue depth adjustability patch

James Bottomley
2002-10-03T17:01:02Z

dledford@redhat.com said:
> 1) When/How is the lldd notified that tagged queueing has been
> enabled and the depth to which it is enabled?

A trick question. Obviously it should be in slave_attach. However, the 53c700
is used with a lot of quirky drives, so the way I do it is to shadow the
commands. The first command that comes down with tagged_supported set, I try
a tagged command. If that command succeeds, I then activate the TCQ and thus
set tagged_enabled (the driver has several bits per target to support this
state model). If the first tag fails, I clear tagged_supported. This catches
the annoying drives that set the CmdQue bit in the inquiry page and then
reject all tagged commands. The depth for the 53c700 is just the default
cmd_per_lun.

You can see this in the source code (tag_negotiated bitmap and
NCR_700_DEV_BEGIN_TAG_QUEUEING flag).

> 2) How does the lldd tell the midlayer (and hence the block layer) to
> reduce the queue depth?

It can't, currently. This could be done, but only by disabling and reenabling
the block layer TCQ support. The block layer currently uses a static array
for this.

However, the resources the block layer uses are tiny (one entry in this array
per tag, plus a bitlist) so its probably just not worth freeing and
reacquiring these. To integrate with the blk layer, I'd propose just
initialising the blk layer with the maximum possible number of tags (i.e.
introduce an upper limit somewhere) and then just do the dynamic stuff in the
mid-layer.

James