aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/profile.c9
-rw-r--r--include/linux/mlx4/device.h6
3 files changed, 17 insertions, 15 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 2e024a68fa8..2fe9fe5f7cf 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -142,12 +142,6 @@ struct mlx4_port_config {
142 struct pci_dev *pdev; 142 struct pci_dev *pdev;
143}; 143};
144 144
145static inline int mlx4_master_get_num_eqs(struct mlx4_dev *dev)
146{
147 return dev->caps.reserved_eqs +
148 MLX4_MFUNC_EQ_NUM * (dev->num_slaves + 1);
149}
150
151int mlx4_check_port_params(struct mlx4_dev *dev, 145int mlx4_check_port_params(struct mlx4_dev *dev,
152 enum mlx4_port_type *port_type) 146 enum mlx4_port_type *port_type)
153{ 147{
@@ -217,6 +211,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
217 } 211 }
218 212
219 dev->caps.num_ports = dev_cap->num_ports; 213 dev->caps.num_ports = dev_cap->num_ports;
214 dev->phys_caps.num_phys_eqs = MLX4_MAX_EQ_NUM;
220 for (i = 1; i <= dev->caps.num_ports; ++i) { 215 for (i = 1; i <= dev->caps.num_ports; ++i) {
221 dev->caps.vl_cap[i] = dev_cap->max_vl[i]; 216 dev->caps.vl_cap[i] = dev_cap->max_vl[i];
222 dev->caps.ib_mtu_cap[i] = dev_cap->ib_mtu[i]; 217 dev->caps.ib_mtu_cap[i] = dev_cap->ib_mtu[i];
@@ -810,9 +805,8 @@ static int mlx4_init_cmpt_table(struct mlx4_dev *dev, u64 cmpt_base,
810 if (err) 805 if (err)
811 goto err_srq; 806 goto err_srq;
812 807
813 num_eqs = (mlx4_is_master(dev)) ? 808 num_eqs = (mlx4_is_master(dev)) ? dev->phys_caps.num_phys_eqs :
814 roundup_pow_of_two(mlx4_master_get_num_eqs(dev)) : 809 dev->caps.num_eqs;
815 dev->caps.num_eqs;
816 err = mlx4_init_icm_table(dev, &priv->eq_table.cmpt_table, 810 err = mlx4_init_icm_table(dev, &priv->eq_table.cmpt_table,
817 cmpt_base + 811 cmpt_base +
818 ((u64) (MLX4_CMPT_TYPE_EQ * 812 ((u64) (MLX4_CMPT_TYPE_EQ *
@@ -874,9 +868,8 @@ static int mlx4_init_icm(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap,
874 } 868 }
875 869
876 870
877 num_eqs = (mlx4_is_master(dev)) ? 871 num_eqs = (mlx4_is_master(dev)) ? dev->phys_caps.num_phys_eqs :
878 roundup_pow_of_two(mlx4_master_get_num_eqs(dev)) : 872 dev->caps.num_eqs;
879 dev->caps.num_eqs;
880 err = mlx4_init_icm_table(dev, &priv->eq_table.table, 873 err = mlx4_init_icm_table(dev, &priv->eq_table.table,
881 init_hca->eqc_base, dev_cap->eqc_entry_sz, 874 init_hca->eqc_base, dev_cap->eqc_entry_sz,
882 num_eqs, num_eqs, 0, 0); 875 num_eqs, num_eqs, 0, 0);
diff --git a/drivers/net/ethernet/mellanox/mlx4/profile.c b/drivers/net/ethernet/mellanox/mlx4/profile.c
index 06e5adeb76f..b83bc928d52 100644
--- a/drivers/net/ethernet/mellanox/mlx4/profile.c
+++ b/drivers/net/ethernet/mellanox/mlx4/profile.c
@@ -126,7 +126,9 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
126 profile[MLX4_RES_AUXC].num = request->num_qp; 126 profile[MLX4_RES_AUXC].num = request->num_qp;
127 profile[MLX4_RES_SRQ].num = request->num_srq; 127 profile[MLX4_RES_SRQ].num = request->num_srq;
128 profile[MLX4_RES_CQ].num = request->num_cq; 128 profile[MLX4_RES_CQ].num = request->num_cq;
129 profile[MLX4_RES_EQ].num = min_t(unsigned, dev_cap->max_eqs, MAX_MSIX); 129 profile[MLX4_RES_EQ].num = mlx4_is_mfunc(dev) ?
130 dev->phys_caps.num_phys_eqs :
131 min_t(unsigned, dev_cap->max_eqs, MAX_MSIX);
130 profile[MLX4_RES_DMPT].num = request->num_mpt; 132 profile[MLX4_RES_DMPT].num = request->num_mpt;
131 profile[MLX4_RES_CMPT].num = MLX4_NUM_CMPTS; 133 profile[MLX4_RES_CMPT].num = MLX4_NUM_CMPTS;
132 profile[MLX4_RES_MTT].num = request->num_mtt * (1 << log_mtts_per_seg); 134 profile[MLX4_RES_MTT].num = request->num_mtt * (1 << log_mtts_per_seg);
@@ -215,9 +217,10 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
215 init_hca->log_num_cqs = profile[i].log_num; 217 init_hca->log_num_cqs = profile[i].log_num;
216 break; 218 break;
217 case MLX4_RES_EQ: 219 case MLX4_RES_EQ:
218 dev->caps.num_eqs = profile[i].num; 220 dev->caps.num_eqs = roundup_pow_of_two(min_t(unsigned, dev_cap->max_eqs,
221 MAX_MSIX));
219 init_hca->eqc_base = profile[i].start; 222 init_hca->eqc_base = profile[i].start;
220 init_hca->log_num_eqs = profile[i].log_num; 223 init_hca->log_num_eqs = ilog2(dev->caps.num_eqs);
221 break; 224 break;
222 case MLX4_RES_DMPT: 225 case MLX4_RES_DMPT:
223 dev->caps.num_mpts = profile[i].num; 226 dev->caps.num_mpts = profile[i].num;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 6e27fa99e8b..6a8f002b8ed 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -64,6 +64,7 @@ enum {
64 MLX4_MAX_NUM_PF = 16, 64 MLX4_MAX_NUM_PF = 16,
65 MLX4_MAX_NUM_VF = 64, 65 MLX4_MAX_NUM_VF = 64,
66 MLX4_MFUNC_MAX = 80, 66 MLX4_MFUNC_MAX = 80,
67 MLX4_MAX_EQ_NUM = 1024,
67 MLX4_MFUNC_EQ_NUM = 4, 68 MLX4_MFUNC_EQ_NUM = 4,
68 MLX4_MFUNC_MAX_EQES = 8, 69 MLX4_MFUNC_MAX_EQES = 8,
69 MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES - 1) 70 MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES - 1)
@@ -239,6 +240,10 @@ static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
239 return (major << 32) | (minor << 16) | subminor; 240 return (major << 32) | (minor << 16) | subminor;
240} 241}
241 242
243struct mlx4_phys_caps {
244 u32 num_phys_eqs;
245};
246
242struct mlx4_caps { 247struct mlx4_caps {
243 u64 fw_ver; 248 u64 fw_ver;
244 u32 function; 249 u32 function;
@@ -499,6 +504,7 @@ struct mlx4_dev {
499 unsigned long flags; 504 unsigned long flags;
500 unsigned long num_slaves; 505 unsigned long num_slaves;
501 struct mlx4_caps caps; 506 struct mlx4_caps caps;
507 struct mlx4_phys_caps phys_caps;
502 struct radix_tree_root qp_table_tree; 508 struct radix_tree_root qp_table_tree;
503 u8 rev_id; 509 u8 rev_id;
504 char board_id[MLX4_BOARD_ID_LEN]; 510 char board_id[MLX4_BOARD_ID_LEN];