Author: hselasky
Date: Thu May 16 16:00:37 2019
New Revision: 347736
URL: https://svnweb.freebsd.org/changeset/base/347736

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/12/sys/dev/mlx5/device.h
  stable/12/sys/dev/mlx5/driver.h
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/device.h
==============================================================================
--- stable/12/sys/dev/mlx5/device.h     Thu May 16 16:00:00 2019        
(r347735)
+++ stable/12/sys/dev/mlx5/device.h     Thu May 16 16:00:37 2019        
(r347736)
@@ -1050,6 +1050,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/12/sys/dev/mlx5/driver.h
==============================================================================
--- stable/12/sys/dev/mlx5/driver.h     Thu May 16 16:00:00 2019        
(r347735)
+++ stable/12/sys/dev/mlx5/driver.h     Thu May 16 16:00:37 2019        
(r347736)
@@ -699,6 +699,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/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c  Thu May 16 16:00:00 2019        
(r347735)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c  Thu May 16 16:00:37 2019        
(r347736)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to