diff mbox series

[iproute2-next] iplink: filter stats using RTEXT_FILTER_SKIP_STATS

Message ID 20230611105738.122706-1-gal@nvidia.com (mailing list archive)
State Accepted
Commit bbb1238123a8cfe12766ad85f2c0a4aaa32d6610
Delegated to: David Ahern
Headers show
Series [iproute2-next] iplink: filter stats using RTEXT_FILTER_SKIP_STATS | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Gal Pressman June 11, 2023, 10:57 a.m. UTC
From: Edwin Peer <edwin.peer@broadcom.com>

Don't request statistics we do not intend to render. This avoids the
possibility of a truncated IFLA_VFINFO_LIST when statistics are not
requested as well as the fetching of unnecessary data.

Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Cc: Edwin Peer <espeer@gmail.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
Userspace side for kernel submission:
https://lore.kernel.org/all/20230611105108.122586-1-gal@nvidia.com/

It is only a partial "fix", but increases the number of VFs presented
before the truncation occurs.
---
 ip/ipaddress.c | 6 +++++-
 ip/iplink.c    | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Gal Pressman June 19, 2023, 12:40 p.m. UTC | #1
On 11/06/2023 13:57, Gal Pressman wrote:
> From: Edwin Peer <edwin.peer@broadcom.com>
> 
> Don't request statistics we do not intend to render. This avoids the
> possibility of a truncated IFLA_VFINFO_LIST when statistics are not
> requested as well as the fetching of unnecessary data.
> 
> Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
> Cc: Edwin Peer <espeer@gmail.com>
> Signed-off-by: Gal Pressman <gal@nvidia.com>
> ---
> Userspace side for kernel submission:
> https://lore.kernel.org/all/20230611105108.122586-1-gal@nvidia.com/
> 
> It is only a partial "fix", but increases the number of VFs presented
> before the truncation occurs.

Kernel side was applied.
patchwork-bot+netdevbpf@kernel.org June 21, 2023, 4:20 p.m. UTC | #2
Hello:

This patch was applied to iproute2/iproute2-next.git (main)
by David Ahern <dsahern@kernel.org>:

On Sun, 11 Jun 2023 13:57:38 +0300 you wrote:
> From: Edwin Peer <edwin.peer@broadcom.com>
> 
> Don't request statistics we do not intend to render. This avoids the
> possibility of a truncated IFLA_VFINFO_LIST when statistics are not
> requested as well as the fetching of unnecessary data.
> 
> Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
> Cc: Edwin Peer <espeer@gmail.com>
> Signed-off-by: Gal Pressman <gal@nvidia.com>
> 
> [...]

Here is the summary with links:
  - [iproute2-next] iplink: filter stats using RTEXT_FILTER_SKIP_STATS
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=bbb1238123a8

You are awesome, thank you!
diff mbox series

Patch

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 361e6875b671..8197709d172e 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -2031,9 +2031,13 @@  static int ipaddr_flush(void)
 
 static int iplink_filter_req(struct nlmsghdr *nlh, int reqlen)
 {
+	__u32 filt_mask;
 	int err;
 
-	err = addattr32(nlh, reqlen, IFLA_EXT_MASK, RTEXT_FILTER_VF);
+	filt_mask = RTEXT_FILTER_VF;
+	if (!show_stats)
+		filt_mask |= RTEXT_FILTER_SKIP_STATS;
+	err = addattr32(nlh, reqlen, IFLA_EXT_MASK, filt_mask);
 	if (err)
 		return err;
 
diff --git a/ip/iplink.c b/ip/iplink.c
index 690636b65190..6c5d13d53a84 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -1166,6 +1166,9 @@  int iplink_get(char *name, __u32 filt_mask)
 			  !check_ifname(name) ? IFLA_IFNAME : IFLA_ALT_IFNAME,
 			  name, strlen(name) + 1);
 	}
+
+	if (!show_stats)
+		filt_mask |= RTEXT_FILTER_SKIP_STATS;
 	addattr32(&req.n, sizeof(req), IFLA_EXT_MASK, filt_mask);
 
 	if (rtnl_talk(&rth, &req.n, &answer) < 0)