netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Benc <jbenc@redhat.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Thomas Graf <tgraf@suug.ch>, Pravin B Shelar <pshelar@nicira.com>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>,
	Tom Herbert <therbert@google.com>
Subject: Re: [PATCH net-next 4/7] net: use dst_cache for vxlan device
Date: Thu, 11 Feb 2016 12:11:12 +0100	[thread overview]
Message-ID: <20160211121112.3e347ea9@griffin> (raw)
In-Reply-To: <2661aab079345237e14b9b2bc261f8d53c4071cf.1455184959.git.pabeni@redhat.com>

On Thu, 11 Feb 2016 11:12:00 +0100, Paolo Abeni wrote:
> @@ -1857,6 +1867,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
>  	struct rtable *rt = NULL;
>  	const struct iphdr *old_iph;
>  	union vxlan_addr *dst;
> +	struct dst_entry *ndst;
>  	union vxlan_addr remote_ip;
>  	struct vxlan_metadata _md;
>  	struct vxlan_metadata *md = &_md;
[...]
> @@ -1982,7 +2015,6 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
>  				    src_port, dst_port, xnet, !udp_sum);
>  #if IS_ENABLED(CONFIG_IPV6)
>  	} else {
> -		struct dst_entry *ndst;
>  		struct in6_addr saddr;
>  		u32 rt6i_flags;

Please keep the ndst variable local to the else branch, there's no need
to move it.

> @@ -1990,14 +2022,26 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
>  			goto drop;
>  		sk = vxlan->vn6_sock->sock->sk;
>  
> -		ndst = vxlan6_get_route(vxlan, skb,
> -					rdst ? rdst->remote_ifindex : 0,
> -					&dst->sin6.sin6_addr, &saddr);
> -		if (IS_ERR(ndst)) {
> -			netdev_dbg(dev, "no route to %pI6\n",
> -				   &dst->sin6.sin6_addr);
> -			dev->stats.tx_carrier_errors++;
> -			goto tx_error;
> +		use_cache = rdst && !skb->mark;

All of this use_cache stuff belongs to vxlan{6}_get_route. It should
either return the cached route, or look it up and cache it. This will
also make the code less error prone - if we base the route lookup on
more parameters in the future, the decision to skip the cache (because
the route depends on data from the inner packet) will be at the same
place as the added parameters, making it obvious that the cache skip
condition needs to be updated, too.

Overall, I'm not sure how much gain this dst caching will be in real
life, though. It surely looks nice in benchmarks. But as soon as you
step out of the most trivial case and start using TOS and skb marks,
the cache will be ineffective. But then, maybe the most trivial cases
are 90% of the deployment. No idea.

 Jiri

-- 
Jiri Benc

  reply	other threads:[~2016-02-11 11:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 10:11 [PATCH net-next 0/7] net: unify dst caching for tunnel devices Paolo Abeni
2016-02-11 10:11 ` [PATCH net-next 1/7] net: add dst_cache support Paolo Abeni
2016-02-11 10:11 ` [PATCH net-next 2/7] net: replace dst_cache ip6_tunnel implementation with the generic one Paolo Abeni
2016-02-11 10:11 ` [PATCH net-next 3/7] ip_tunnel: replace dst_cache with generic implementation Paolo Abeni
2016-02-11 10:12 ` [PATCH net-next 4/7] net: use dst_cache for vxlan device Paolo Abeni
2016-02-11 11:11   ` Jiri Benc [this message]
2016-02-11 10:12 ` [PATCH net-next 5/7] net: add dst_cache to ovs vxlan lwtunnel Paolo Abeni
2016-02-11 11:48   ` Jiri Benc
2016-02-11 10:12 ` [PATCH net-next 6/7] geneve: add dst caching support Paolo Abeni
2016-02-11 10:12 ` [PATCH net-next 7/7] net/ipv4: add dst cache support for gre lwtunnels Paolo Abeni
2016-02-11 12:59   ` Sergei Shtylyov

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=20160211121112.3e347ea9@griffin \
    --to=jbenc@redhat.com \
    --cc=davem@davemloft.net \
    --cc=hannes@stressinduktion.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pshelar@nicira.com \
    --cc=tgraf@suug.ch \
    --cc=therbert@google.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 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).