From: David Ahern <dsahern@kernel.org>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: idosch@mellanox.com, David Ahern <dsahern@gmail.com>
Subject: [PATCH v2 net-next 2/7] ipv4: Pass fib_nh_common to rt_cache_route
Date: Sat, 27 Apr 2019 19:27:29 -0700 [thread overview]
Message-ID: <20190428022734.21965-3-dsahern@kernel.org> (raw)
In-Reply-To: <20190428022734.21965-1-dsahern@kernel.org>
From: David Ahern <dsahern@gmail.com>
Now that the cached routes are in fib_nh_common, pass it to
rt_cache_route and simplify its callers. For rt_set_nexthop,
the tclassid becomes the last user of fib_nh so move the
container of under the #ifdef CONFIG_IP_ROUTE_CLASSID.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
net/ipv4/route.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 15776e98dfa3..712d22c0d37a 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1470,9 +1470,8 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
return ret;
}
-static bool rt_cache_route(struct fib_nh *nh, struct rtable *rt)
+static bool rt_cache_route(struct fib_nh_common *nhc, struct rtable *rt)
{
- struct fib_nh_common *nhc = &nh->nh_common;
struct rtable *orig, *prev, **p;
bool ret = true;
@@ -1576,7 +1575,6 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
if (fi) {
struct fib_nh_common *nhc = FIB_RES_NHC(*res);
- struct fib_nh *nh;
if (nhc->nhc_gw_family && nhc->nhc_scope == RT_SCOPE_LINK) {
rt->rt_gw_family = nhc->nhc_gw_family;
@@ -1589,15 +1587,19 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
ip_dst_init_metrics(&rt->dst, fi->fib_metrics);
- nh = container_of(nhc, struct fib_nh, nh_common);
#ifdef CONFIG_IP_ROUTE_CLASSID
- rt->dst.tclassid = nh->nh_tclassid;
+ {
+ struct fib_nh *nh;
+
+ nh = container_of(nhc, struct fib_nh, nh_common);
+ rt->dst.tclassid = nh->nh_tclassid;
+ }
#endif
- rt->dst.lwtstate = lwtstate_get(nh->fib_nh_lws);
+ rt->dst.lwtstate = lwtstate_get(nhc->nhc_lwtstate);
if (unlikely(fnhe))
cached = rt_bind_exception(rt, fnhe, daddr, do_cache);
else if (do_cache)
- cached = rt_cache_route(nh, rt);
+ cached = rt_cache_route(nhc, rt);
if (unlikely(!cached)) {
/* Routes we intend to cache in nexthop exception or
* FIB nexthop have the DST_NOCACHE bit clear.
@@ -2139,7 +2141,6 @@ out: return err;
if (do_cache) {
struct fib_nh_common *nhc = FIB_RES_NHC(*res);
- struct fib_nh *nh;
rth->dst.lwtstate = lwtstate_get(nhc->nhc_lwtstate);
if (lwtunnel_input_redirect(rth->dst.lwtstate)) {
@@ -2148,8 +2149,7 @@ out: return err;
rth->dst.input = lwtunnel_input;
}
- nh = container_of(nhc, struct fib_nh, nh_common);
- if (unlikely(!rt_cache_route(nh, rth)))
+ if (unlikely(!rt_cache_route(nhc, rth)))
rt_add_uncached_list(rth);
}
skb_dst_set(skb, &rth->dst);
--
2.11.0
next prev parent reply other threads:[~2019-04-28 2:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-28 2:27 [PATCH v2 net-next 0/7] ipv4 ipv6: Move location of pcpu route cache and exceptions David Ahern
2019-04-28 2:27 ` [PATCH v2 net-next 1/7] ipv4: Move cached routes to fib_nh_common David Ahern
2019-04-28 2:27 ` David Ahern [this message]
2019-04-28 2:27 ` [PATCH v2 net-next 3/7] ipv4: Move exception bucket to nh_common David Ahern
2019-04-28 2:27 ` [PATCH v2 net-next 4/7] ipv6: Move pcpu cached routes to fib6_nh David Ahern
2019-04-28 2:27 ` [PATCH v2 net-next 5/7] ipv6: Refactor fib6_drop_pcpu_from David Ahern
2019-04-28 2:27 ` [PATCH v2 net-next 6/7] ipv6: Refactor exception functions David Ahern
2019-04-28 2:27 ` [PATCH v2 net-next 7/7] ipv6: Move exception bucket to fib6_nh David Ahern
2019-04-28 15:06 ` [PATCH v2 net-next 0/7] ipv4 ipv6: Move location of pcpu route cache and exceptions Eric Dumazet
2019-04-28 17:53 ` Alexei Starovoitov
2019-04-28 20:54 ` David Ahern
2019-04-28 20:41 ` David Ahern
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=20190428022734.21965-3-dsahern@kernel.org \
--to=dsahern@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=idosch@mellanox.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).