Skip to content

Commit 7a58779

Browse files
paravmellanoxjgunthorpe
authored andcommitted
IB/mlx5: Improve query port for representor port
Improve query port functionality for representor port as below. 1. RoCE Qkey violation counters are not applicable for representor port. 2. Avoid setting gid_tbl_len twice for representor port. 3. Avoid setting ip_gids and IB_PORT_CM_SUP property for representor port as GID table is empty and CM support is not present in representor mode. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Parav Pandit <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 2019d70 commit 7a58779

File tree

1 file changed

+10
-21
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+10
-21
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
462462
struct net_device *ndev, *upper;
463463
enum ib_mtu ndev_ib_mtu;
464464
bool put_mdev = true;
465-
u16 qkey_viol_cntr;
466465
u32 eth_prot_oper;
467466
u8 mdev_port_num;
468467
bool ext;
@@ -500,20 +499,22 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
500499
translate_eth_proto_oper(eth_prot_oper, &props->active_speed,
501500
&props->active_width, ext);
502501

503-
props->port_cap_flags |= IB_PORT_CM_SUP;
504-
props->ip_gids = true;
502+
if (!dev->is_rep && mlx5_is_roce_enabled(mdev)) {
503+
u16 qkey_viol_cntr;
505504

506-
props->gid_tbl_len = MLX5_CAP_ROCE(dev->mdev,
507-
roce_address_table_size);
505+
props->port_cap_flags |= IB_PORT_CM_SUP;
506+
props->ip_gids = true;
507+
props->gid_tbl_len = MLX5_CAP_ROCE(dev->mdev,
508+
roce_address_table_size);
509+
mlx5_query_nic_vport_qkey_viol_cntr(mdev, &qkey_viol_cntr);
510+
props->qkey_viol_cntr = qkey_viol_cntr;
511+
}
508512
props->max_mtu = IB_MTU_4096;
509513
props->max_msg_sz = 1 << MLX5_CAP_GEN(dev->mdev, log_max_msg);
510514
props->pkey_tbl_len = 1;
511515
props->state = IB_PORT_DOWN;
512516
props->phys_state = IB_PORT_PHYS_STATE_DISABLED;
513517

514-
mlx5_query_nic_vport_qkey_viol_cntr(mdev, &qkey_viol_cntr);
515-
props->qkey_viol_cntr = qkey_viol_cntr;
516-
517518
/* If this is a stub query for an unaffiliated port stop here */
518519
if (!put_mdev)
519520
goto out;
@@ -1383,19 +1384,7 @@ int mlx5_ib_query_port(struct ib_device *ibdev, u8 port,
13831384
static int mlx5_ib_rep_query_port(struct ib_device *ibdev, u8 port,
13841385
struct ib_port_attr *props)
13851386
{
1386-
int ret;
1387-
1388-
/* Only link layer == ethernet is valid for representors
1389-
* and we always use port 1
1390-
*/
1391-
ret = mlx5_query_port_roce(ibdev, port, props);
1392-
if (ret || !props)
1393-
return ret;
1394-
1395-
/* We don't support GIDS */
1396-
props->gid_tbl_len = 0;
1397-
1398-
return ret;
1387+
return mlx5_query_port_roce(ibdev, port, props);
13991388
}
14001389

14011390
static int mlx5_ib_rep_query_pkey(struct ib_device *ibdev, u8 port, u16 index,

0 commit comments

Comments
 (0)