Implement PCAM, MCAM access register commands in mlx5core.

Introduced registers will expose capabilities of new registers and
features related to port/management.
Driver will query MCAM and PCAM in order to avoid failing on old
firmwares with lack of support.

Linux commit:
c835ad64683bd3e2d1b31ed2cb1ff4366932edb1

Submitted by:	slavash@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2019-05-08 10:39:25 +00:00
parent ae73b04113
commit 0358212d37
2 changed files with 28 additions and 0 deletions

View File

@ -76,6 +76,10 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev);
int mlx5_query_board_id(struct mlx5_core_dev *dev);
int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u32 *qcam,
u8 feature_group, u8 access_reg_group);
int mlx5_query_pcam_reg(struct mlx5_core_dev *dev, u32 *pcam,
u8 feature_group, u8 access_reg_group);
int mlx5_query_mcam_reg(struct mlx5_core_dev *dev, u32 *mcap,
u8 feature_group, u8 access_reg_group);
int mlx5_cmd_init_hca(struct mlx5_core_dev *dev);
int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev);
int mlx5_cmd_force_teardown_hca(struct mlx5_core_dev *dev);

View File

@ -79,6 +79,30 @@ int mlx5_query_qcam_reg(struct mlx5_core_dev *mdev, u32 *qcam,
}
EXPORT_SYMBOL_GPL(mlx5_query_qcam_reg);
int mlx5_query_pcam_reg(struct mlx5_core_dev *dev, u32 *pcam, u8 feature_group,
u8 access_reg_group)
{
u32 in[MLX5_ST_SZ_DW(pcam_reg)] = {};
int sz = MLX5_ST_SZ_BYTES(pcam_reg);
MLX5_SET(pcam_reg, in, feature_group, feature_group);
MLX5_SET(pcam_reg, in, access_reg_group, access_reg_group);
return mlx5_core_access_reg(dev, in, sz, pcam, sz, MLX5_REG_PCAM, 0, 0);
}
int mlx5_query_mcam_reg(struct mlx5_core_dev *dev, u32 *mcam, u8 feature_group,
u8 access_reg_group)
{
u32 in[MLX5_ST_SZ_DW(mcam_reg)] = {};
int sz = MLX5_ST_SZ_BYTES(mcam_reg);
MLX5_SET(mcam_reg, in, feature_group, feature_group);
MLX5_SET(mcam_reg, in, access_reg_group, access_reg_group);
return mlx5_core_access_reg(dev, in, sz, mcam, sz, MLX5_REG_MCAM, 0, 0);
}
struct mlx5_reg_pcap {
u8 rsvd0;
u8 port_num;