| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2017 Sagi Grimberg. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 5 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 6 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 9 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 10 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 11 | | - * more details. |
|---|
| 12 | 4 | */ |
|---|
| 13 | 5 | #include <linux/blk-mq.h> |
|---|
| 14 | 6 | #include <linux/blk-mq-rdma.h> |
|---|
| .. | .. |
|---|
| 16 | 8 | |
|---|
| 17 | 9 | /** |
|---|
| 18 | 10 | * blk_mq_rdma_map_queues - provide a default queue mapping for rdma device |
|---|
| 19 | | - * @set: tagset to provide the mapping for |
|---|
| 20 | | - * @dev: rdma device associated with @set. |
|---|
| 11 | + * @map: CPU to hardware queue map. |
|---|
| 12 | + * @dev: rdma device to provide a mapping for. |
|---|
| 21 | 13 | * @first_vec: first interrupt vectors to use for queues (usually 0) |
|---|
| 22 | 14 | * |
|---|
| 23 | 15 | * This function assumes the rdma device @dev has at least as many available |
|---|
| .. | .. |
|---|
| 29 | 21 | * @set->nr_hw_queues, or @dev does not provide an affinity mask for a |
|---|
| 30 | 22 | * vector, we fallback to the naive mapping. |
|---|
| 31 | 23 | */ |
|---|
| 32 | | -int blk_mq_rdma_map_queues(struct blk_mq_tag_set *set, |
|---|
| 24 | +int blk_mq_rdma_map_queues(struct blk_mq_queue_map *map, |
|---|
| 33 | 25 | struct ib_device *dev, int first_vec) |
|---|
| 34 | 26 | { |
|---|
| 35 | 27 | const struct cpumask *mask; |
|---|
| 36 | 28 | unsigned int queue, cpu; |
|---|
| 37 | 29 | |
|---|
| 38 | | - for (queue = 0; queue < set->nr_hw_queues; queue++) { |
|---|
| 30 | + for (queue = 0; queue < map->nr_queues; queue++) { |
|---|
| 39 | 31 | mask = ib_get_vector_affinity(dev, first_vec + queue); |
|---|
| 40 | 32 | if (!mask) |
|---|
| 41 | 33 | goto fallback; |
|---|
| 42 | 34 | |
|---|
| 43 | 35 | for_each_cpu(cpu, mask) |
|---|
| 44 | | - set->mq_map[cpu] = queue; |
|---|
| 36 | + map->mq_map[cpu] = map->queue_offset + queue; |
|---|
| 45 | 37 | } |
|---|
| 46 | 38 | |
|---|
| 47 | 39 | return 0; |
|---|
| 48 | 40 | |
|---|
| 49 | 41 | fallback: |
|---|
| 50 | | - return blk_mq_map_queues(set); |
|---|
| 42 | + return blk_mq_map_queues(map); |
|---|
| 51 | 43 | } |
|---|
| 52 | 44 | EXPORT_SYMBOL_GPL(blk_mq_rdma_map_queues); |
|---|