Commit 7a58779e authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe

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/20210203130133.4057329-4-leon@kernel.orgSigned-off-by: default avatarParav Pandit <parav@nvidia.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 2019d70e
...@@ -462,7 +462,6 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, ...@@ -462,7 +462,6 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
struct net_device *ndev, *upper; struct net_device *ndev, *upper;
enum ib_mtu ndev_ib_mtu; enum ib_mtu ndev_ib_mtu;
bool put_mdev = true; bool put_mdev = true;
u16 qkey_viol_cntr;
u32 eth_prot_oper; u32 eth_prot_oper;
u8 mdev_port_num; u8 mdev_port_num;
bool ext; bool ext;
...@@ -500,20 +499,22 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, ...@@ -500,20 +499,22 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
translate_eth_proto_oper(eth_prot_oper, &props->active_speed, translate_eth_proto_oper(eth_prot_oper, &props->active_speed,
&props->active_width, ext); &props->active_width, ext);
props->port_cap_flags |= IB_PORT_CM_SUP; if (!dev->is_rep && mlx5_is_roce_enabled(mdev)) {
props->ip_gids = true; u16 qkey_viol_cntr;
props->gid_tbl_len = MLX5_CAP_ROCE(dev->mdev, props->port_cap_flags |= IB_PORT_CM_SUP;
roce_address_table_size); props->ip_gids = true;
props->gid_tbl_len = MLX5_CAP_ROCE(dev->mdev,
roce_address_table_size);
mlx5_query_nic_vport_qkey_viol_cntr(mdev, &qkey_viol_cntr);
props->qkey_viol_cntr = qkey_viol_cntr;
}
props->max_mtu = IB_MTU_4096; props->max_mtu = IB_MTU_4096;
props->max_msg_sz = 1 << MLX5_CAP_GEN(dev->mdev, log_max_msg); props->max_msg_sz = 1 << MLX5_CAP_GEN(dev->mdev, log_max_msg);
props->pkey_tbl_len = 1; props->pkey_tbl_len = 1;
props->state = IB_PORT_DOWN; props->state = IB_PORT_DOWN;
props->phys_state = IB_PORT_PHYS_STATE_DISABLED; props->phys_state = IB_PORT_PHYS_STATE_DISABLED;
mlx5_query_nic_vport_qkey_viol_cntr(mdev, &qkey_viol_cntr);
props->qkey_viol_cntr = qkey_viol_cntr;
/* If this is a stub query for an unaffiliated port stop here */ /* If this is a stub query for an unaffiliated port stop here */
if (!put_mdev) if (!put_mdev)
goto out; goto out;
...@@ -1383,19 +1384,7 @@ int mlx5_ib_query_port(struct ib_device *ibdev, u8 port, ...@@ -1383,19 +1384,7 @@ int mlx5_ib_query_port(struct ib_device *ibdev, u8 port,
static int mlx5_ib_rep_query_port(struct ib_device *ibdev, u8 port, static int mlx5_ib_rep_query_port(struct ib_device *ibdev, u8 port,
struct ib_port_attr *props) struct ib_port_attr *props)
{ {
int ret; return mlx5_query_port_roce(ibdev, port, props);
/* Only link layer == ethernet is valid for representors
* and we always use port 1
*/
ret = mlx5_query_port_roce(ibdev, port, props);
if (ret || !props)
return ret;
/* We don't support GIDS */
props->gid_tbl_len = 0;
return ret;
} }
static int mlx5_ib_rep_query_pkey(struct ib_device *ibdev, u8 port, u16 index, static int mlx5_ib_rep_query_pkey(struct ib_device *ibdev, u8 port, u16 index,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment