Re: [PATCH 10/15] ipv4: Cache input routes in fib_info nexthops.
From: Joe Perches <joe@perches.com>
Date: 2012-07-18 19:27:56
On Wed, 2012-07-18 at 11:24 -0700, David Miller wrote:
Caching input routes is slightly simpler than output routes, since we don't need to be concerned with nexthop exceptions. (locally destined, and routed packets, never trigger PMTU events or redirects that will be processed by us).
[]
quoted hunk ↗ jump to hunk
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
[]
quoted hunk ↗ jump to hunk
@@ -1355,11 +1357,11 @@ static int __mkroute_input(struct sk_buff *skb,
[]
+ do_cache = false;
+ if (res->fi) {
+ if (!(flags & RTCF_DIRECTSRC) && !itag) {
+ rth = FIB_RES_NH(*res).nh_rth_input;
+ if (rth) {
+ dst_use(&rth->dst, jiffies);
+ goto out;
+ }
+ do_cache = true;
+ }
+ }[]
quoted hunk ↗ jump to hunk
@@ -1568,8 +1580,20 @@ brd_input:
[]
+ do_cache = false;
+ if (res.fi) {
+ if (!(flags & RTCF_DIRECTSRC) && !itag) {
+ rth = FIB_RES_NH(res).nh_rth_input;
+ if (rth) {
+ dst_use(&rth->dst, jiffies);
+ goto set_and_out;
+ }
+ do_cache = true;
+ }
+ }Maybe a helper like: if (some_do_cache_name(rth, res, itag, flags, &do_cache)) goto foo;