diff options
-rw-r--r-- | drivers/infiniband/hw/mlx5/Makefile | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx5/main.c | 10 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx5/mlx5_ib.h | 12 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx5/odp.c | 60 |
4 files changed, 83 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx5/Makefile b/drivers/infiniband/hw/mlx5/Makefile index 4ea0135af484..27a70159e2ea 100644 --- a/drivers/infiniband/hw/mlx5/Makefile +++ b/drivers/infiniband/hw/mlx5/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | obj-$(CONFIG_MLX5_INFINIBAND) += mlx5_ib.o | 1 | obj-$(CONFIG_MLX5_INFINIBAND) += mlx5_ib.o |
2 | 2 | ||
3 | mlx5_ib-y := main.o cq.o doorbell.o qp.o mem.o srq.o mr.o ah.o mad.o | 3 | mlx5_ib-y := main.o cq.o doorbell.o qp.o mem.o srq.o mr.o ah.o mad.o |
4 | mlx5_ib-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += odp.o | ||
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 1ba6c42e4df8..e6d775f2446d 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -244,6 +244,12 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, | |||
244 | props->max_mcast_grp; | 244 | props->max_mcast_grp; |
245 | props->max_map_per_fmr = INT_MAX; /* no limit in ConnectIB */ | 245 | props->max_map_per_fmr = INT_MAX; /* no limit in ConnectIB */ |
246 | 246 | ||
247 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING | ||
248 | if (dev->mdev->caps.gen.flags & MLX5_DEV_CAP_FLAG_ON_DMND_PG) | ||
249 | props->device_cap_flags |= IB_DEVICE_ON_DEMAND_PAGING; | ||
250 | props->odp_caps = dev->odp_caps; | ||
251 | #endif | ||
252 | |||
247 | out: | 253 | out: |
248 | kfree(in_mad); | 254 | kfree(in_mad); |
249 | kfree(out_mad); | 255 | kfree(out_mad); |
@@ -1321,6 +1327,8 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) | |||
1321 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | | 1327 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | |
1322 | (1ull << IB_USER_VERBS_CMD_CREATE_XSRQ) | | 1328 | (1ull << IB_USER_VERBS_CMD_CREATE_XSRQ) | |
1323 | (1ull << IB_USER_VERBS_CMD_OPEN_QP); | 1329 | (1ull << IB_USER_VERBS_CMD_OPEN_QP); |
1330 | dev->ib_dev.uverbs_ex_cmd_mask = | ||
1331 | (1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE); | ||
1324 | 1332 | ||
1325 | dev->ib_dev.query_device = mlx5_ib_query_device; | 1333 | dev->ib_dev.query_device = mlx5_ib_query_device; |
1326 | dev->ib_dev.query_port = mlx5_ib_query_port; | 1334 | dev->ib_dev.query_port = mlx5_ib_query_port; |
@@ -1366,6 +1374,8 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) | |||
1366 | dev->ib_dev.free_fast_reg_page_list = mlx5_ib_free_fast_reg_page_list; | 1374 | dev->ib_dev.free_fast_reg_page_list = mlx5_ib_free_fast_reg_page_list; |
1367 | dev->ib_dev.check_mr_status = mlx5_ib_check_mr_status; | 1375 | dev->ib_dev.check_mr_status = mlx5_ib_check_mr_status; |
1368 | 1376 | ||
1377 | mlx5_ib_internal_query_odp_caps(dev); | ||
1378 | |||
1369 | if (mdev->caps.gen.flags & MLX5_DEV_CAP_FLAG_XRC) { | 1379 | if (mdev->caps.gen.flags & MLX5_DEV_CAP_FLAG_XRC) { |
1370 | dev->ib_dev.alloc_xrcd = mlx5_ib_alloc_xrcd; | 1380 | dev->ib_dev.alloc_xrcd = mlx5_ib_alloc_xrcd; |
1371 | dev->ib_dev.dealloc_xrcd = mlx5_ib_dealloc_xrcd; | 1381 | dev->ib_dev.dealloc_xrcd = mlx5_ib_dealloc_xrcd; |
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h index 14a0311eaa1c..cc50fce8cca7 100644 --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h | |||
@@ -390,6 +390,9 @@ struct mlx5_ib_dev { | |||
390 | struct mlx5_mr_cache cache; | 390 | struct mlx5_mr_cache cache; |
391 | struct timer_list delay_timer; | 391 | struct timer_list delay_timer; |
392 | int fill_delay; | 392 | int fill_delay; |
393 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING | ||
394 | struct ib_odp_caps odp_caps; | ||
395 | #endif | ||
393 | }; | 396 | }; |
394 | 397 | ||
395 | static inline struct mlx5_ib_cq *to_mibcq(struct mlx5_core_cq *mcq) | 398 | static inline struct mlx5_ib_cq *to_mibcq(struct mlx5_core_cq *mcq) |
@@ -559,6 +562,15 @@ void mlx5_umr_cq_handler(struct ib_cq *cq, void *cq_context); | |||
559 | int mlx5_ib_check_mr_status(struct ib_mr *ibmr, u32 check_mask, | 562 | int mlx5_ib_check_mr_status(struct ib_mr *ibmr, u32 check_mask, |
560 | struct ib_mr_status *mr_status); | 563 | struct ib_mr_status *mr_status); |
561 | 564 | ||
565 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING | ||
566 | int mlx5_ib_internal_query_odp_caps(struct mlx5_ib_dev *dev); | ||
567 | #else | ||
568 | static inline int mlx5_ib_internal_query_odp_caps(struct mlx5_ib_dev *dev) | ||
569 | { | ||
570 | return 0; | ||
571 | } | ||
572 | #endif /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */ | ||
573 | |||
562 | static inline void init_query_mad(struct ib_smp *mad) | 574 | static inline void init_query_mad(struct ib_smp *mad) |
563 | { | 575 | { |
564 | mad->base_version = 1; | 576 | mad->base_version = 1; |
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c new file mode 100644 index 000000000000..66c39ee16aff --- /dev/null +++ b/drivers/infiniband/hw/mlx5/odp.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2014 Mellanox Technologies. All rights reserved. | ||
3 | * | ||
4 | * This software is available to you under a choice of one of two | ||
5 | * licenses. You may choose to be licensed under the terms of the GNU | ||
6 | * General Public License (GPL) Version 2, available from the file | ||
7 | * COPYING in the main directory of this source tree, or the | ||
8 | * OpenIB.org BSD license below: | ||
9 | * | ||
10 | * Redistribution and use in source and binary forms, with or | ||
11 | * without modification, are permitted provided that the following | ||
12 | * conditions are met: | ||
13 | * | ||
14 | * - Redistributions of source code must retain the above | ||
15 | * copyright notice, this list of conditions and the following | ||
16 | * disclaimer. | ||
17 | * | ||
18 | * - Redistributions in binary form must reproduce the above | ||
19 | * copyright notice, this list of conditions and the following | ||
20 | * disclaimer in the documentation and/or other materials | ||
21 | * provided with the distribution. | ||
22 | * | ||
23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
30 | * SOFTWARE. | ||
31 | */ | ||
32 | |||
33 | #include "mlx5_ib.h" | ||
34 | |||
35 | #define COPY_ODP_BIT_MLX_TO_IB(reg, ib_caps, field_name, bit_name) do { \ | ||
36 | if (be32_to_cpu(reg.field_name) & MLX5_ODP_SUPPORT_##bit_name) \ | ||
37 | ib_caps->field_name |= IB_ODP_SUPPORT_##bit_name; \ | ||
38 | } while (0) | ||
39 | |||
40 | int mlx5_ib_internal_query_odp_caps(struct mlx5_ib_dev *dev) | ||
41 | { | ||
42 | int err; | ||
43 | struct mlx5_odp_caps hw_caps; | ||
44 | struct ib_odp_caps *caps = &dev->odp_caps; | ||
45 | |||
46 | memset(caps, 0, sizeof(*caps)); | ||
47 | |||
48 | if (!(dev->mdev->caps.gen.flags & MLX5_DEV_CAP_FLAG_ON_DMND_PG)) | ||
49 | return 0; | ||
50 | |||
51 | err = mlx5_query_odp_caps(dev->mdev, &hw_caps); | ||
52 | if (err) | ||
53 | goto out; | ||
54 | |||
55 | /* At this point we would copy the capability bits that the driver | ||
56 | * supports from the hw_caps struct to the caps struct. However, no | ||
57 | * such capabilities are supported so far. */ | ||
58 | out: | ||
59 | return err; | ||
60 | } | ||