public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Bryan O'Sullivan" <bos@pathscale.com>
To: rdreier@cisco.com
Cc: openib-general@openib.org, linux-kernel@vger.kernel.org
Subject: [PATCH 18 of 53] ipath - make max mcast sizes configurable
Date: Fri, 12 May 2006 16:43:03 -0700	[thread overview]
Message-ID: <df954e47ff670c3a28d6.1147477383@eng-12.pathscale.com> (raw)
In-Reply-To: <patchbomb.1147477365@eng-12.pathscale.com>

Make the max IB mcast sizes configurable.

Signed-off-by: Bryan O'Sullivan <bos@pathscale.com>

diff -r c5f3731224bb -r df954e47ff67 drivers/infiniband/hw/ipath/ipath_verbs.c
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c	Fri May 12 15:55:28 2006 -0700
@@ -81,6 +81,32 @@ unsigned int ib_ipath_max_sges = 0xFF;
 unsigned int ib_ipath_max_sges = 0xFF;
 module_param_named(max_sges, ib_ipath_max_sges, uint, S_IWUSR | S_IRUGO);
 MODULE_PARM_DESC(max_sges, "Maximum number of SGEs to support");
+
+unsigned int ib_ipath_max_mcast_grps = 16384;
+module_param_named(max_mcast_grps, ib_ipath_max_mcast_grps, uint,
+		   S_IWUSR | S_IRUGO);
+MODULE_PARM_DESC(max_mcast_grps,
+		 "Maximum number of multicast groups to support");
+
+unsigned int ib_ipath_max_mcast_qp_attached = 16;
+module_param_named(max_mcast_qp_attached, ib_ipath_max_mcast_qp_attached,
+		   uint, S_IWUSR | S_IRUGO);
+MODULE_PARM_DESC(max_mcast_qp_attached,
+		 "Maximum number of attached QPs to support");
+
+unsigned int ib_ipath_max_srqs = 1024;
+module_param_named(max_srqs, ib_ipath_max_srqs, uint, S_IWUSR | S_IRUGO);
+MODULE_PARM_DESC(max_srqs, "Maximum number of SRQs to support");
+
+unsigned int ib_ipath_max_srq_sges = 128;
+module_param_named(max_srq_sges, ib_ipath_max_srq_sges,
+		   uint, S_IWUSR | S_IRUGO);
+MODULE_PARM_DESC(max_srq_sges, "Maximum number of SRQ SGEs to support");
+
+unsigned int ib_ipath_max_srq_wrs = 0x1FFFF;
+module_param_named(max_srq_wrs, ib_ipath_max_srq_wrs,
+		   uint, S_IWUSR | S_IRUGO);
+MODULE_PARM_DESC(max_srq_wrs, "Maximum number of SRQ WRs support");
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("PathScale <support@pathscale.com>");
@@ -621,14 +647,14 @@ static int ipath_query_device(struct ib_
 	props->max_qp_rd_atom = 1;
 	props->max_qp_init_rd_atom = 1;
 	/* props->max_res_rd_atom */
-	props->max_srq = 0xffff;
-	props->max_srq_wr = 0xffff;
-	props->max_srq_sge = 255;
+	props->max_srq = ib_ipath_max_srqs;
+	props->max_srq_wr = ib_ipath_max_srq_wrs;
+	props->max_srq_sge = ib_ipath_max_srq_sges;
 	/* props->local_ca_ack_delay */
 	props->atomic_cap = IB_ATOMIC_HCA;
 	props->max_pkeys = ipath_layer_get_npkeys(dev->dd);
-	props->max_mcast_grp = 0xffff;
-	props->max_mcast_qp_attach = 0xffff;
+	props->max_mcast_grp = ib_ipath_max_mcast_grps;
+	props->max_mcast_qp_attach = ib_ipath_max_mcast_qp_attached;
 	props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
 		props->max_mcast_grp;
 
diff -r c5f3731224bb -r df954e47ff67 drivers/infiniband/hw/ipath/ipath_verbs.h
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h	Fri May 12 15:55:28 2006 -0700
@@ -148,6 +148,7 @@ struct ipath_mcast {
 	struct list_head qp_list;
 	wait_queue_head_t wait;
 	atomic_t refcount;
+	int n_attached;
 };
 
 /* Memory region */
@@ -434,6 +435,7 @@ struct ipath_ibdev {
 	u32 n_pds_allocated;	/* number of PDs allocated for device */
 	u32 n_ahs_allocated;	/* number of AHs allocated for device */
 	u32 n_cqs_allocated;	/* number of CQs allocated for device */
+	u32 n_mcast_grps_allocated; /* number of mcast groups allocated */
 	u64 ipath_sword;	/* total dwords sent (sample result) */
 	u64 ipath_rword;	/* total dwords received (sample result) */
 	u64 ipath_spkts;	/* total packets sent (sample result) */
@@ -699,6 +701,16 @@ extern unsigned int ib_ipath_max_qp_wrs;
 
 extern unsigned int ib_ipath_max_sges;
 
+extern unsigned int ib_ipath_max_mcast_grps;
+
+extern unsigned int ib_ipath_max_mcast_qp_attached;
+
+extern unsigned int ib_ipath_max_srqs;
+
+extern unsigned int ib_ipath_max_srq_sges;
+
+extern unsigned int ib_ipath_max_srq_wrs;
+
 extern const u32 ib_ipath_rnr_table[];
 
 #endif				/* IPATH_VERBS_H */
diff -r c5f3731224bb -r df954e47ff67 drivers/infiniband/hw/ipath/ipath_verbs_mcast.c
--- a/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c	Fri May 12 15:55:28 2006 -0700
@@ -92,6 +92,7 @@ static struct ipath_mcast *ipath_mcast_a
 	INIT_LIST_HEAD(&mcast->qp_list);
 	init_waitqueue_head(&mcast->wait);
 	atomic_set(&mcast->refcount, 0);
+	mcast->n_attached = 0;
 
 bail:
 	return mcast;
@@ -157,7 +158,8 @@ bail:
  * the table but the QP was added.  Return ESRCH if the QP was already
  * attached and neither structure was added.
  */
-static int ipath_mcast_add(struct ipath_mcast *mcast,
+static int ipath_mcast_add(struct ipath_ibdev *dev,
+			   struct ipath_mcast *mcast,
 			   struct ipath_mcast_qp *mqp)
 {
 	struct rb_node **n = &mcast_tree.rb_node;
@@ -188,16 +190,28 @@ static int ipath_mcast_add(struct ipath_
 		/* Search the QP list to see if this is already there. */
 		list_for_each_entry_rcu(p, &tmcast->qp_list, list) {
 			if (p->qp == mqp->qp) {
-				spin_unlock_irqrestore(&mcast_lock, flags);
 				ret = ESRCH;
 				goto bail;
 			}
 		}
+		if (tmcast->n_attached == ib_ipath_max_mcast_qp_attached) {
+			ret = ENOMEM;
+			goto bail;
+		}
+
+		tmcast->n_attached++;
+
 		list_add_tail_rcu(&mqp->list, &tmcast->qp_list);
-		spin_unlock_irqrestore(&mcast_lock, flags);
 		ret = EEXIST;
 		goto bail;
 	}
+
+	if (dev->n_mcast_grps_allocated == ib_ipath_max_mcast_grps) {
+		ret = ENOMEM;
+		goto bail;
+	}
+
+	dev->n_mcast_grps_allocated++;
 
 	list_add_tail_rcu(&mqp->list, &mcast->qp_list);
 
@@ -205,17 +219,18 @@ static int ipath_mcast_add(struct ipath_
 	rb_link_node(&mcast->rb_node, pn, n);
 	rb_insert_color(&mcast->rb_node, &mcast_tree);
 
+	ret = 0;
+
+bail:
 	spin_unlock_irqrestore(&mcast_lock, flags);
 
-	ret = 0;
-
-bail:
 	return ret;
 }
 
 int ipath_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
 {
 	struct ipath_qp *qp = to_iqp(ibqp);
+	struct ipath_ibdev *dev = to_idev(ibqp->device);
 	struct ipath_mcast *mcast;
 	struct ipath_mcast_qp *mqp;
 	int ret;
@@ -235,7 +250,7 @@ int ipath_multicast_attach(struct ib_qp 
 		ret = -ENOMEM;
 		goto bail;
 	}
-	switch (ipath_mcast_add(mcast, mqp)) {
+	switch (ipath_mcast_add(dev, mcast, mqp)) {
 	case ESRCH:
 		/* Neither was used: can't attach the same QP twice. */
 		ipath_mcast_qp_free(mqp);
@@ -245,6 +260,12 @@ int ipath_multicast_attach(struct ib_qp 
 	case EEXIST:		/* The mcast wasn't used */
 		ipath_mcast_free(mcast);
 		break;
+	case ENOMEM:
+		/* Exceeded the maximum number of mcast groups. */
+		ipath_mcast_qp_free(mqp);
+		ipath_mcast_free(mcast);
+		ret = -ENOMEM;
+		goto bail;
 	default:
 		break;
 	}
@@ -258,6 +279,7 @@ int ipath_multicast_detach(struct ib_qp 
 int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
 {
 	struct ipath_qp *qp = to_iqp(ibqp);
+	struct ipath_ibdev *dev = to_idev(ibqp->device);
 	struct ipath_mcast *mcast = NULL;
 	struct ipath_mcast_qp *p, *tmp;
 	struct rb_node *n;
@@ -296,6 +318,7 @@ int ipath_multicast_detach(struct ib_qp 
 		 * link until we are sure there are no list walkers.
 		 */
 		list_del_rcu(&p->list);
+		mcast->n_attached--;
 
 		/* If this was the last attached QP, remove the GID too. */
 		if (list_empty(&mcast->qp_list)) {
@@ -319,6 +342,7 @@ int ipath_multicast_detach(struct ib_qp 
 		atomic_dec(&mcast->refcount);
 		wait_event(mcast->wait, !atomic_read(&mcast->refcount));
 		ipath_mcast_free(mcast);
+		dev->n_mcast_grps_allocated--;
 	}
 
 	ret = 0;

  parent reply	other threads:[~2006-05-12 23:45 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-12 23:42 [PATCH 0 of 53] ipath driver updates for 2.6.17-rc4 Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 1 of 53] ipath - fix spinlock recursion bug Bryan O'Sullivan
2006-05-13  1:01   ` Joshua Hudson
2006-05-12 23:42 ` [PATCH 2 of 53] ipath - purge sps_lid and sps_mlid arrays, and /sys entries Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 3 of 53] ipath - report max MR and QP sizes based on table sizes Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 4 of 53] ipath - cap number of PDs that can be allocated Bryan O'Sullivan
2006-05-15 15:45   ` Roland Dreier
2006-05-15 21:06     ` Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 5 of 53] ipath - forbid creation of AHs with illegal ports Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 6 of 53] ipath - forbid creation of AH with DLID of 0 Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 7 of 53] ipath - cap maximum number of AHs Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 8 of 53] ipath - cap number of CQEs Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 9 of 53] ipath - cap number of CQs Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 10 of 53] ipath - require capabilities when creating a QP Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 11 of 53] ipath - don't modify QP if changes fail Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 12 of 53] ipath - reduce overhead of receive interrupts Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 13 of 53] ipath - limit number of SGEs and WRs per QP Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 14 of 53] ipath - forbid empty MRs Bryan O'Sullivan
2006-05-15 15:46   ` Roland Dreier
2006-05-15 21:17     ` Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 15 of 53] ipath - make some maximum values more sane Bryan O'Sullivan
2006-05-15 15:48   ` Roland Dreier
2006-05-16 22:44   ` [openib-general] " Arlin Davis
2006-05-12 23:43 ` [PATCH 16 of 53] ipath - fix reporting of driver version to userspace Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 17 of 53] ipath - fail properly if GID missing Bryan O'Sullivan
2006-05-12 23:43 ` Bryan O'Sullivan [this message]
2006-05-12 23:43 ` [PATCH 19 of 53] ipath - replace uses of LIST_POISON Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 20 of 53] ipath - more sharing between RC and UC code Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 21 of 53] ipath - use phys_to_virt instead of bus_to_virt Bryan O'Sullivan
2006-05-15 15:50   ` Roland Dreier
2006-05-15 21:21     ` Bryan O'Sullivan
2006-05-15 21:28       ` Roland Dreier
2006-05-15 23:13         ` [openib-general] " Grant Grundler
2006-05-15 23:16           ` Roland Dreier
2006-05-15 23:30             ` Grant Grundler
2006-05-15 23:34               ` Roland Dreier
2006-05-16 20:05       ` Christoph Hellwig
2006-05-12 23:43 ` [PATCH 22 of 53] ipath - fix "many lost ticks" warning Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 23 of 53] ipath - [TRIVIAL] typo fixes Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 24 of 53] ipath - count dropped VL15 packets Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 25 of 53] ipath - remove some duplicated lines of code Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 26 of 53] ipath - treat PE800 rev1 and rev2 as similar Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 27 of 53] ipath - fix accounting of data packets with bad VLs Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 28 of 53] ipath - forbid setting of invalid MLID Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 29 of 53] ipath - remove redundant register read Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 30 of 53] ipath - count VL15 packet drops due to bad VL or lack of buffers Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 31 of 53] ipath - forbid sending of bad packet sizes Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 32 of 53] ipath - fix NULL dereference during cleanup Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 33 of 53] ipath - clean up some comments Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 34 of 53] ipath - fix occasional hangs in SDP Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 35 of 53] ipath - some interrelated stability and cleanliness fixes Bryan O'Sullivan
2006-05-15 15:53   ` Roland Dreier
2006-05-12 23:43 ` [PATCH 36 of 53] ipath - count local link integrity errors Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 37 of 53] ipath - name zero counter offsets consistently Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 38 of 53] ipath - SRQ compliance checks Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 39 of 53] ipath - count PE800 receive interrupts on user ports Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 40 of 53] ipath - remember to drop spinlock Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 41 of 53] ipath - disable interrupts while holding spinlock in RWQE get Bryan O'Sullivan
2006-05-15 15:55   ` Roland Dreier
2006-05-12 23:43 ` [PATCH 42 of 53] ipath - increment pointer properly when doing a diag read Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 43 of 53] ipath - fix memory leak when creating a QP fails Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 44 of 53] ipath - allow diags on any unit Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 45 of 53] ipath - fix memory leak when create of QP fails Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 46 of 53] ipath - enable GPIO interrupt on HT-460 Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 47 of 53] ipath - fix problem with lost interrupts on HT-400 Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 48 of 53] ipath - QP should ignore receive queue size if SRQ specified Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 49 of 53] ipath - NULL-terminate pci_device_id table Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 50 of 53] ipath - reduce maximum table sizes Bryan O'Sullivan
2006-05-15 16:00   ` Roland Dreier
2006-05-12 23:43 ` [PATCH 51 of 53] ipath - fix reporting of vendor ID and a few other trivial bits Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 52 of 53] ipath - register as IB device owner Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 53 of 53] ipath - add memory barrier when waiting for writes Bryan O'Sullivan
2006-05-15 15:57   ` Roland Dreier
2006-05-15 21:10     ` Bryan O'Sullivan
2006-05-15 23:01       ` ralphc
2006-05-15 23:08         ` Roland Dreier
2006-05-15 23:25           ` ralphc
2006-05-15 23:28             ` [openib-general] " Roland Dreier
2006-05-15 23:38               ` ralphc
2006-05-15 23:47                 ` Roland Dreier
2006-05-15 15:02 ` [openib-general] [PATCH 0 of 53] ipath driver updates for 2.6.17-rc4 Roger Heflin
2006-05-15 15:44 ` Roland Dreier
2006-05-15 16:00   ` [openib-general] " Roger Heflin
2006-05-15 16:04     ` Roland Dreier
2006-05-15 20:11       ` Roger Heflin
2006-05-15 21:09         ` Bryan O'Sullivan
2006-05-15 21:07   ` Bryan O'Sullivan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df954e47ff670c3a28d6.1147477383@eng-12.pathscale.com \
    --to=bos@pathscale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openib-general@openib.org \
    --cc=rdreier@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox