From: Edwin Peer <edwin.peer@broadcom.com>
To: netdev@vger.kernel.org
Cc: Edwin Peer <edwin.peer@broadcom.com>,
Jakub Kicinski <kuba@kernel.org>,
Andrew Gospodarek <andrew.gospodarek@broadcom.com>,
Michael Chan <michael.chan@broadcom.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Michal Kubecek <mkubecek@suse.cz>,
David Ahern <dsahern@gmail.com>
Subject: [PATCH iproute2-next v2 2/2] iplink: filter stats using RTEXT_FILTER_SKIP_STATS
Date: Tue, 26 Jan 2021 09:40:54 -0800 [thread overview]
Message-ID: <20210126174054.185084-2-edwin.peer@broadcom.com> (raw)
In-Reply-To: <20210126174054.185084-1-edwin.peer@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]
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>
---
ip/ipaddress.c | 6 +++++-
ip/iplink.c | 3 +++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 0bbcee2b3bb2..75511881050d 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1882,9 +1882,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 27c9be442a7a..6a973213dc11 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -1116,6 +1116,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)
--
2.30.0
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4160 bytes --]
next prev parent reply other threads:[~2021-01-26 23:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 17:40 [PATCH iproute2-next v2 1/2] iplink: print warning for missing VF data Edwin Peer
2021-01-26 17:40 ` Edwin Peer [this message]
2021-01-28 3:51 ` David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210126174054.185084-2-edwin.peer@broadcom.com \
--to=edwin.peer@broadcom.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=dsahern@gmail.com \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).