Commit | Line | Data |
---|---|---|
8cdd312c HE |
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 | } |