aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx4/main.c
diff options
context:
space:
mode:
authorMarcel Apfelbaum <marcela@dev.mellanox.co.il>2012-05-30 05:14:51 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-31 18:18:16 -0400
commit3fc929e2d693185aac2686e5e64e24eae10642a4 (patch)
treec13786131ec3695af7caf97d55b92197cc6fdd6a /drivers/net/ethernet/mellanox/mlx4/main.c
parent30f7c73bed749814f4985b1ce4566fe64b9c25f0 (diff)
net/mlx4_core: Fix number of EQs used in ICM initialisation
In SRIOV mode, the number of EQs used when computing the total ICM size was incorrect. To fix this, we do the following: 1. We add a new structure to mlx4_dev, mlx4_phys_caps, to contain physical HCA capabilities. The PPF uses the phys capabilities when it computes things like ICM size. The dev_caps structure will then contain the paravirtualized values, making bookkeeping much easier in SRIOV mode. We add a structure rather than a single parameter because there will be other fields in the phys_caps. The first field we add to the mlx4_phys_caps structure is num_phys_eqs. 2. In INIT_HCA, when running in SRIOV mode, the "log_num_eqs" parameter passed to the FW is the number of EQs per VF/PF; each function (PF or VF) has this number of EQs available. However, the total number of EQs which must be allowed for in the ICM is (1 << log_num_eqs) * (#VFs + #PFs). Rather than compute this quantity, we allocate ICM space for 1024 EQs (which is the device maximum number of EQs, and which is the value we place in the mlx4_phys_caps structure). For INIT_HCA, however, we use the per-function number of EQs as described above. Signed-off-by: Marcel Apfelbaum <marcela@dev.mellanox.co.il> Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/main.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 2e024a68fa81..2fe9fe5f7cfb 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);