mlx4_core: Enable memory windows in {INIT, QUERY}_HCA
authorShani Michaeli <shanim@mellanox.com>
Wed, 6 Feb 2013 16:19:11 +0000 (16:19 +0000)
committerRoland Dreier <roland@purestorage.com>
Mon, 25 Feb 2013 18:44:31 +0000 (10:44 -0800)
Add memory windows-related code to INIT_HCA and QUERY_HCA.

Signed-off-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Shani Michaeli <shanim@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/net/ethernet/mellanox/mlx4/fw.c
drivers/net/ethernet/mellanox/mlx4/fw.h
drivers/net/ethernet/mellanox/mlx4/main.c
drivers/net/ethernet/mellanox/mlx4/mlx4.h

index a389612f8a4a97627a6a77aff608d9afb7e07212..d136b36952587b256c0b63074c059dbc298ef9e1 100644 (file)
@@ -1207,6 +1207,7 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param)
 #define  INIT_HCA_FS_IB_NUM_ADDRS_OFFSET  (INIT_HCA_FS_PARAM_OFFSET + 0x26)
 #define INIT_HCA_TPT_OFFSET             0x0f0
 #define         INIT_HCA_DMPT_BASE_OFFSET       (INIT_HCA_TPT_OFFSET + 0x00)
+#define  INIT_HCA_TPT_MW_OFFSET                 (INIT_HCA_TPT_OFFSET + 0x08)
 #define         INIT_HCA_LOG_MPT_SZ_OFFSET      (INIT_HCA_TPT_OFFSET + 0x0b)
 #define         INIT_HCA_MTT_BASE_OFFSET        (INIT_HCA_TPT_OFFSET + 0x10)
 #define         INIT_HCA_CMPT_BASE_OFFSET       (INIT_HCA_TPT_OFFSET + 0x18)
@@ -1323,6 +1324,7 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param)
        /* TPT attributes */
 
        MLX4_PUT(inbox, param->dmpt_base,  INIT_HCA_DMPT_BASE_OFFSET);
+       MLX4_PUT(inbox, param->mw_enabled, INIT_HCA_TPT_MW_OFFSET);
        MLX4_PUT(inbox, param->log_mpt_sz, INIT_HCA_LOG_MPT_SZ_OFFSET);
        MLX4_PUT(inbox, param->mtt_base,   INIT_HCA_MTT_BASE_OFFSET);
        MLX4_PUT(inbox, param->cmpt_base,  INIT_HCA_CMPT_BASE_OFFSET);
@@ -1419,6 +1421,7 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev,
        /* TPT attributes */
 
        MLX4_GET(param->dmpt_base,  outbox, INIT_HCA_DMPT_BASE_OFFSET);
+       MLX4_GET(param->mw_enabled, outbox, INIT_HCA_TPT_MW_OFFSET);
        MLX4_GET(param->log_mpt_sz, outbox, INIT_HCA_LOG_MPT_SZ_OFFSET);
        MLX4_GET(param->mtt_base,   outbox, INIT_HCA_MTT_BASE_OFFSET);
        MLX4_GET(param->cmpt_base,  outbox, INIT_HCA_CMPT_BASE_OFFSET);
index dbf2f69cc59fcb5efeefd7b50bce07ba975812eb..9f1a25ca002c02b2736cdab3e799c6fae3b2d2b1 100644 (file)
@@ -170,6 +170,7 @@ struct mlx4_init_hca_param {
        u8  log_mc_table_sz;
        u8  log_mpt_sz;
        u8  log_uar_sz;
+       u8  mw_enabled;  /* Enable memory windows */
        u8  uar_page_sz; /* log pg sz in 4k chunks */
        u8  fs_hash_enable_bits;
        u8  steering_mode; /* for QUERY_HCA */
index 5163af314990d2793d529b7db24e752490eb9645..7fdd04af379d6a9e2dc3616dc7e01071ab5fc9f3 100644 (file)
@@ -1447,6 +1447,10 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
 
                init_hca.log_uar_sz = ilog2(dev->caps.num_uars);
                init_hca.uar_page_sz = PAGE_SHIFT - 12;
+               init_hca.mw_enabled = 0;
+               if (dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW ||
+                   dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN)
+                       init_hca.mw_enabled = INIT_HCA_TPT_MW_ENABLE;
 
                err = mlx4_init_icm(dev, &dev_cap, &init_hca, icm_size);
                if (err)
index 539212b1c8dcb23fbf1c03ae863b207077c0955d..8b75d5ef0940b9758cea7d1ec1235867d990276f 100644 (file)
@@ -60,6 +60,8 @@
 #define MLX4_FS_MGM_LOG_ENTRY_SIZE     7
 #define MLX4_FS_NUM_MCG                        (1 << 17)
 
+#define INIT_HCA_TPT_MW_ENABLE          (1 << 7)
+
 enum {
        MLX4_FS_L2_HASH = 0,
        MLX4_FS_L2_L3_L4_HASH,