From a8f947073f4ae489e8b9f3c19a17341cb260f660 Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Wed, 4 Jan 2023 20:05:27 -0800 Subject: devlink: restart dump based on devlink instance ids (nested) Use xarray id for cases of simple sub-object iteration. We'll now use the state->instance for the devlink instances and state->idx for subobject index. Moving the definition of idx into the inner loop makes sense, so while at it also move other sub-object local variables into the loop. Reviewed-by: Jiri Pirko Reviewed-by: Jacob Keller Signed-off-by: Jakub Kicinski --- net/devlink/devl_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net/devlink/devl_internal.h') diff --git a/net/devlink/devl_internal.h b/net/devlink/devl_internal.h index b9bb6f73a7c1..1e32bded7c8a 100644 --- a/net/devlink/devl_internal.h +++ b/net/devlink/devl_internal.h @@ -131,7 +131,7 @@ struct devlink_nl_dump_state { #define devlink_dump_for_each_instance_get(msg, state, devlink) \ for (; (devlink = devlinks_xa_find_get(sock_net(msg->sk), \ &state->instance, xa_find)); \ - state->instance++) + state->instance++, state->idx = 0) extern const struct genl_small_ops devlink_nl_ops[56]; -- cgit v1.2.3