[openib-general][RFC][PATCH] mthca: HCA initialization parameters

Leonid Arsh leonida at voltaire.com
Thu May 18 07:48:10 PDT 2006


Hello,
   we need a capability to change the HCA parameters, in order to tune its resources.

   There is a special structure 'mthca_profile' in the MTHA driver, used during the HCA initialization and
   determining different HCA initialization parameters, such as maximum number of QPs, CQs, address vectors etc.
   Unfortunately, the parameters can not be defined outside the driver.

   Attached file implements a number of the module parameters allowing to define the 'mthca_profile' values.

   Comments, corrections and suggestions are welcomed.
  


Signed-off-by: Leonid Arsh <leonida at voltaire.com>

--- openib-1.0/src/linux-kernel/infiniband/hw/mthca/mthca_main.c.orig	2006-05-15 21:27:59.000000000 +0300
+++ openib-1.0/src/linux-kernel/infiniband/hw/mthca/mthca_main.c	2006-05-17 22:10:35.000000000 +0300
@@ -81,6 +81,53 @@
 module_param(tune_pci, int, 0444);
 MODULE_PARM_DESC(tune_pci, "increase PCI burst from the default set by BIOS if nonzero");
 
+static int num_qp = 0;
+module_param(num_qp, int, 0444);
+MODULE_PARM_DESC(num_qp, "Maximum number of QPs available per HCA");
+
+static int rdb_per_qp = 0;
+module_param(rdb_per_qp, int, 0444);
+MODULE_PARM_DESC(rdb_per_qp, "Number of RDB buffers per QP");
+
+static int num_srq = 0;
+module_param(num_srq, int, 0444);
+MODULE_PARM_DESC(num_srq, "Maximum number of Shared Receive Queues per HCA ");
+
+static int num_cq = 0;
+module_param(num_cq, int, 0444);
+MODULE_PARM_DESC(num_cq, "Maximum number of CQs per HCA");
+
+static int num_mcg = 0;
+module_param(num_mcg, int, 0444);
+MODULE_PARM_DESC(num_mcg, "Maximum number of Multicast groups per HCA");
+
+static int num_mpt = 0;
+module_param(num_mpt, int, 0444);
+MODULE_PARM_DESC(num_mpt,
+		 "Maximum number of Memory Protection Table entries per HCA");
+
+static int num_mtt = 0;
+module_param(num_mtt, int, 0444);
+MODULE_PARM_DESC(num_mtt,
+		 "Maximum number of Memory Translation table segments per HCA");
+
+static int num_udav = 0;
+module_param(num_udav, int, 0444);
+MODULE_PARM_DESC(num_udav, "Maximum number of UD Address Vectors per HCA");
+
+static int num_uar = 0;
+module_param(num_uar, int, 0444);
+MODULE_PARM_DESC(num_uar, "Maximum number of User Access Regions per HCA");
+
+static int fmr_reserved_mtts = 0;
+module_param(fmr_reserved_mtts, int, 0444);
+MODULE_PARM_DESC(fmr_reserved_mtts,
+		 "Number of Memory Translation table segments reserved for FMR");
+
+static int uarc_size = 0;
+module_param(uarc_size, int, 0444);
+MODULE_PARM_DESC(uarc_size, "User Access Region Context size");
+
 static const char mthca_version[] __devinitdata =
 	DRV_NAME ": Mellanox InfiniBand HCA driver v"
 	DRV_VERSION " (" DRV_RELDATE ")\n";
@@ -97,6 +144,22 @@
 	.uarc_size	   = 1 << 18,	/* Arbel only */
 };
 
+static void __devinit mthca_setup_profile(struct mthca_profile *profile)
+{
+
+	if(num_qp)            profile->num_qp            = num_qp;
+	if(rdb_per_qp)        profile->rdb_per_qp        = rdb_per_qp;
+	if(num_srq)           profile->num_srq           = num_srq;
+	if(num_cq)            profile->num_cq            = num_cq;
+	if(num_mcg)           profile->num_mcg           = num_mcg;
+	if(num_mpt)           profile->num_mpt           = num_mpt;
+	if(num_mtt)           profile->num_mtt           = num_mtt;
+	if(num_udav)          profile->num_udav          = num_udav;
+	if(num_uar)           profile->num_uar           = num_uar;
+	if(num_uar)           profile->uarc_size         = num_uar;
+	if(fmr_reserved_mtts) profile->fmr_reserved_mtts = fmr_reserved_mtts;
+
+}
 static int __devinit mthca_tune_pci(struct mthca_dev *mdev)
 {
 	int cap;
@@ -994,6 +1057,8 @@
 	printk(KERN_INFO PFX "Initializing %s\n",
 	       pci_name(pdev));
 
+	mthca_setup_profile(&default_profile);
+
 	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);



More information about the general mailing list