From: Corey Minyard <cminyard@mvista.com>
To: linux.nics@intel.com
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Add boot command line parsing for the e100 driver
Date: Mon, 19 May 2003 11:09:31 -0500 [thread overview]
Message-ID: <3EC901BB.8040100@mvista.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
Annoyed by the fact that I could set configuration parameters for a
compiled-in e100 driver, I've added boot-line parameter parsing. The
patch is attached. It would be very helpful if this could be applied.
This is relative to 2.5.68, but should be pretty portable.
-Corey
[-- Attachment #2: e100-bootparm.diff --]
[-- Type: text/plain, Size: 3508 bytes --]
--- linux.orig/drivers/net/e100/e100_main.c Mon Apr 21 11:20:11 2003
+++ linux/drivers/net/e100/e100_main.c Mon May 19 10:57:33 2003
@@ -174,7 +174,7 @@
* over and over (plus this helps to avoid typo bugs).
*/
#define E100_PARAM(X, S) \
- static const int X[E100_MAX_NIC + 1] = E100_PARAM_INIT; \
+ static int X[E100_MAX_NIC + 1] = E100_PARAM_INIT; \
MODULE_PARM(X, "1-" __MODULE_STRING(E100_MAX_NIC) "i"); \
MODULE_PARM_DESC(X, S);
@@ -375,6 +375,77 @@
E100_PARAM(BundleSmallFr, "Disable or enable interrupt bundling of small frames");
E100_PARAM(BundleMax, "Maximum number for CPU saver's packet bundling");
E100_PARAM(IFS, "Disable or enable the adaptive IFS algorithm");
+
+#if !defined(MODULE)
+static int next_e100_setup = 0;
+
+#define E100_BOOT_PARAM(parm, strparm) \
+ if (strcmp(strparm, name) == 0) { \
+ int val; \
+ char *end; \
+ val = simple_strtoul(strval, &end, 0); \
+ if (*end != '\0') { \
+ printk("Invalid value for parm num %d, name" \
+ " %s, parm ignored\n", count, name); \
+ continue; \
+ } \
+ printk(" Setting %s to %d\n", strparm, val); \
+ parm[i] = val; \
+ continue; \
+ }
+
+static int __init
+e100_boot_setup(char *str)
+{
+ int i = next_e100_setup;
+ int count = -1;
+ char *p;
+ char *name;
+ char *strval;
+
+ if (i >= E100_MAX_NIC) {
+ printk("Attempted to configure too many e100 devices\n");
+ return -ENODEV;
+ }
+
+ printk("e100 boot setup for device %d\n", i);
+
+ next_e100_setup++;
+
+ for (p=strsep(&str, ":,"); p; p=strsep(&str, ":,")) {
+ count++;
+ name = p;
+ name = strsep(&p, "=");
+ if (!name) {
+ printk(" error: Empty parm %d, ignored\n", count);
+ continue;
+ }
+ strval = strsep(&p, "");
+ if (!strval) {
+ printk(" error: No value for parm %d, ignored\n",
+ count);
+ continue;
+ }
+
+ E100_BOOT_PARAM(TxDescriptors, "TxDescriptors");
+ E100_BOOT_PARAM(RxDescriptors, "RxDescriptors");
+ E100_BOOT_PARAM(XsumRX, "XsumRX");
+ E100_BOOT_PARAM(e100_speed_duplex, "e100_speed_duplex");
+ E100_BOOT_PARAM(ucode, "ucode");
+ E100_BOOT_PARAM(ber, "ber");
+ E100_BOOT_PARAM(flow_control, "flow_control");
+ E100_BOOT_PARAM(IntDelay, "IntDelay");
+ E100_BOOT_PARAM(BundleSmallFr, "BundleSmallFr");
+ E100_BOOT_PARAM(BundleMax, "BundleMax");
+ E100_BOOT_PARAM(IFS, "IFS");
+ printk(" Invalid parameter name %s, ignored\n", name);
+ }
+
+ return 0;
+}
+
+__setup("e100=", e100_boot_setup);
+#endif
/**
* e100_exec_cmd - issue a comand
--- linux.orig/Documentation/networking/e100.txt Wed Mar 26 08:00:53 2003
+++ linux/Documentation/networking/e100.txt Mon May 19 10:50:47 2003
@@ -110,6 +110,17 @@
resources for the second adapter. This configuration favors the second
adapter. The driver supports up to 16 network adapters concurrently.
+If the driver is compiled into the kernel, you may also specify these
+on the boot command line for linux using the 'e100' parameter,
+followed by the "option=val" separated by commas or colons. You may
+put the e100 parameter on the command line multiple times, each one
+configures the next device. For instance, you can say:
+
+ e100=ucode=0 e100=ucode=1,IntDelay=700
+
+to turn of the microcode download on the first device, and turn on the
+microcode download and set the delay to 700 on the second device.
+
The default value for each parameter is generally the recommended setting,
unless otherwise noted.
next reply other threads:[~2003-05-19 15:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-19 16:09 Corey Minyard [this message]
2003-05-19 16:17 ` [PATCH] Add boot command line parsing for the e100 driver Christoph Hellwig
2003-05-19 16:30 ` Jeff Garzik
2003-05-19 16:33 ` Christoph Hellwig
2003-05-19 16:40 ` Jeff Garzik
2003-05-19 17:04 ` Corey Minyard
2003-05-20 0:16 ` Bartlomiej Zolnierkiewicz
2003-05-20 0:44 ` Bartlomiej Zolnierkiewicz
2003-05-20 1:30 ` Corey Minyard
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=3EC901BB.8040100@mvista.com \
--to=cminyard@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux.nics@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.