devlink: bump the instance index directly when iterating
authorJakub Kicinski <kuba@kernel.org>
Fri, 6 Jan 2023 06:33:54 +0000 (22:33 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 Jan 2023 12:56:18 +0000 (12:56 +0000)
commitd772781964415c63759572b917e21c4f7ec08d9f
tree966ea332b2ac0d739f69b466d1e3f6e77ec8788b
parent6b754d7bd007c5f68fbb2d9abd5c00d253b033d0
devlink: bump the instance index directly when iterating

xa_find_after() is designed to handle multi-index entries correctly.
If a xarray has two entries one which spans indexes 0-3 and one at
index 4 xa_find_after(0) will return the entry at index 4.

Having to juggle the two callbacks, however, is unnecessary in case
of the devlink xarray, as there is 1:1 relationship with indexes.

Always use xa_find() and increment the index manually.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/devlink/core.c
net/devlink/devl_internal.h