Subject: Re: [PATCH net-next 2/5] bridge: notify ensabled devices of headroom changes

From: Paolo Abeni <[email-masked]>
Date: Wed, 24 Feb 2016 09:43:54 +0100

On Tue, 2016-02-23 at 11:20 -0800, pravin shelar wrote:
> On Tue, Feb 23, 2016 at 4:53 AM, Paolo Abeni <[email-masked]> wrote:
> > On bridge needed_headroom changes, the enslaved devices are
> > notified via the ndo_set_rx_headroom method
> >
> > Signed-off-by: Paolo Abeni <[email-masked]>
> > ---
> >  net/bridge/br_if.c | 36 ++++++++++++++++++++++++++++++++++--
> >  1 file changed, 34 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> > index c367b3e..f42f1da 100644
> > --- a/net/bridge/br_if.c
> > +++ b/net/bridge/br_if.c
> > @@ -223,6 +223,31 @@ static void destroy_nbp_rcu(struct rcu_head *head)
> >         destroy_nbp(p);
> >  }
> >
> > +static unsigned get_max_headroom(struct net_bridge *br)
> > +{
> > +       unsigned max_headroom = 0;
> > +       struct net_bridge_port *p;
> > +
> > +       list_for_each_entry(p, &br->port_list, list) {
> > +               unsigned dev_headroom = netdev_get_fwd_headroom(p->dev);
> > +
> 
> IFF_PHONY_HEADROOM is only set for veth and ovs-internal-device, so we
> can not get headroom for tunnel devices. I guess it worked in your
> tests due to the bug in netdev_get_fwd_headroom().

This code should be actually correct; the idea is to ignore the devices
with phony headroom when computing the maximum headroom; all other
devices should be taken in account.

The current, bugged, netdev_get_fwd_headroom() implementation is
actually the culprit for the confusion.

Paolo