diff options
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 4 | ||||
| -rw-r--r-- | include/linux/mlx5/device.h | 13 |
2 files changed, 13 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c index d4585154151d..cc4fd61914d3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | |||
| @@ -287,7 +287,7 @@ retry: | |||
| 287 | 287 | ||
| 288 | goto retry; | 288 | goto retry; |
| 289 | } | 289 | } |
| 290 | MLX5_SET64(manage_pages_in, in, pas[i], addr); | 290 | MLX5_ARRAY_SET64(manage_pages_in, in, pas, i, addr); |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | MLX5_SET(manage_pages_in, in, opcode, MLX5_CMD_OP_MANAGE_PAGES); | 293 | MLX5_SET(manage_pages_in, in, opcode, MLX5_CMD_OP_MANAGE_PAGES); |
| @@ -344,7 +344,7 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev, | |||
| 344 | if (fwp->func_id != func_id) | 344 | if (fwp->func_id != func_id) |
| 345 | continue; | 345 | continue; |
| 346 | 346 | ||
| 347 | MLX5_SET64(manage_pages_out, out, pas[i], fwp->addr); | 347 | MLX5_ARRAY_SET64(manage_pages_out, out, pas, i, fwp->addr); |
| 348 | i++; | 348 | i++; |
| 349 | } | 349 | } |
| 350 | 350 | ||
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 77c141797152..58276144ba81 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
| @@ -92,12 +92,21 @@ __mlx5_mask(typ, fld)) | |||
| 92 | ___t; \ | 92 | ___t; \ |
| 93 | }) | 93 | }) |
| 94 | 94 | ||
| 95 | #define MLX5_SET64(typ, p, fld, v) do { \ | 95 | #define __MLX5_SET64(typ, p, fld, v) do { \ |
| 96 | BUILD_BUG_ON(__mlx5_bit_sz(typ, fld) != 64); \ | 96 | BUILD_BUG_ON(__mlx5_bit_sz(typ, fld) != 64); \ |
| 97 | BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \ | ||
| 98 | *((__be64 *)(p) + __mlx5_64_off(typ, fld)) = cpu_to_be64(v); \ | 97 | *((__be64 *)(p) + __mlx5_64_off(typ, fld)) = cpu_to_be64(v); \ |
| 99 | } while (0) | 98 | } while (0) |
| 100 | 99 | ||
| 100 | #define MLX5_SET64(typ, p, fld, v) do { \ | ||
| 101 | BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \ | ||
| 102 | __MLX5_SET64(typ, p, fld, v); \ | ||
| 103 | } while (0) | ||
| 104 | |||
| 105 | #define MLX5_ARRAY_SET64(typ, p, fld, idx, v) do { \ | ||
| 106 | BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \ | ||
| 107 | __MLX5_SET64(typ, p, fld[idx], v); \ | ||
| 108 | } while (0) | ||
| 109 | |||
| 101 | #define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld))) | 110 | #define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld))) |
| 102 | 111 | ||
| 103 | #define MLX5_GET64_PR(typ, p, fld) ({ \ | 112 | #define MLX5_GET64_PR(typ, p, fld) ({ \ |
