Commit c9171ea9 authored by Roland Dreier's avatar Roland Dreier Committed by Linus Torvalds

[PATCH] IB/mthca: mem-free multicast table

Tie up one last loose end by mapping enough context memory to cover
the whole multicast table during initialization, and then enable
mem-free mode.  mthca now supports enough of mem-free mode so that
IPoIB works with a mem-free HCA.
Signed-off-by: default avatarRoland Dreier <roland@topspin.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 86a637df
...@@ -207,8 +207,9 @@ struct mthca_av_table { ...@@ -207,8 +207,9 @@ struct mthca_av_table {
}; };
struct mthca_mcg_table { struct mthca_mcg_table {
struct semaphore sem; struct semaphore sem;
struct mthca_alloc alloc; struct mthca_alloc alloc;
struct mthca_icm_table *table;
}; };
struct mthca_dev { struct mthca_dev {
......
...@@ -412,8 +412,29 @@ static int __devinit mthca_init_icm(struct mthca_dev *mdev, ...@@ -412,8 +412,29 @@ static int __devinit mthca_init_icm(struct mthca_dev *mdev,
goto err_unmap_eqp; goto err_unmap_eqp;
} }
/*
* It's not strictly required, but for simplicity just map the
* whole multicast group table now. The table isn't very big
* and it's a lot easier than trying to track ref counts.
*/
mdev->mcg_table.table = mthca_alloc_icm_table(mdev, init_hca->mc_base,
MTHCA_MGM_ENTRY_SIZE,
mdev->limits.num_mgms +
mdev->limits.num_amgms,
mdev->limits.num_mgms +
mdev->limits.num_amgms,
0);
if (!mdev->mcg_table.table) {
mthca_err(mdev, "Failed to map MCG context memory, aborting.\n");
err = -ENOMEM;
goto err_unmap_cq;
}
return 0; return 0;
err_unmap_cq:
mthca_free_icm_table(mdev, mdev->cq_table.table);
err_unmap_eqp: err_unmap_eqp:
mthca_free_icm_table(mdev, mdev->qp_table.eqp_table); mthca_free_icm_table(mdev, mdev->qp_table.eqp_table);
...@@ -587,7 +608,7 @@ static int __devinit mthca_setup_hca(struct mthca_dev *dev) ...@@ -587,7 +608,7 @@ static int __devinit mthca_setup_hca(struct mthca_dev *dev)
goto err_uar_free; goto err_uar_free;
} }
err = mthca_init_pd_table(dev); err = mthca_init_pd_table(dev);
if (err) { if (err) {
mthca_err(dev, "Failed to initialize " mthca_err(dev, "Failed to initialize "
"protection domain table, aborting.\n"); "protection domain table, aborting.\n");
...@@ -635,13 +656,6 @@ static int __devinit mthca_setup_hca(struct mthca_dev *dev) ...@@ -635,13 +656,6 @@ static int __devinit mthca_setup_hca(struct mthca_dev *dev)
mthca_dbg(dev, "NOP command IRQ test passed\n"); mthca_dbg(dev, "NOP command IRQ test passed\n");
if (dev->hca_type == ARBEL_NATIVE) {
mthca_warn(dev, "Sorry, native MT25208 mode support is not complete, "
"aborting.\n");
err = -ENODEV;
goto err_cmd_poll;
}
err = mthca_init_cq_table(dev); err = mthca_init_cq_table(dev);
if (err) { if (err) {
mthca_err(dev, "Failed to initialize " mthca_err(dev, "Failed to initialize "
...@@ -704,7 +718,7 @@ static int __devinit mthca_setup_hca(struct mthca_dev *dev) ...@@ -704,7 +718,7 @@ static int __devinit mthca_setup_hca(struct mthca_dev *dev)
err_uar_table_free: err_uar_table_free:
mthca_cleanup_uar_table(dev); mthca_cleanup_uar_table(dev);
return err; return err;
} }
static int __devinit mthca_request_regions(struct pci_dev *pdev, static int __devinit mthca_request_regions(struct pci_dev *pdev,
...@@ -814,6 +828,7 @@ static int __devinit mthca_init_one(struct pci_dev *pdev, ...@@ -814,6 +828,7 @@ static int __devinit mthca_init_one(struct pci_dev *pdev,
const struct pci_device_id *id) const struct pci_device_id *id)
{ {
static int mthca_version_printed = 0; static int mthca_version_printed = 0;
static int mthca_memfree_warned = 0;
int ddr_hidden = 0; int ddr_hidden = 0;
int err; int err;
struct mthca_dev *mdev; struct mthca_dev *mdev;
...@@ -893,6 +908,10 @@ static int __devinit mthca_init_one(struct pci_dev *pdev, ...@@ -893,6 +908,10 @@ static int __devinit mthca_init_one(struct pci_dev *pdev,
mdev->pdev = pdev; mdev->pdev = pdev;
mdev->hca_type = id->driver_data; mdev->hca_type = id->driver_data;
if (mdev->hca_type == ARBEL_NATIVE && !mthca_memfree_warned++)
mthca_warn(mdev, "Warning: native MT25208 mode support is incomplete. "
"Your HCA may not work properly.\n");
if (ddr_hidden) if (ddr_hidden)
mdev->mthca_flags |= MTHCA_FLAG_DDR_HIDDEN; mdev->mthca_flags |= MTHCA_FLAG_DDR_HIDDEN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment