[openib-general][RFC][PATCH] mthca: HCA initialization parameters
Leonid Arsh
leonida at voltaire.com
Wed May 31 07:54:14 PDT 2006
Roland,
I'm resending the patch again.
I removed the num_srq (Maximum number of Shared Receive Queues) parameter here - it's initialized according to
the device limit and we don't need to change it, most probably.
Regards,
Leonid
On 5/30/06, Leonid Arsh <leonida at voltaire.com> wrote:
>
> Roland,
>
> Further to our discussions I'm sending the fixed patch.
> This patch implements the module parameters allowing the user to change the HCA initialization values.
> I left only needed parameters and added the parameter validation.
> Now the set of the parameters is closest to the profile parameters used in the old Mellanox driver.
> The parameters may be read from the sysfs, but cannot be changed.
>
> Regards,
> Leonid
>
Signed-off-by: Leonid Arsh <leonida at voltaire.com>
--- openib-1.0/src/linux-kernel/infiniband/hw/mthca/mthca_main.c.orig 2006-05-31 20:28:28.000000000 +0300
+++ openib-1.0/src/linux-kernel/infiniband/hw/mthca/mthca_main.c.OK2 2006-05-31 20:34:30.000000000 +0300
@@ -81,9 +81,6 @@
module_param(tune_pci, int, 0444);
MODULE_PARM_DESC(tune_pci, "increase PCI burst from the default set by BIOS if nonzero");
-static const char mthca_version[] __devinitdata =
- DRV_NAME ": Mellanox InfiniBand HCA driver v"
- DRV_VERSION " (" DRV_RELDATE ")\n";
static struct mthca_profile default_profile = {
.num_qp = 1 << 16,
@@ -97,6 +94,107 @@
.uarc_size = 1 << 18, /* Arbel only */
};
+module_param_named(num_qp, default_profile.num_qp, int, 0444);
+MODULE_PARM_DESC(num_qp, "Maximum number of QPs available per HCA");
+
+module_param_named(rdb_per_qp, default_profile.rdb_per_qp, int, 0444);
+MODULE_PARM_DESC(rdb_per_qp, "Number of RDB buffers per QP");
+
+module_param_named(num_cq, default_profile.num_cq, int, 0444);
+MODULE_PARM_DESC(num_cq, "Maximum number of CQs per HCA");
+
+module_param_named(num_mcg, default_profile.num_mcg, int, 0444);
+MODULE_PARM_DESC(num_mcg, "Maximum number of Multicast groups per HCA");
+
+module_param_named(num_mpt, default_profile.num_mpt, int, 0444);
+MODULE_PARM_DESC(num_mpt,
+ "Maximum number of Memory Protection Table entries per HCA");
+
+module_param_named(num_mtt, default_profile.num_mtt, int, 0444);
+MODULE_PARM_DESC(num_mtt,
+ "Maximum number of Memory Translation table segments per HCA");
+/* Tavor only */
+module_param_named(num_udav, default_profile.num_udav, int, 0444);
+MODULE_PARM_DESC(num_udav, "Maximum number of UD Address Vectors per HCA");
+
+/* Tavor only */
+module_param_named(fmr_reserved_mtts, default_profile.fmr_reserved_mtts, int, 0444);
+MODULE_PARM_DESC(fmr_reserved_mtts,
+ "Number of Memory Translation table segments reserved for FMR");
+
+static const char mthca_version[] __devinitdata =
+ DRV_NAME ": Mellanox InfiniBand HCA driver v"
+ DRV_VERSION " (" DRV_RELDATE ")\n";
+
+static int __devinit mthca_validate_profile(struct mthca_dev *mdev,
+ struct mthca_profile *profile)
+{
+
+ if(default_profile.num_qp & (default_profile.num_qp-1)) {
+ mthca_err(mdev, "Invalid num_qp parameter value (%d).\n",
+ default_profile.num_qp);
+ goto err_inval;
+ }
+
+ if(default_profile.rdb_per_qp & (default_profile.rdb_per_qp-1)) {
+ mthca_err(mdev, "Invalid rdb_per_qp parameter value (%d)\n",
+ default_profile.rdb_per_qp);
+ goto err_inval;
+ }
+
+ if(default_profile.num_cq & (default_profile.num_cq-1)) {
+ mthca_err(mdev, "Invalid num_cq parameter value (%d)\n",
+ default_profile.num_cq);
+ goto err_inval;
+ }
+
+ if(default_profile.num_mcg & (default_profile.num_mcg-1)) {
+ mthca_err(mdev, "Invalid num_mcg parameter value (%d)\n",
+ default_profile.num_mcg);
+ goto err_inval;
+ }
+ if(default_profile.num_mpt & (default_profile.num_mpt-1)) {
+ mthca_err(mdev, "Invalid num_mpt parameter value (%d)\n",
+ default_profile.num_mpt);
+ goto err_inval;
+ }
+
+ if(default_profile.num_mtt & (default_profile.num_mtt-1)) {
+ mthca_err(mdev, "Invalid num_mtt parameter value (%d)\n",
+ default_profile.num_mtt);
+ goto err_inval;
+ }
+
+ if (mthca_is_memfree(mdev)) {
+
+ if(default_profile.num_udav & (default_profile.num_udav-1)) {
+ mthca_err(mdev, "Invalid num_udav parameter value (%d)\n",
+ default_profile.num_udav);
+ goto err_inval;
+ }
+
+ if(default_profile.fmr_reserved_mtts & (default_profile.fmr_reserved_mtts-1)) {
+ mthca_err(mdev, "Invalid fmr_reserved_mtts parameter value (%d)\n",
+ default_profile.fmr_reserved_mtts);
+ goto err_inval;
+ } else if (default_profile.fmr_reserved_mtts >= default_profile.num_mtt ) {
+ mthca_err(mdev,
+ "Invalid fmr_reserved_mtts parameter value (%d). "
+ "Must be lower then num_mtt (%d)\n",
+ default_profile.fmr_reserved_mtts,
+ default_profile.num_mtt );
+ return -EINVAL;
+ }
+ }
+
+ return 0;
+
+err_inval:
+ mthca_err(mdev, "This parameter must be power of two.\n");
+ return -EINVAL;
+
+}
+
static int __devinit mthca_tune_pci(struct mthca_dev *mdev)
{
int cap;
@@ -994,6 +1092,7 @@
printk(KERN_INFO PFX "Initializing %s\n",
pci_name(pdev));
+
if (id->driver_data >= ARRAY_SIZE(mthca_hca_table)) {
printk(KERN_ERR PFX "%s has invalid driver data %lx\n",
pci_name(pdev), id->driver_data);
@@ -1095,6 +1194,10 @@
if (err)
goto err_cmd;
+ err = mthca_validate_profile(mdev, &default_profile);
+ if (err)
+ goto err_profile;
+
err = mthca_init_hca(mdev);
if (err)
goto err_cmd;
@@ -1147,6 +1250,7 @@
mthca_close_hca(mdev);
err_cmd:
+err_profile:
mthca_cmd_cleanup(mdev);
err_free_dev:
More information about the general
mailing list