From: Martin KaFai Lau <kafai@fb.com>
To: <netdev@vger.kernel.org>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>, <kernel-team@fb.com>
Subject: [RFC PATCH net-next 03/10] ipv6: Combine rt6_alloc_cow and rt6_alloc_clone
Date: Fri, 10 Apr 2015 18:59:29 -0700 [thread overview]
Message-ID: <1428717576-1040383-4-git-send-email-kafai@fb.com> (raw)
In-Reply-To: <1428717576-1040383-1-git-send-email-kafai@fb.com>
A prep work for creating RTF_CACHE on exception only. After this
patch, the same condition (rt->rt6i_flags & (RTF_NONEXTHOP | RTF_GATEWAY))
is checked twice. This redundancy will be removed in the later patch.
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
net/ipv6/route.c | 40 +++++++++++++++-------------------------
1 file changed, 15 insertions(+), 25 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0ccb8ec..f753a67 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -872,9 +872,9 @@ int ip6_ins_rt(struct rt6_info *rt)
return __ip6_ins_rt(rt, &info, &mxc);
}
-static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort,
- const struct in6_addr *daddr,
- const struct in6_addr *saddr)
+static struct rt6_info *ip6_pmtu_rt_cache_alloc(struct rt6_info *ort,
+ const struct in6_addr *daddr,
+ const struct in6_addr *saddr)
{
struct rt6_info *rt;
@@ -885,33 +885,24 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort,
rt = ip6_rt_copy(ort, daddr);
if (rt) {
- if (ort->rt6i_dst.plen != 128 &&
- ipv6_addr_equal(&ort->rt6i_dst.addr, daddr))
- rt->rt6i_flags |= RTF_ANYCAST;
-
rt->rt6i_flags |= RTF_CACHE;
+ if (!(ort->rt6i_flags & (RTF_NONEXTHOP | RTF_GATEWAY))) {
+ if (ort->rt6i_dst.plen != 128 &&
+ ipv6_addr_equal(&ort->rt6i_dst.addr, daddr))
+ rt->rt6i_flags |= RTF_ANYCAST;
#ifdef CONFIG_IPV6_SUBTREES
- if (rt->rt6i_src.plen && saddr) {
- rt->rt6i_src.addr = *saddr;
- rt->rt6i_src.plen = 128;
- }
+ if (rt->rt6i_src.plen && saddr) {
+ rt->rt6i_src.addr = *saddr;
+ rt->rt6i_src.plen = 128;
+ }
#endif
+ }
}
return rt;
}
-static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort,
- const struct in6_addr *daddr)
-{
- struct rt6_info *rt = ip6_rt_copy(ort, daddr);
-
- if (rt)
- rt->rt6i_flags |= RTF_CACHE;
- return rt;
-}
-
static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, int oif,
struct flowi6 *fl6, int flags)
{
@@ -957,10 +948,9 @@ redo_rt6_select:
if (rt->rt6i_flags & RTF_CACHE)
goto out2;
- if (!(rt->rt6i_flags & (RTF_NONEXTHOP | RTF_GATEWAY)))
- nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr);
- else if (!(rt->dst.flags & DST_HOST))
- nrt = rt6_alloc_clone(rt, &fl6->daddr);
+ if (!(rt->rt6i_flags & (RTF_NONEXTHOP | RTF_GATEWAY)) ||
+ !(rt->dst.flags & DST_HOST))
+ nrt = ip6_pmtu_rt_cache_alloc(rt, &fl6->daddr, &fl6->saddr);
else
goto out2;
--
1.8.1
next prev parent reply other threads:[~2015-04-11 1:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-11 1:59 [RFC PATCH net-next 00/10] ipv6: Only create RTF_CACHE route after encountering pmtu exception Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 01/10] ipv6: Remove external dependency on rt6i_dst and rt6i_src Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 02/10] ipv6: Remove external dependency on rt6i_gateway and RTF_ANYCAST Martin KaFai Lau
2015-04-11 1:59 ` Martin KaFai Lau [this message]
2015-04-11 1:59 ` [RFC PATCH net-next 04/10] ipv6: Only create RTF_CACHE routes after encountering pmtu exception Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 05/10] ipv6: Allow pmtu update on /128 via gateway route Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 06/10] ipv6: Avoid deleting RTF_CACHE route from ip6_route_del() Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 07/10] ipv6: Extend the route lookups to low priority metrics Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 08/10] ipv6: Do not use inetpeer when creating RTF_CACHE route for /128 via gateway entry Martin KaFai Lau
2015-04-13 11:06 ` Steffen Klassert
2015-04-13 17:51 ` Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 09/10] ipv6: Break up ip6_rt_copy() Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 10/10] ipv6: Create percpu rt6_info Martin KaFai Lau
2015-04-13 10:59 ` Steffen Klassert
2015-04-13 20:16 ` Martin KaFai Lau
2015-04-13 21:46 ` Hannes Frederic Sowa
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=1428717576-1040383-4-git-send-email-kafai@fb.com \
--to=kafai@fb.com \
--cc=hannes@stressinduktion.org \
--cc=kernel-team@fb.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).