aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Morgenstein <jackm@dev.mellanox.co.il>2014-05-29 09:31:01 -0400
committerRoland Dreier <roland@purestorage.com>2014-05-30 00:12:58 -0400
commit61565013cf7024e8aa52e0a8e78208a955ce7e5f (patch)
treeb2ae8a1e5f0937f6c3089b949cdac8a982ad8416
parentbc82878baa10c2a6a4a6affaf52c152935112142 (diff)
IB/mlx4: SET_PORT called by mlx4_ib_modify_port should be wrapped
mlx4_ib_modify_port is invoked in IB for resetting the Q_Key violations counters and for modifying the IB port capability flags. For example, when opensm is started up on the hypervisor, mlx4_ib_modify_port is called to set the port's IsSM flag. In multifunction mode, the SET_PORT command used in this flow should be wrapped (so that the PF port capability flags are also tracked, thus enabling the aggregate of all the VF/PF capability flags to be tracked properly). The procedure mlx4_SET_PORT() in main.c is also renamed to mlx4_ib_SET_PORT() to differentiate it from procedure mlx4_SET_PORT() in port.c. mlx4_ib_SET_PORT() is used exclusively by mlx4_ib_modify_port(). Finally, the CM invokes ib_modify_port() to set the IsCMSupported flag even when running over RoCE. Therefore, when RoCE is active, mlx4_ib_modify_port should return OK unconditionally (since the capability flags and qkey violations counter are not relevant). Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--drivers/infiniband/hw/mlx4/main.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 1b6dbe156a37..3c3806aff712 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -544,12 +544,11 @@ static int mlx4_ib_modify_device(struct ib_device *ibdev, int mask,
544 return 0; 544 return 0;
545} 545}
546 546
547static int mlx4_SET_PORT(struct mlx4_ib_dev *dev, u8 port, int reset_qkey_viols, 547static int mlx4_ib_SET_PORT(struct mlx4_ib_dev *dev, u8 port, int reset_qkey_viols,
548 u32 cap_mask) 548 u32 cap_mask)
549{ 549{
550 struct mlx4_cmd_mailbox *mailbox; 550 struct mlx4_cmd_mailbox *mailbox;
551 int err; 551 int err;
552 u8 is_eth = dev->dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH;
553 552
554 mailbox = mlx4_alloc_cmd_mailbox(dev->dev); 553 mailbox = mlx4_alloc_cmd_mailbox(dev->dev);
555 if (IS_ERR(mailbox)) 554 if (IS_ERR(mailbox))
@@ -563,8 +562,8 @@ static int mlx4_SET_PORT(struct mlx4_ib_dev *dev, u8 port, int reset_qkey_viols,
563 ((__be32 *) mailbox->buf)[1] = cpu_to_be32(cap_mask); 562 ((__be32 *) mailbox->buf)[1] = cpu_to_be32(cap_mask);
564 } 563 }
565 564
566 err = mlx4_cmd(dev->dev, mailbox->dma, port, is_eth, MLX4_CMD_SET_PORT, 565 err = mlx4_cmd(dev->dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT,
567 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); 566 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED);
568 567
569 mlx4_free_cmd_mailbox(dev->dev, mailbox); 568 mlx4_free_cmd_mailbox(dev->dev, mailbox);
570 return err; 569 return err;
@@ -573,11 +572,20 @@ static int mlx4_SET_PORT(struct mlx4_ib_dev *dev, u8 port, int reset_qkey_viols,
573static int mlx4_ib_modify_port(struct ib_device *ibdev, u8 port, int mask, 572static int mlx4_ib_modify_port(struct ib_device *ibdev, u8 port, int mask,
574 struct ib_port_modify *props) 573 struct ib_port_modify *props)
575{ 574{
575 struct mlx4_ib_dev *mdev = to_mdev(ibdev);
576 u8 is_eth = mdev->dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH;
576 struct ib_port_attr attr; 577 struct ib_port_attr attr;
577 u32 cap_mask; 578 u32 cap_mask;
578 int err; 579 int err;
579 580
580 mutex_lock(&to_mdev(ibdev)->cap_mask_mutex); 581 /* return OK if this is RoCE. CM calls ib_modify_port() regardless
582 * of whether port link layer is ETH or IB. For ETH ports, qkey
583 * violations and port capabilities are not meaningful.
584 */
585 if (is_eth)
586 return 0;
587
588 mutex_lock(&mdev->cap_mask_mutex);
581 589
582 err = mlx4_ib_query_port(ibdev, port, &attr); 590 err = mlx4_ib_query_port(ibdev, port, &attr);
583 if (err) 591 if (err)
@@ -586,9 +594,9 @@ static int mlx4_ib_modify_port(struct ib_device *ibdev, u8 port, int mask,
586 cap_mask = (attr.port_cap_flags | props->set_port_cap_mask) & 594 cap_mask = (attr.port_cap_flags | props->set_port_cap_mask) &
587 ~props->clr_port_cap_mask; 595 ~props->clr_port_cap_mask;
588 596
589 err = mlx4_SET_PORT(to_mdev(ibdev), port, 597 err = mlx4_ib_SET_PORT(mdev, port,
590 !!(mask & IB_PORT_RESET_QKEY_CNTR), 598 !!(mask & IB_PORT_RESET_QKEY_CNTR),
591 cap_mask); 599 cap_mask);
592 600
593out: 601out:
594 mutex_unlock(&to_mdev(ibdev)->cap_mask_mutex); 602 mutex_unlock(&to_mdev(ibdev)->cap_mask_mutex);