diff mbox series

[net-next,1/2] rtnetlink: change rtnl_stats_dump() return value

Message ID 20240502113748.1622637-2-edumazet@google.com (mailing list archive)
State Accepted
Commit 136c2a9a2a8760d8dae83ae7c882c50be02bdb63
Delegated to: Netdev Maintainers
Headers show
Series rtnetlink: rtnl_stats_dump() changes | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
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: 928 this patch: 928
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 938 this patch: 938
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: 939 this patch: 939
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 6 this patch: 6
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-03--15-00 (tests: 1001)

Commit Message

Eric Dumazet May 2, 2024, 11:37 a.m. UTC
By returning 0 (or an error) instead of skb->len,
we allow NLMSG_DONE to be appended to the current
skb at the end of a dump, saving a couple of recvmsg()
system calls.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/core/rtnetlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Ahern May 2, 2024, 3:59 p.m. UTC | #1
On 5/2/24 5:37 AM, Eric Dumazet wrote:
> By returning 0 (or an error) instead of skb->len,
> we allow NLMSG_DONE to be appended to the current
> skb at the end of a dump, saving a couple of recvmsg()
> system calls.

any concern that a patch similar to:
https://lore.kernel.org/netdev/20240411180202.399246-1-kuba@kernel.org/
will be needed again here?

> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>  net/core/rtnetlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 283e42f48af68504af193ed5763d4e0fcd667d99..88980c8bcf334079e2d19cbcfb3f10fc05e3c19b 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -6024,7 +6024,7 @@ static int rtnl_stats_dump(struct sk_buff *skb, struct netlink_callback *cb)
>  	cb->args[1] = idx;
>  	cb->args[0] = h;
>  
> -	return skb->len;
> +	return err;
>  }
>  
>  void rtnl_offload_xstats_notify(struct net_device *dev)


Reviewed-by: David Ahern <dsahern@kernel.org>
Eric Dumazet May 2, 2024, 4:03 p.m. UTC | #2
On Thu, May 2, 2024 at 5:59 PM David Ahern <dsahern@kernel.org> wrote:
>
> On 5/2/24 5:37 AM, Eric Dumazet wrote:
> > By returning 0 (or an error) instead of skb->len,
> > we allow NLMSG_DONE to be appended to the current
> > skb at the end of a dump, saving a couple of recvmsg()
> > system calls.
>
> any concern that a patch similar to:
> https://lore.kernel.org/netdev/20240411180202.399246-1-kuba@kernel.org/
> will be needed again here?

This has been discussed, Jakub answer was :

https://lore.kernel.org/netdev/20240411115748.05faa636@kernel.org/

So the plan is to change functions until a regression is reported.
David Ahern May 6, 2024, 4:23 p.m. UTC | #3
On 5/2/24 10:03 AM, Eric Dumazet wrote:
> On Thu, May 2, 2024 at 5:59 PM David Ahern <dsahern@kernel.org> wrote:
>>
>> On 5/2/24 5:37 AM, Eric Dumazet wrote:
>>> By returning 0 (or an error) instead of skb->len,
>>> we allow NLMSG_DONE to be appended to the current
>>> skb at the end of a dump, saving a couple of recvmsg()
>>> system calls.
>>
>> any concern that a patch similar to:
>> https://lore.kernel.org/netdev/20240411180202.399246-1-kuba@kernel.org/
>> will be needed again here?
> 
> This has been discussed, Jakub answer was :
> 
> https://lore.kernel.org/netdev/20240411115748.05faa636@kernel.org/
> 
> So the plan is to change functions until a regression is reported.
> 

As I commented in the past, it is more user friendly to add such
comments to a commit message so that when a regression occurs and a
bisect is done, the user hitting the regression sees the problem with an
obvious resolution.
Eric Dumazet May 6, 2024, 4:28 p.m. UTC | #4
On Mon, May 6, 2024 at 6:23 PM David Ahern <dsahern@kernel.org> wrote:
>
> On 5/2/24 10:03 AM, Eric Dumazet wrote:
> > On Thu, May 2, 2024 at 5:59 PM David Ahern <dsahern@kernel.org> wrote:
> >>
> >> On 5/2/24 5:37 AM, Eric Dumazet wrote:
> >>> By returning 0 (or an error) instead of skb->len,
> >>> we allow NLMSG_DONE to be appended to the current
> >>> skb at the end of a dump, saving a couple of recvmsg()
> >>> system calls.
> >>
> >> any concern that a patch similar to:
> >> https://lore.kernel.org/netdev/20240411180202.399246-1-kuba@kernel.org/
> >> will be needed again here?
> >
> > This has been discussed, Jakub answer was :
> >
> > https://lore.kernel.org/netdev/20240411115748.05faa636@kernel.org/
> >
> > So the plan is to change functions until a regression is reported.
> >
>
> As I commented in the past, it is more user friendly to add such
> comments to a commit message so that when a regression occurs and a
> bisect is done, the user hitting the regression sees the problem with an
> obvious resolution.

This commit has a single line being changed.

Whoever does a bisection will report, and the resolution is trivial.

I do not think we want to copy/paste a full page of all links to all
relevant commits.
diff mbox series

Patch

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 283e42f48af68504af193ed5763d4e0fcd667d99..88980c8bcf334079e2d19cbcfb3f10fc05e3c19b 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -6024,7 +6024,7 @@  static int rtnl_stats_dump(struct sk_buff *skb, struct netlink_callback *cb)
 	cb->args[1] = idx;
 	cb->args[0] = h;
 
-	return skb->len;
+	return err;
 }
 
 void rtnl_offload_xstats_notify(struct net_device *dev)