• John Garry's avatar
    scsi: scsi_debug: Support hostwide tags · c10fa55f
    John Garry authored
    Many SCSI HBAs support a hostwide tagset, whereby each command submitted to
    the HW from all submission queues must have a unique tag identifier.
    
    Normally this unique tag will be in the range [0, max queue], where "max
    queue" is the depth of each of the submission queues.
    
    Add support for this hostwide tag feature, via module parameter
    "host_max_queue". A non-zero value means that the feature is enabled. In
    this case, the submission queues are not exposed to upper layer, i.e. from
    blk-mq prespective, the device has a single hw queue. There are 2 reasons
    for this:
    
     a. It is assumed that the host can support nr_hw_queues * can_queue
        commands, but this is not true for hostwide tags
    
     b. For nr_hw_queues != 0, the request tag is not unique over all HW
        queues, and some HBA drivers want to use this tag for the hostwide tag
    
    However, like many SCSI HBA drivers today - megaraid sas being an example -
    the full set of HW submission queues are still used in the LLDD driver. So
    instead of using a complicated "reply_map" to create a per-CPU submission
    queue mapping like megaraid_sas (as it depends on a PCI device + MSIs) -
    use a simple algorithm:
    
        hwq = cpu % queue count
    
    If the host_max_queue param is set non-zero, then the max queue depth is
    fixed at this value also.
    
    If and when hostwide shared tags are supported in blk-mq/scsi mid-layer,
    then the policy to set nr_hw_queues = 0 for hostwide tags can be revised.
    
    Link: https://lore.kernel.org/r/1594297400-24756-3-git-send-email-john.garry@huawei.comAcked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
    Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    c10fa55f
scsi_debug.c 214 KB