aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorMaor Gottlieb <maorg@mellanox.com>2015-02-03 10:57:15 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-04 19:17:45 -0500
commitb332068ce4261b37d05f438fbc487e357fffa108 (patch)
tree33f5abc4da61980c6dc1fc299ef67c3878384548 /drivers/net/ethernet
parentce388fff3aa446d5a4895f8a757345f53daa200a (diff)
net/mlx4_core: Fix mpt_entry initialization in mlx4_mr_rereg_mem_write()
a) Previously, mlx4_mr_rereg_write filled the MPT's start and length with the old MPT's values. Fixing the initialization to take the new start and length. b) In addition access flags in mpt_status were initialized instead of status due to bad boolean operation. Fixing the operation. c) Initialization of pd_slave caused a protection error. Fix - removing this initialization. d) In resource_tracker.c: Fixing vf encoding to be one-based. Fixes: e630664c ('mlx4_core: Add helper functions to support MR re-registration') Signed-off-by: Maor Gottlieb <maorg@mellanox.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mr.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c2
2 files changed, 6 insertions, 9 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index d21e884a0838..78f51e103880 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -598,14 +598,11 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
598 if (err) 598 if (err)
599 return err; 599 return err;
600 600
601 mpt_entry->start = cpu_to_be64(mr->iova); 601 mpt_entry->start = cpu_to_be64(iova);
602 mpt_entry->length = cpu_to_be64(mr->size); 602 mpt_entry->length = cpu_to_be64(size);
603 mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift); 603 mpt_entry->entity_size = cpu_to_be32(page_shift);
604 604 mpt_entry->flags &= ~(cpu_to_be32(MLX4_MPT_FLAG_FREE |
605 mpt_entry->pd_flags &= cpu_to_be32(MLX4_MPT_PD_MASK | 605 MLX4_MPT_FLAG_SW_OWNS));
606 MLX4_MPT_PD_FLAG_EN_INV);
607 mpt_entry->flags &= cpu_to_be32(MLX4_MPT_FLAG_FREE |
608 MLX4_MPT_FLAG_SW_OWNS);
609 if (mr->mtt.order < 0) { 606 if (mr->mtt.order < 0) {
610 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL); 607 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL);
611 mpt_entry->mtt_addr = 0; 608 mpt_entry->mtt_addr = 0;
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index c5f3dfca226b..486e3d26cd4a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -2541,7 +2541,7 @@ int mlx4_SW2HW_MPT_wrapper(struct mlx4_dev *dev, int slave,
2541 /* Make sure that the PD bits related to the slave id are zeros. */ 2541 /* Make sure that the PD bits related to the slave id are zeros. */
2542 pd = mr_get_pd(inbox->buf); 2542 pd = mr_get_pd(inbox->buf);
2543 pd_slave = (pd >> 17) & 0x7f; 2543 pd_slave = (pd >> 17) & 0x7f;
2544 if (pd_slave != 0 && pd_slave != slave) { 2544 if (pd_slave != 0 && --pd_slave != slave) {
2545 err = -EPERM; 2545 err = -EPERM;
2546 goto ex_abort; 2546 goto ex_abort;
2547 } 2547 }