mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-24 03:24:55 +08:00
tcp_metrics: fix tcp_metrics_nl_dump() return value
Change tcp_metrics_nl_dump() to return 0 at the end of a dump so that NLMSG_DONE can be appended to the current skb, saving one recvmsg() system call. Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20240416161112.1199265-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
1514b06aff
commit
ade1c9cc40
@ -766,6 +766,7 @@ static int tcp_metrics_nl_dump(struct sk_buff *skb,
|
||||
unsigned int max_rows = 1U << tcp_metrics_hash_log;
|
||||
unsigned int row, s_row = cb->args[0];
|
||||
int s_col = cb->args[1], col = s_col;
|
||||
int res = 0;
|
||||
|
||||
for (row = s_row; row < max_rows; row++, s_col = 0) {
|
||||
struct tcp_metrics_block *tm;
|
||||
@ -778,7 +779,8 @@ static int tcp_metrics_nl_dump(struct sk_buff *skb,
|
||||
continue;
|
||||
if (col < s_col)
|
||||
continue;
|
||||
if (tcp_metrics_dump_info(skb, cb, tm) < 0) {
|
||||
res = tcp_metrics_dump_info(skb, cb, tm);
|
||||
if (res < 0) {
|
||||
rcu_read_unlock();
|
||||
goto done;
|
||||
}
|
||||
@ -789,7 +791,7 @@ static int tcp_metrics_nl_dump(struct sk_buff *skb,
|
||||
done:
|
||||
cb->args[0] = row;
|
||||
cb->args[1] = col;
|
||||
return skb->len;
|
||||
return res;
|
||||
}
|
||||
|
||||
static int __parse_nl_addr(struct genl_info *info, struct inetpeer_addr *addr,
|
||||
|
Loading…
Reference in New Issue
Block a user