• Sagi Grimberg's avatar
    nvme-rdma: fix queue mapping when queue count is limited · 5651cd3c
    Sagi Grimberg authored
    When the controller supports less queues than requested, we
    should make sure that queue mapping does the right thing and
    not assume that all queues are available. This fixes a crash
    when the controller supports less queues than requested.
    
    The rules are:
    1. if no write/poll queues are requested, we assign the available queues
       to the default queue map. The default and read queue maps share the
       existing queues.
    2. if write queues are requested:
      - first make sure that read queue map gets the requested
        nr_io_queues count
      - then grant the default queue map the minimum between the requested
        nr_write_queues and the remaining queues. If there are no available
        queues to dedicate to the default queue map, fallback to (1) and
        share all the queues in the existing queue map.
    3. if poll queues are requested:
      - map the remaining queues to the poll queue map.
    
    Also, provide a log indication on how we constructed the different
    queue maps.
    Reported-by: default avatarHarris, James R <james.r.harris@intel.com>
    Reviewed-by: default avatarMax Gurtovoy <maxg@mellanox.com>
    Tested-by: default avatarJim Harris <james.r.harris@intel.com>
    Cc: <stable@vger.kernel.org> # v5.0+
    Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
    5651cd3c
rdma.c 53.1 KB