diff mbox series

[net-next,2/2] nexthop: Do not increment dump sentinel at the end of the dump

Message ID 20230813164856.2379822-3-idosch@nvidia.com (mailing list archive)
State Accepted
Commit db1428f66a8c97793e6596e7c62047211dd6db79
Delegated to: Netdev Maintainers
Headers show
Series nexthop: Various cleanups | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1333 this patch: 1333
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 1353 this patch: 1353
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1356 this patch: 1356
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ido Schimmel Aug. 13, 2023, 4:48 p.m. UTC
The nexthop and nexthop bucket dump callbacks previously returned a
positive return code even when the dump was complete, prompting the core
netlink code to invoke the callback again, until returning zero.

Zero was only returned by these callbacks when no information was filled
in the provided skb, which was achieved by incrementing the dump
sentinel at the end of the dump beyond the ID of the last nexthop.

This is no longer necessary as when the dump is complete these callbacks
return zero.

Remove the unnecessary increment.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
---
 net/ipv4/nexthop.c | 1 -
 1 file changed, 1 deletion(-)

Comments

David Ahern Aug. 14, 2023, 1:22 a.m. UTC | #1
On 8/13/23 10:48 AM, Ido Schimmel wrote:
> The nexthop and nexthop bucket dump callbacks previously returned a
> positive return code even when the dump was complete, prompting the core
> netlink code to invoke the callback again, until returning zero.
> 
> Zero was only returned by these callbacks when no information was filled
> in the provided skb, which was achieved by incrementing the dump
> sentinel at the end of the dump beyond the ID of the last nexthop.
> 
> This is no longer necessary as when the dump is complete these callbacks
> return zero.
> 
> Remove the unnecessary increment.
> 
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Reviewed-by: Petr Machata <petrm@nvidia.com>
> ---
>  net/ipv4/nexthop.c | 1 -
>  1 file changed, 1 deletion(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
diff mbox series

Patch

diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index 7e8bb85e9dcb..bbff68b5b5d4 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -3209,7 +3209,6 @@  static int rtm_dump_walk_nexthops(struct sk_buff *skb,
 			return err;
 	}
 
-	ctx->idx++;
 	return 0;
 }