Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2019 17:30:55 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r347822 - in stable/11/sys/dev/mlx5: . mlx5_core
Message-ID:  <201905161730.x4GHUtXt005585@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu May 16 17:30:55 2019
New Revision: 347822
URL: https://svnweb.freebsd.org/changeset/base/347822

Log:
  MFC r347272:
  Query and cache PCAM, MCAM registers on initialization in mlx5core.
  
  On load_one, we now cache our capabilities registers internally, similar
  to QUERY_HCA_CAP. Capabilities can later be queried using macros
  introduced in this patch.
  
  Linux commit:
  71862561f3a62015a11de16d1c306481e8415c08
  
  Submitted by:	slavash@
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/device.h
  stable/11/sys/dev/mlx5/driver.h
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/device.h
==============================================================================
--- stable/11/sys/dev/mlx5/device.h	Thu May 16 17:30:20 2019	(r347821)
+++ stable/11/sys/dev/mlx5/device.h	Thu May 16 17:30:55 2019	(r347822)
@@ -1048,6 +1048,12 @@ enum mlx5_mcam_feature_groups {
 	MLX5_GET(qos_cap,\
 		 mdev->hca_caps_max[MLX5_CAP_QOS], cap)
 
+#define MLX5_CAP_PCAM_FEATURE(mdev, fld) \
+	MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld)
+
+#define MLX5_CAP_MCAM_FEATURE(mdev, fld) \
+	MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld)
+
 #define	MLX5_CAP_QCAM_REG(mdev, fld) \
 	MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_access_reg_cap_mask.reg_cap.fld)
 

Modified: stable/11/sys/dev/mlx5/driver.h
==============================================================================
--- stable/11/sys/dev/mlx5/driver.h	Thu May 16 17:30:20 2019	(r347821)
+++ stable/11/sys/dev/mlx5/driver.h	Thu May 16 17:30:55 2019	(r347822)
@@ -673,6 +673,8 @@ struct mlx5_core_dev {
 	u32 hca_caps_cur[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)];
 	u32 hca_caps_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)];
 	struct {
+		u32 pcam[MLX5_ST_SZ_DW(pcam_reg)];
+		u32 mcam[MLX5_ST_SZ_DW(mcam_reg)];
 		u32 qcam[MLX5_ST_SZ_DW(qcam_reg)];
 		u32 fpga[MLX5_ST_SZ_DW(fpga_cap)];
 	} caps;

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c	Thu May 16 17:30:20 2019	(r347821)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c	Thu May 16 17:30:55 2019	(r347822)
@@ -117,6 +117,20 @@ static int mlx5_get_qcam_reg(struct mlx5_core_dev *dev
 				   MLX5_QCAM_REGS_FIRST_128);
 }
 
+static int mlx5_get_pcam_reg(struct mlx5_core_dev *dev)
+{
+	return mlx5_query_pcam_reg(dev, dev->caps.pcam,
+				   MLX5_PCAM_FEATURE_ENHANCED_FEATURES,
+				   MLX5_PCAM_REGS_5000_TO_507F);
+}
+
+static int mlx5_get_mcam_reg(struct mlx5_core_dev *dev)
+{
+	return mlx5_query_mcam_reg(dev, dev->caps.mcam,
+				   MLX5_MCAM_FEATURE_ENHANCED_FEATURES,
+				   MLX5_MCAM_REGS_FIRST_128);
+}
+
 int mlx5_query_hca_caps(struct mlx5_core_dev *dev)
 {
 	int err;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905161730.x4GHUtXt005585>