mirror of https://lore.kernel.org/lkml/
 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 4 of 13] ipath - change handling of PIO buffers
Date: Mon, 24 Apr 2006 14:23:00 -0700	[thread overview]
Message-ID: <8e724d49e74bc1155f4e.1145913780@eng-12.pathscale.com> (raw)
In-Reply-To: <patchbomb.1145913776@eng-12.pathscale.com>

Different ipath hardware types have different numbers of buffers
available, so we decide on the counts ourselves unless we are specifically
overridden with a module parameter.

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

diff -r 49f2286e0bdc -r 8e724d49e74b drivers/infiniband/hw/ipath/ipath_init_chip.c
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c	Wed Apr 19 15:24:36 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c	Wed Apr 19 15:24:36 2006 -0700
@@ -53,13 +53,19 @@ MODULE_PARM_DESC(cfgports, "Set max numb
 
 /*
  * Number of buffers reserved for driver (layered drivers and SMA
- * send).  Reserved at end of buffer list.
+ * send).  Reserved at end of buffer list.   Initialized based on
+ * number of PIO buffers if not set via module interface.
+ * The problem with this is that it's global, but we'll use different
+ * numbers for different chip types.  So the default value is not
+ * very useful.  I've redefined it for the 1.3 release so that it's
+ * zero unless set by the user to something else, in which case we
+ * try to respect it.
  */
-static ushort ipath_kpiobufs = 32;
+static ushort ipath_kpiobufs;
 
 static int ipath_set_kpiobufs(const char *val, struct kernel_param *kp);
 
-module_param_call(kpiobufs, ipath_set_kpiobufs, param_get_uint,
+module_param_call(kpiobufs, ipath_set_kpiobufs, param_get_ushort,
 		  &ipath_kpiobufs, S_IWUSR | S_IRUGO);
 MODULE_PARM_DESC(kpiobufs, "Set number of PIO buffers for driver");
 
@@ -531,8 +537,11 @@ static int init_housekeeping(struct ipat
 	 * Don't clear ipath_flags as 8bit mode was set before
 	 * entering this func. However, we do set the linkstate to
 	 * unknown, so we can watch for a transition.
-	 */
-	dd->ipath_flags |= IPATH_LINKUNK;
+	 * PRESENT is set because we want register reads to work,
+	 * and the kernel infrastructure saw it in config space;
+	 * We clear it if we have failures.
+	 */
+	dd->ipath_flags |= IPATH_LINKUNK | IPATH_PRESENT;
 	dd->ipath_flags &= ~(IPATH_LINKACTIVE | IPATH_LINKARMED |
 			     IPATH_LINKDOWN | IPATH_LINKINIT);
 
@@ -560,6 +569,7 @@ static int init_housekeeping(struct ipat
 	    || (dd->ipath_uregbase & 0xffffffff) == 0xffffffff) {
 		ipath_dev_err(dd, "Register read failures from chip, "
 			      "giving up initialization\n");
+		dd->ipath_flags &= ~IPATH_PRESENT;
 		ret = -ENODEV;
 		goto done;
 	}
@@ -682,16 +692,14 @@ int ipath_init_chip(struct ipath_devdata
 	 */
 	dd->ipath_pioavregs = ALIGN(val, sizeof(u64) * BITS_PER_BYTE / 2)
 		/ (sizeof(u64) * BITS_PER_BYTE / 2);
-	if (!ipath_kpiobufs)	/* have to have at least 1, for SMA */
-		kpiobufs = ipath_kpiobufs = 1;
-	else if ((dd->ipath_piobcnt2k + dd->ipath_piobcnt4k) <
-		 (dd->ipath_cfgports * IPATH_MIN_USER_PORT_BUFCNT)) {
-		dev_info(&dd->pcidev->dev, "Too few PIO buffers (%u) "
-			 "for %u ports to have %u each!\n",
-			 dd->ipath_piobcnt2k + dd->ipath_piobcnt4k,
-			 dd->ipath_cfgports, IPATH_MIN_USER_PORT_BUFCNT);
-		kpiobufs = 1;	/* reserve just the minimum for SMA/ether */
-	} else
+	if (ipath_kpiobufs == 0) {
+		/* not set by user, or set explictly to default  */
+		if ((dd->ipath_piobcnt2k + dd->ipath_piobcnt4k) > 128)
+			kpiobufs = 32;
+		else
+			kpiobufs = 16;
+	}
+	else
 		kpiobufs = ipath_kpiobufs;
 
 	if (kpiobufs >

  parent reply	other threads:[~2006-04-24 21:23 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-24 21:22 [PATCH 0 of 13] ipath - various fixes and cleanups Bryan O'Sullivan
2006-04-24 21:22 ` [PATCH 1 of 13] ipath - fix race with exposing reset file Bryan O'Sullivan
2006-04-24 21:22 ` [PATCH 2 of 13] ipath - set up 32-bit DMA mask if 64-bit setup fails Bryan O'Sullivan
2006-05-01 18:47   ` Roland Dreier
2006-05-01 19:56     ` Segher Boessenkool
2006-05-01 21:41       ` Roland Dreier
2006-05-01 23:13         ` Segher Boessenkool
2006-05-01 23:27           ` [openib-general] " Roland Dreier
2006-05-02  0:13             ` Segher Boessenkool
2006-05-02  0:18               ` Roland Dreier
2006-04-24 21:22 ` [PATCH 3 of 13] ipath - iterate over correct number of ports during reset Bryan O'Sullivan
2006-04-24 21:23 ` Bryan O'Sullivan [this message]
2006-04-25  9:32   ` [PATCH 4 of 13] ipath - change handling of PIO buffers Segher Boessenkool
2006-04-24 21:23 ` [PATCH 5 of 13] ipath - use proper address translation routine Bryan O'Sullivan
2006-05-01 18:50   ` Roland Dreier
2006-05-01 18:54     ` Arjan van de Ven
2006-05-01 19:00       ` Roland Dreier
2006-05-01 19:20         ` Arjan van de Ven
2006-05-01 19:28           ` Roland Dreier
2006-05-02 13:35         ` Christoph Hellwig
2006-05-02 14:24           ` Roland Dreier
2006-05-02 14:27             ` Christoph Hellwig
2006-05-02 14:55             ` Alan Cox
2006-05-02 14:58               ` Roland Dreier
2006-05-01 19:03     ` Bryan O'Sullivan
2006-04-24 21:23 ` [PATCH 6 of 13] ipath - fix verbs registration Bryan O'Sullivan
2006-04-24 21:23 ` [PATCH 7 of 13] ipath - prevent hardware from being accessed during reset Bryan O'Sullivan
2006-04-24 21:23 ` [PATCH 8 of 13] ipath - fix a number of RC protocol bugs Bryan O'Sullivan
2006-04-25  7:56   ` Andrew Morton
2006-05-01 17:22     ` Roland Dreier
2006-05-01 17:34       ` Bryan O'Sullivan
2006-04-24 21:23 ` [PATCH 9 of 13] ipath - simplify RC send posting Bryan O'Sullivan
2006-04-24 21:23 ` [PATCH 10 of 13] ipath - simplify IB timer usage Bryan O'Sullivan
2006-04-24 21:23 ` [PATCH 11 of 13] ipath - improve sparse annotation Bryan O'Sullivan
2006-04-24 21:23 ` [PATCH 12 of 13] ipath - fix label name in interrupt handler Bryan O'Sullivan
2006-04-24 21:23 ` [PATCH 13 of 13] ipath - tidy up white space in a few files Bryan O'Sullivan
2006-05-01 19:17   ` Roland Dreier

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=8e724d49e74bc1155f4e.1145913780@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

Powered by JetHome