netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Vosburgh <fubar@us.ibm.com>
To: Jiri Pirko <jpirko@redhat.com>
Cc: Flavio Leitner <fbl@redhat.com>,
	netdev@vger.kernel.org, davem@davemloft.net, andy@greyhouse.net
Subject: Re: [patch net-next-2.6] bonding: allow resetting slave failure counters
Date: Wed, 01 Jun 2011 09:13:39 -0700	[thread overview]
Message-ID: <16056.1306944819@death> (raw)
In-Reply-To: <20110601135321.GA2909@psychotron.brq.redhat.com>

Jiri Pirko <jpirko@redhat.com> wrote:

>Wed, Jun 01, 2011 at 03:28:37PM CEST, fbl@redhat.com wrote:
>>On 06/01/2011 06:40 AM, Jiri Pirko wrote:
>>> This patch allows to reset failure counters for all enslaved devices.
>>> 
>>> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>>> ---
>>>  Documentation/networking/bonding.txt |    7 +++++++
>>>  drivers/net/bonding/bond_sysfs.c     |   27 +++++++++++++++++++++++++++
>>>  2 files changed, 34 insertions(+), 0 deletions(-)
>>> 
>>> diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
>>> index 675612f..2f51d73 100644
>>> --- a/Documentation/networking/bonding.txt
>>> +++ b/Documentation/networking/bonding.txt
>>> @@ -782,6 +782,13 @@ resend_igmp
>>>  
>>>  	This option was added for bonding version 3.7.0.
>>>  
>>> +reset_failure_counters
>>> +
>>> +	This write-only control file will zero failure counters for
>>> +	all slaves.  Note there is no appropriate module parameter for this
>>> +	since it would not make much sense.
>>> +	Write any value to perform reset.
>>
>>nit: many options mention when they were added.
>>i.e. This option was added for bonding version 3.7.1
>
>hmm, is that necessary Jay, Andy?
>
>/me thinks this versioning should be removed at all in the first place...

	The "this dingus was added in version X.Y.Z" is there because
users sometimes read the most recent version of the documentation (that
they get from the internet) and then would become confused when their
older distro driver lacked some option described in the documentation.

	I don't know if this is "good" or "bad" in an absolute sense,
but I stopped getting questions of that sort after I put these notes
into the documentation.  I don't really see a down side, so for this
patch I'd like to see the version go up and one of these notes in the
documentation.

>>
>>fbl
>>
>>>  3. Configuring Bonding Devices
>>>  ==============================
>>>  
>>> diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
>>> index 88fcb25..9b45164 100644
>>> --- a/drivers/net/bonding/bond_sysfs.c
>>> +++ b/drivers/net/bonding/bond_sysfs.c
>>> @@ -1572,6 +1572,32 @@ out:
>>>  static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR,
>>>  		   bonding_show_resend_igmp, bonding_store_resend_igmp);
>>>  
>>> +static ssize_t
>>> +bonding_store_reset_failure_counters(struct device *d,
>>> +				     struct device_attribute *attr,
>>> +				     const char *buf, size_t count)
>>> +{
>>> +	struct slave *slave;
>>> +	int i;
>>> +	struct bonding *bond = to_bond(d);
>>> +
>>> +	if (!rtnl_trylock())
>>> +		return restart_syscall();
>>> +
>>> +	read_lock(&bond->lock);
>>> +	pr_info("%s: Resetting counters.\n", bond->dev->name);

	I'd stick "failure" in here somewhere so it's clear what's been
reset.  The printk can be done outside the lock as well.

	-J

>>> +	bond_for_each_slave(bond, slave, i)
>>> +		slave->link_failure_count = 0;
>>> +	read_unlock(&bond->lock);
>>> +
>>> +	rtnl_unlock();
>>> +
>>> +	return count;
>>> +}
>>> +
>>> +static DEVICE_ATTR(reset_failure_counters, S_IWUSR, NULL,
>>> +		   bonding_store_reset_failure_counters);
>>> +
>>>  static struct attribute *per_bond_attrs[] = {
>>>  	&dev_attr_slaves.attr,
>>>  	&dev_attr_mode.attr,
>>> @@ -1600,6 +1626,7 @@ static struct attribute *per_bond_attrs[] = {
>>>  	&dev_attr_queue_id.attr,
>>>  	&dev_attr_all_slaves_active.attr,
>>>  	&dev_attr_resend_igmp.attr,
>>> +	&dev_attr_reset_failure_counters.attr,
>>>  	NULL,
>>>  };
>>>  
>>

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

  reply	other threads:[~2011-06-01 17:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01  9:40 [patch net-next-2.6] bonding: allow resetting slave failure counters Jiri Pirko
2011-06-01 13:28 ` Flavio Leitner
2011-06-01 13:53   ` Jiri Pirko
2011-06-01 16:13     ` Jay Vosburgh [this message]
2011-06-01 16:31       ` [patch net-next-2.6 v2] " Jiri Pirko
2011-06-01 16:41         ` Flavio Leitner
2011-06-01 19:23         ` Nicolas de Pesloüan
2011-06-01 20:08           ` Jiri Pirko
2011-06-01 20:12             ` David Miller
2011-06-01 20:27               ` Jiri Pirko
2011-06-01 19:03       ` [patch net-next-2.6] " David Miller
2011-06-01 19:11         ` Flavio Leitner
2011-06-01 19:22           ` David Miller
2011-06-01 19:53             ` Jay Vosburgh
2011-06-01 20:22             ` Flavio Leitner
2011-06-01 19:34           ` Nicolas de Pesloüan
2011-06-01 20:07             ` Jiri Pirko
2011-06-01 13:51 ` WANG Cong

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=16056.1306944819@death \
    --to=fubar@us.ibm.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=fbl@redhat.com \
    --cc=jpirko@redhat.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).