On 2/22/21 7:23 AM, Hannes Reinecke wrote: > Hi all, > > quite some drivers use internal commands for various purposes, most > commonly sending TMFs or querying the HBA status. > While these commands use the same submission mechanism than normal > I/O commands, they will not be counted as outstanding commands, > requiring those drivers to implement their own mechanism to figure > out outstanding commands. > The block layer already has the concept of 'reserved' tags for > precisely this purpose, namely non-I/O tags which live off a separate > tag pool. That guarantees that these commands can always be sent, > and won't be influenced by tag starvation from the I/O tag pool. > This patchset enables the use of reserved tags for the SCSI midlayer > by allocating a virtual LUN for the HBA itself which just serves > as a resource to allocate valid tags from. > This removes quite some hacks which were required for some > drivers (eg. fnic or snic), and allows the use of tagset > iterators within the drivers. > Hey Hannes, I was trying to port some iscsi patches to this set. One question I had is how to handle if my driver implements init_cmd_priv, and wants to use the reserved cmds for a non scsi IO. My case I want to use them for cmds like a iscsi nop/ping, device/target reset or login request. There is no bit to way to tell if at init_cmd_priv time the cmd will be for a reserved or non reserved cmd right? If not, I was wondering should I do: 1. in libiscsi, allocate an array of size $reserved_cmds with non_scsi_cmds structs. When I need to do a non scsi cmd do blk_mq_get_tag on the host's tags to get a reserved tag then use that to lookup a struct in my array? 2. in libiscsi when I need to do a non scsi cmd do a scsi_get_internal_cmd. At this time allocate the non_scsi_cmd struct parts.