On 1/28/21 5:49 AM, Petr Machata wrote: > The dump operations need to keep state from one invocation to another. A > scratch area is dedicated for this purpose in the passed-in argument, cb, > namely via two aliased arrays, struct netlink_callback.args and .ctx. > > Dumping of buckets will end up having to iterate over next hops as well, > and it would be nice to be able to reuse the iteration logic with the NH > dumper. The fact that the logic currently relies on fixed index to the > .args array, and the indices would have to be coordinated between the two > dumpers, makes this somewhat awkward. > > To make the access patters clearer, introduce a helper struct with a NH > index, and instead of using the .args array directly, use it through this > structure. > > Signed-off-by: Petr Machata <pe...@nvidia.com> > Reviewed-by: Ido Schimmel <ido...@nvidia.com> > --- > net/ipv4/nexthop.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) >
Reviewed-by: David Ahern <dsah...@kernel.org>