All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Gospodarek <gospo@cumulusnetworks.com>
To: Nikolay Aleksandrov <nikolay@redhat.com>
Cc: netdev@vger.kernel.org, j.vosburgh@gmail.com, vfalico@gmail.com
Subject: Re: [PATCH net-next] bonding: make global bonding stats more reliable
Date: Fri, 26 Sep 2014 09:52:08 -0400	[thread overview]
Message-ID: <20140926135208.GB18564@gospo.home.greyhouse.net> (raw)
In-Reply-To: <54256BA5.9080803@redhat.com>

On Fri, Sep 26, 2014 at 03:35:33PM +0200, Nikolay Aleksandrov wrote:
> On 26/09/14 15:26, Andy Gospodarek wrote:
> >On Fri, Sep 26, 2014 at 10:52:16AM +0200, Nikolay Aleksandrov wrote:
> >>On 25/09/14 15:16, Andy Gospodarek wrote:
> >>>As the code stands today, bonding stats are based simply on the stats
> >>>from the member interfaces.  If a member was to be removed from a bond,
> >>>the stats would instantly drop.  This would be confusing to an admin
> >>>would would suddonly see interface stats drop while traffic is still
> >>>flowing.
> >>>
> >>>In addition to preventing the stats drops mentioned above, new members
> >>>will now be added to the bond and only traffic received after the member
> >>>was added to the bond will be counted as part of bonding stats.
> >>>
> >>>Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
> >>>---
> >>Hi Andy,
> >>
> <<<<snip>>>>
> >>>@@ -4258,6 +4274,9 @@ static int bond_init(struct net_device *bond_dev)
> >>>  	    bond_dev->addr_assign_type == NET_ADDR_PERM)
> >>>  		eth_hw_addr_random(bond_dev);
> >>>
> >>>+	/* initialize persistent stats for the bond */
> >>>+	bond->bond_stats = kzalloc(sizeof(struct rtnl_link_stats64),
> >>>+				   GFP_ATOMIC);
> >>^^^^^^^^^^^^^^^^^^^^^^^^
> >>I don't think this will get freed if the bond device is destroyed.
> >Another good catch.  Thanks for the review.  V2 incoming after some
> >testing.
> >
> Great, one more thing I forgot to ask, why the GFP_ATOMIC here ? I believe
> we're allowed to sleep in ndo_init(), and you should probably handle the
ndo_init() can (and likely will) sleep, but since all not skb data
allocated in bonding appears to be GFP_KERNEL, I'll switch to that for
consistency.

> case where the bond_stats allocation fails, too.
Yep, on it! :)

> 
> >>
> >>>  	return 0;
> >>>  }
> >>>
> >>>diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
> >>>index 6140bf0..fe25265 100644
> >>>--- a/drivers/net/bonding/bonding.h
> >>>+++ b/drivers/net/bonding/bonding.h
> >>>@@ -24,6 +24,7 @@
> >>>  #include <linux/inetdevice.h>
> >>>  #include <linux/etherdevice.h>
> >>>  #include <linux/reciprocal_div.h>
> >>>+#include <linux/if_link.h>
> >>>
> >>>  #include "bond_3ad.h"
> >>>  #include "bond_alb.h"
> >>>@@ -175,6 +176,7 @@ struct slave {
> >>>  	struct netpoll *np;
> >>>  #endif
> >>>  	struct kobject kobj;
> >>>+	struct rtnl_link_stats64 *slave_stats;
> >>>  };
> >>>
> >>>  /*
> >>>@@ -224,6 +226,7 @@ struct bonding {
> >>>  	/* debugging support via debugfs */
> >>>  	struct	 dentry *debug_dir;
> >>>  #endif /* CONFIG_DEBUG_FS */
> >>>+	struct rtnl_link_stats64 *bond_stats;
> >>>  };
> >>>
> >>>  #define bond_slave_get_rcu(dev) \
> >>>
> >>
> 

      reply	other threads:[~2014-09-26 13:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25 13:16 [PATCH net-next] bonding: make global bonding stats more reliable Andy Gospodarek
2014-09-26  8:52 ` Nikolay Aleksandrov
2014-09-26 13:26   ` Andy Gospodarek
2014-09-26 13:35     ` Nikolay Aleksandrov
2014-09-26 13:52       ` Andy Gospodarek [this message]

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=20140926135208.GB18564@gospo.home.greyhouse.net \
    --to=gospo@cumulusnetworks.com \
    --cc=j.vosburgh@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@redhat.com \
    --cc=vfalico@gmail.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.