aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4/main.c
diff options
context:
space:
mode:
authorYevgeny Petrilin <yevgenyp@mellanox.co.il>2011-03-22 18:37:47 -0400
committerDavid S. Miller <davem@davemloft.net>2011-03-23 15:24:18 -0400
commit0b7ca5a928e2271bbc225e9e1ac1f22e9fbee54f (patch)
tree8a24efdb4ceb6f28a8d49e942f80d397c06f4a5f /drivers/net/mlx4/main.c
parent908222655b38005483d64385e06341a38647fdf1 (diff)
mlx4: Changing interrupt scheme
Adding a pool of MSI-X vectors and EQs that can be used explicitly by mlx4_core customers (mlx4_ib, mlx4_en). The consumers will assign their own names to the interrupt vectors. Those vectors are not opened at mlx4 device initialization, opened by demand. Changed the max number of possible EQs according to the new scheme, no longer relies on on number of cores. The new functionality is exposed through mlx4_assign_eq() and mlx4_release_eq(). Customers that do not use the new API will get completion vectors as before. Signed-off-by: Markuze Alex <markuze@mellanox.co.il> Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mlx4/main.c')
-rw-r--r--drivers/net/mlx4/main.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 2765a3ce9c24..517ca34f5b37 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -969,13 +969,15 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
969{ 969{
970 struct mlx4_priv *priv = mlx4_priv(dev); 970 struct mlx4_priv *priv = mlx4_priv(dev);
971 struct msix_entry *entries; 971 struct msix_entry *entries;
972 int nreq; 972 int nreq = min_t(int, dev->caps.num_ports *
973 min_t(int, num_online_cpus() + 1, MAX_MSIX_P_PORT)
974 + MSIX_LEGACY_SZ, MAX_MSIX);
973 int err; 975 int err;
974 int i; 976 int i;
975 977
976 if (msi_x) { 978 if (msi_x) {
977 nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs, 979 nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,
978 num_possible_cpus() + 1); 980 nreq);
979 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); 981 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
980 if (!entries) 982 if (!entries)
981 goto no_msi; 983 goto no_msi;
@@ -998,7 +1000,15 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
998 goto no_msi; 1000 goto no_msi;
999 } 1001 }
1000 1002
1001 dev->caps.num_comp_vectors = nreq - 1; 1003 if (nreq <
1004 MSIX_LEGACY_SZ + dev->caps.num_ports * MIN_MSIX_P_PORT) {
1005 /*Working in legacy mode , all EQ's shared*/
1006 dev->caps.comp_pool = 0;
1007 dev->caps.num_comp_vectors = nreq - 1;
1008 } else {
1009 dev->caps.comp_pool = nreq - MSIX_LEGACY_SZ;
1010 dev->caps.num_comp_vectors = MSIX_LEGACY_SZ - 1;
1011 }
1002 for (i = 0; i < nreq; ++i) 1012 for (i = 0; i < nreq; ++i)
1003 priv->eq_table.eq[i].irq = entries[i].vector; 1013 priv->eq_table.eq[i].irq = entries[i].vector;
1004 1014
@@ -1010,6 +1020,7 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
1010 1020
1011no_msi: 1021no_msi:
1012 dev->caps.num_comp_vectors = 1; 1022 dev->caps.num_comp_vectors = 1;
1023 dev->caps.comp_pool = 0;
1013 1024
1014 for (i = 0; i < 2; ++i) 1025 for (i = 0; i < 2; ++i)
1015 priv->eq_table.eq[i].irq = dev->pdev->irq; 1026 priv->eq_table.eq[i].irq = dev->pdev->irq;
@@ -1151,6 +1162,9 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1151 if (err) 1162 if (err)
1152 goto err_close; 1163 goto err_close;
1153 1164
1165 priv->msix_ctl.pool_bm = 0;
1166 spin_lock_init(&priv->msix_ctl.pool_lock);
1167
1154 mlx4_enable_msi_x(dev); 1168 mlx4_enable_msi_x(dev);
1155 1169
1156 err = mlx4_setup_hca(dev); 1170 err = mlx4_setup_hca(dev);