summaryrefslogtreecommitdiff
path: root/net/devlink/devl_internal.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-01-04 20:05:27 -0800
committerJakub Kicinski <kuba@kernel.org>2023-01-05 22:13:39 -0800
commita8f947073f4ae489e8b9f3c19a17341cb260f660 (patch)
treef8e5eee88e263b7faac89f97267f44c500e69bd9 /net/devlink/devl_internal.h
parent731d69a6bd13b7c0cdbd3607edfa681269d54828 (diff)
downloadlinux-a8f947073f4ae489e8b9f3c19a17341cb260f660.tar.gz
linux-a8f947073f4ae489e8b9f3c19a17341cb260f660.tar.bz2
linux-a8f947073f4ae489e8b9f3c19a17341cb260f660.zip
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 <jiri@nvidia.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/devlink/devl_internal.h')
-rw-r--r--net/devlink/devl_internal.h2
1 files changed, 1 insertions, 1 deletions
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];