diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/mr.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mr.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c index f91719a08cba..b3ee9bafff5e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mr.c +++ b/drivers/net/ethernet/mellanox/mlx4/mr.c | |||
@@ -480,9 +480,6 @@ int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr) | |||
480 | goto err_table; | 480 | goto err_table; |
481 | } | 481 | } |
482 | mpt_entry = mailbox->buf; | 482 | mpt_entry = mailbox->buf; |
483 | |||
484 | memset(mpt_entry, 0, sizeof *mpt_entry); | ||
485 | |||
486 | mpt_entry->flags = cpu_to_be32(MLX4_MPT_FLAG_MIO | | 483 | mpt_entry->flags = cpu_to_be32(MLX4_MPT_FLAG_MIO | |
487 | MLX4_MPT_FLAG_REGION | | 484 | MLX4_MPT_FLAG_REGION | |
488 | mr->access); | 485 | mr->access); |
@@ -695,8 +692,6 @@ int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw) | |||
695 | } | 692 | } |
696 | mpt_entry = mailbox->buf; | 693 | mpt_entry = mailbox->buf; |
697 | 694 | ||
698 | memset(mpt_entry, 0, sizeof(*mpt_entry)); | ||
699 | |||
700 | /* Note that the MLX4_MPT_FLAG_REGION bit in mpt_entry->flags is turned | 695 | /* Note that the MLX4_MPT_FLAG_REGION bit in mpt_entry->flags is turned |
701 | * off, thus creating a memory window and not a memory region. | 696 | * off, thus creating a memory window and not a memory region. |
702 | */ | 697 | */ |
@@ -755,14 +750,14 @@ int mlx4_init_mr_table(struct mlx4_dev *dev) | |||
755 | struct mlx4_mr_table *mr_table = &priv->mr_table; | 750 | struct mlx4_mr_table *mr_table = &priv->mr_table; |
756 | int err; | 751 | int err; |
757 | 752 | ||
758 | if (!is_power_of_2(dev->caps.num_mpts)) | ||
759 | return -EINVAL; | ||
760 | |||
761 | /* Nothing to do for slaves - all MR handling is forwarded | 753 | /* Nothing to do for slaves - all MR handling is forwarded |
762 | * to the master */ | 754 | * to the master */ |
763 | if (mlx4_is_slave(dev)) | 755 | if (mlx4_is_slave(dev)) |
764 | return 0; | 756 | return 0; |
765 | 757 | ||
758 | if (!is_power_of_2(dev->caps.num_mpts)) | ||
759 | return -EINVAL; | ||
760 | |||
766 | err = mlx4_bitmap_init(&mr_table->mpt_bitmap, dev->caps.num_mpts, | 761 | err = mlx4_bitmap_init(&mr_table->mpt_bitmap, dev->caps.num_mpts, |
767 | ~0, dev->caps.reserved_mrws, 0); | 762 | ~0, dev->caps.reserved_mrws, 0); |
768 | if (err) | 763 | if (err) |