public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat•com>
To: pravin shelar <pshelar@ovn•org>
Cc: Linux Kernel Network Developers <netdev@vger•kernel.org>,
	"David S. Miller" <davem@davemloft•net>,
	Stephen Hemminger <stephen@networkplumber•org>,
	Pravin Shelar <pshelar@nicira•com>,
	Jesse Gross <jesse@kernel•org>, Flavio Leitner <fbl@sysclose•org>,
	Hannes Frederic Sowa <hannes@stressinduktion•org>
Subject: Re: [PATCH net-next 5/5] veth: implement ndo_set_rx_headroom
Date: Wed, 24 Feb 2016 10:17:34 +0100	[thread overview]
Message-ID: <1456305454.5436.28.camel@redhat.com> (raw)
In-Reply-To: <CAOrHB_BzDhT_MTXPoEm-AaaVA++u_p_AdapMygMuw0gzgDUcyw@mail.gmail.com>

On Tue, 2016-02-23 at 11:21 -0800, pravin shelar wrote:
> On Tue, Feb 23, 2016 at 4:53 AM, Paolo Abeni <pabeni@redhat•com> wrote:
> > The rx headroom for veth dev is the peer device needed_headroom.
> > Avoid ping-pong updates setting the private flag IFF_PHONY_HEADROOM.
> >
> > This avoids skb head reallocation when forwarding from a veth dev
> > towards a device adding some kind of encapsulation.
> >
> > When forwarding frames below the MTU size towards a vxlan device,
> > this gives about 10% performance speed-up when OVS is used to connect
> > the veth and the vxlan device and a little more when using a
> > plain Linux bridge.
> >
> > Signed-off-by: Paolo Abeni <pabeni@redhat•com>
> > ---
> >  drivers/net/veth.c | 26 ++++++++++++++++++++++++++
> >  1 file changed, 26 insertions(+)
> >
> > diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> > index ba21d07..4f30a6a 100644
> > --- a/drivers/net/veth.c
> > +++ b/drivers/net/veth.c
> > @@ -35,6 +35,7 @@ struct pcpu_vstats {
> >  struct veth_priv {
> >         struct net_device __rcu *peer;
> >         atomic64_t              dropped;
> > +       unsigned                requested_headroom;
> >  };
> >
> >  /*
> > @@ -271,6 +272,29 @@ static int veth_get_iflink(const struct net_device *dev)
> >         return iflink;
> >  }
> >
> > +static void veth_set_rx_headroom(struct net_device *dev, int new_hr)
> > +{
> > +       struct veth_priv *peer_priv, *priv = netdev_priv(dev);
> > +       struct net_device *peer;
> > +
> > +       if (new_hr < 0)
> > +               new_hr = 0;
> > +
> > +       rcu_read_lock();
> > +       peer = rcu_dereference(priv->peer);
> > +       if (unlikely(!peer))
> > +               goto out;
> > +
> > +       peer_priv = netdev_priv(peer);
> > +       priv->requested_headroom = new_hr;
> > +       new_hr = max(priv->requested_headroom, peer_priv->requested_headroom);
> > +       dev->needed_headroom = new_hr;
> > +       peer->needed_headroom = new_hr;
> > +
> > +out:
> > +       rcu_read_unlock();
> > +}
> > +
> I am not sure why new priv->requested_headroom is introduced. I think
> you can just compare new_hr with dev->needed_headroom and set the max
> value to both devices.

The requested_headroom headroom was intended to cope with with this
scenario:

brctl addif br0 veth0
brctl delif br0 veth0
brctl addif br1 veth0

If I set needed_headroom to the max value to both veth peers, after the
last call veth will use max(br0 headroom, br1 headroom), instead of br1
headroom.

Paolo

      reply	other threads:[~2016-02-24  9:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-23 12:53 [PATCH net-next 0/5] bridge/ovs: avoid skb head copy on frame forwarding Paolo Abeni
2016-02-23 12:53 ` [PATCH net-next 1/5] netdev: introduce ndo_set_rx_headroom Paolo Abeni
2016-02-23 19:20   ` pravin shelar
2016-02-24  8:37     ` Paolo Abeni
2016-02-23 12:53 ` [PATCH net-next 2/5] bridge: notify ensabled devices of headroom changes Paolo Abeni
2016-02-23 19:20   ` pravin shelar
2016-02-24  8:43     ` Paolo Abeni
2016-02-23 12:53 ` [PATCH net-next 3/5] ovs: propagate per dp max headroom to all vports Paolo Abeni
2016-02-23 19:20   ` pravin shelar
2016-02-24  8:59     ` Paolo Abeni
2016-02-23 12:53 ` [PATCH net-next 4/5] net/tun: implement ndo_set_rx_headroom Paolo Abeni
2016-02-25 10:49   ` Paolo Abeni
2016-02-23 12:53 ` [PATCH net-next 5/5] veth: " Paolo Abeni
2016-02-23 19:21   ` pravin shelar
2016-02-24  9:17     ` Paolo Abeni [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=1456305454.5436.28.camel@redhat.com \
    --to=pabeni@redhat$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=fbl@sysclose$(echo .)org \
    --cc=hannes@stressinduktion$(echo .)org \
    --cc=jesse@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pshelar@nicira$(echo .)com \
    --cc=pshelar@ovn$(echo .)org \
    --cc=stephen@networkplumber$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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