From: Randy Dunlap <randy.dunlap@oracle.com>
To: "Jari Takkala" <Jari.Takkala@Q9.com>
Cc: <netdev@vger.kernel.org>
Subject: Re: [PATCH 2.6.23.12] net/bonding: option to specify initial bond interface number
Date: Wed, 2 Jan 2008 13:55:54 -0800 [thread overview]
Message-ID: <20080102135554.65f86364.randy.dunlap@oracle.com> (raw)
In-Reply-To: <413FEEF1743111439393FB76D0221E4809790942@leopard.zoo.q9networks.com>
On Wed, 2 Jan 2008 16:20:48 -0500 Jari Takkala wrote:
> Allow the user to specify an initial interface number when loading the bonding driver. This is useful when loading multiple instances of the bonding driver and you want to control the interface number assignment. For example, if the user wishes to create a bond5 interface they can type 'modprobe -o bond5 bonding ifnum=5'. It also works with the max_bonds option.
>
> Signed-off-by: Jari Takkala <jari.takkala@q9.com>
> ---
> diff -ruN linux-2.6.23.12.orig/drivers/net/bonding/bond_main.c linux-2.6.23.12/drivers/net/bonding/bond_main.c
> --- linux-2.6.23.12.orig/drivers/net/bonding/bond_main.c 2007-12-18 16:55:57.000000000 -0500
> +++ linux-2.6.23.12/drivers/net/bonding/bond_main.c 2008-01-02 14:49:37.000000000 -0500
> @@ -85,6 +85,7 @@
> #define BOND_LINK_MON_INTERV 0
> #define BOND_LINK_ARP_INTERV 0
>
> +static int ifnum = BOND_DEFAULT_IFNUM;
> static int max_bonds = BOND_DEFAULT_MAX_BONDS;
> static int miimon = BOND_LINK_MON_INTERV;
> static int updelay = 0;
> @@ -99,6 +100,8 @@
> static char *arp_validate = NULL;
> struct bond_params bonding_defaults;
>
> +module_param(ifnum, int, 0);
You could (should) make <ifnum> be unsigned int and then use
module_param(ifnum, uint, 0);
and then ...
> +MODULE_PARM_DESC(ifnum, "Initial interface number to assign");
> module_param(max_bonds, int, 0);
> MODULE_PARM_DESC(max_bonds, "Max number of bonded devices");
> module_param(miimon, int, 0);
> @@ -4388,6 +4391,14 @@
> }
> }
then this block is mostly useless since ifnum cannot be < 0.
And how could it ever be > INT_MAX (when ifnum was an int)?
If <ifnum> is unsigned int but you want to limit it to INT_MAX,
then half of this if-test would be OK.
> + if (ifnum < 0 || ifnum > INT_MAX) {
> + printk(KERN_WARNING DRV_NAME
> + ": Warning: ifnum (%d) not in range %d-%d, so it "
> + "was reset to BOND_DEFAULT_IFNUM (%d)\n",
> + ifnum, 0, INT_MAX, BOND_DEFAULT_IFNUM);
> + ifnum = BOND_DEFAULT_IFNUM;
> + }
> +
> if (max_bonds < 1 || max_bonds > INT_MAX) {
> printk(KERN_WARNING DRV_NAME
> ": Warning: max_bonds (%d) not in range %d-%d, so it "
---
~Randy
desserts: http://www.xenotime.net/linux/recipes/
next prev parent reply other threads:[~2008-01-02 21:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-02 21:20 [PATCH 2.6.23.12] net/bonding: option to specify initial bond interface number Jari Takkala
2008-01-02 21:55 ` Randy Dunlap [this message]
2008-01-03 15:26 ` Jari Takkala
2008-01-02 22:24 ` Jay Vosburgh
2008-01-03 15:23 ` Jari Takkala
2008-01-03 17:03 ` Jay Vosburgh
2008-01-03 19:19 ` Jari Takkala
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=20080102135554.65f86364.randy.dunlap@oracle.com \
--to=randy.dunlap@oracle.com \
--cc=Jari.Takkala@Q9.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).