On 4/2/19 11:27 PM, Martin Lau wrote: > On Tue, Apr 02, 2019 at 02:11:53PM -0700, David Ahern wrote: >> From: David Ahern <dsah...@gmail.com> >> >> Second set of three with the end goal of enabling IPv6 gateways with IPv4 >> routes. > I am still not completely convinced on the new "*nhc" in patch 2 without > seeing a patch showing why nh_sel is not enough.
fib_table_lookup and fib_select_path have determined the address of the preferred fib_nh struct. To look it up again will get costly for nexthop groups: dereference the nexthop pointer, see that it is a group, get the pointer to the group data, find the Nth (nh_sel) entry and return it. Since we already have the end pointer, avoid repeated lookups which nh_sel requires and save the fib_nh to fib_result. That's what patch 2 is doing and the updated commit message shows that.