From: Roopa Prabhu <roopa@cumulusnetworks•com>
To: Jiri Pirko <jiri@resnulli•us>
Cc: netdev@vger•kernel.org, davem@davemloft•net, nogahf@mellanox•com,
idosch@mellanox•com, eladr@mellanox•com, yotamg@mellanox•com,
ogerlitz@mellanox•com, nikolay@cumulusnetworks•com,
linville@tuxdriver•com, tgraf@suug•ch, gospo@cumulusnetworks•com,
sfeldma@gmail•com, sd@queasysnail•net, eranbe@mellanox•com,
ast@plumgrid•com, edumazet@google•com,
hannes@stressinduktion•org, f.fainelli@gmail•com,
dsa@cumulusnetworks•com
Subject: Re: [patch net-next v6 2/3] net: core: add SW stats to if_stats_msg
Date: Tue, 09 Aug 2016 23:08:41 -0700 [thread overview]
Message-ID: <57AAC4E9.4010407@cumulusnetworks.com> (raw)
In-Reply-To: <1470777912-2227-3-git-send-email-jiri@resnulli.us>
On 8/9/16, 2:25 PM, Jiri Pirko wrote:
> From: Nogah Frankel <nogahf@mellanox•com>
>
> Add a nested attribute of SW stats to if_stats_msg
> under IFLA_STATS_LINK_SW_64.
>
> Signed-off-by: Nogah Frankel <nogahf@mellanox•com>
> Reviewed-by: Ido Schimmel <idosch@mellanox•com>
> Signed-off-by: Jiri Pirko <jiri@mellanox•com>
> ---
> include/uapi/linux/if_link.h | 1 +
> net/core/rtnetlink.c | 21 +++++++++++++++++++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
> index a1b5202..1c9b808 100644
> --- a/include/uapi/linux/if_link.h
> +++ b/include/uapi/linux/if_link.h
> @@ -825,6 +825,7 @@ enum {
> IFLA_STATS_LINK_64,
> IFLA_STATS_LINK_XSTATS,
> IFLA_STATS_LINK_XSTATS_SLAVE,
> + IFLA_STATS_LINK_SW_64,
sorry, don't mean to drag this discussion forever...but...
IIRC on the switchdev call, I thought we had agreed to just put these kind of breakdown
stats in one more layer of nesting.. which can be extended for everybody.
IFLA_STATS_LINK_DRIVER_XSTATS (or some other name) [
IFLA_STATS_LINK_SW_64 (struct rtnl_link_stats64) <---- you get the well defined struct here as you wanted.
IFLA_STATS_LINK_HW_ACL_DROPS /* u64 */ <----- we can keep extending this for other stats people want.
/* just keeps it extensible */
]
because in addition to all other reasons I have mentioned before, technically IFLA_STATS_LINK_64 (top-level aggregate stats)
are also software only stats for say most logical devices etc.
and instead of adding one ndo for your software only stats now and then again for other ethtool
like hw stats from all drivers, it could also be like the below:
new ndo_get_hw_stats
IFLA_STATS_LINK_HW_XSTATS (or some other name) [
IFLA_STATS_LINK_CPU_64 (struct rtnl_link_stats64) <---- you get the well defined struct here as you wanted.
IFLA_STATS_LINK_HW_ACL_DROPS /* u64 */ <----- we can keep extending this for other stats people want.
/* just keeps it extensible */
]
It gets you what you want and keeps the api extensible IMO. your call.
> __IFLA_STATS_MAX,
> };
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 189cc78..910f802 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -3583,6 +3583,21 @@ static int rtnl_fill_statsinfo(struct sk_buff *skb, struct net_device *dev,
> dev_get_stats(dev, sp);
> }
>
> + if (stats_attr_valid(filter_mask, IFLA_STATS_LINK_SW_64, *idxattr)) {
> + if (dev_have_sw_stats(dev)) {
> + struct rtnl_link_stats64 *sp;
> +
> + attr = nla_reserve_64bit(skb, IFLA_STATS_LINK_SW_64,
> + sizeof(struct rtnl_link_stats64),
> + IFLA_STATS_UNSPEC);
> + if (!attr)
> + goto nla_put_failure;
> +
> + sp = nla_data(attr);
> + dev_get_sw_stats(dev, sp);
> + }
> + }
> +
> if (stats_attr_valid(filter_mask, IFLA_STATS_LINK_XSTATS, *idxattr)) {
> const struct rtnl_link_ops *ops = dev->rtnl_link_ops;
>
> @@ -3644,6 +3659,7 @@ nla_put_failure:
>
> static const struct nla_policy ifla_stats_policy[IFLA_STATS_MAX + 1] = {
> [IFLA_STATS_LINK_64] = { .len = sizeof(struct rtnl_link_stats64) },
> + [IFLA_STATS_LINK_SW_64] = { .len = sizeof(struct rtnl_link_stats64) },
> };
>
> static size_t if_nlmsg_stats_size(const struct net_device *dev,
> @@ -3685,6 +3701,11 @@ static size_t if_nlmsg_stats_size(const struct net_device *dev,
> }
> }
>
> + if (stats_attr_valid(filter_mask, IFLA_STATS_LINK_SW_64, 0)) {
> + if (dev_have_sw_stats(dev))
> + size += nla_total_size_64bit(sizeof(struct rtnl_link_stats64));
> + }
> +
> return size;
> }
>
next prev parent reply other threads:[~2016-08-10 19:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-09 21:25 [patch net-next v6 0/3] return offloaded stats as default and expose original sw stats Jiri Pirko
2016-08-09 21:25 ` [patch net-next v6 1/3] netdevice: add SW statistics ndo Jiri Pirko
2016-08-09 21:25 ` [patch net-next v6 2/3] net: core: add SW stats to if_stats_msg Jiri Pirko
2016-08-10 6:08 ` Roopa Prabhu [this message]
2016-08-16 12:47 ` Nogah Frankel
2016-08-09 21:25 ` [patch net-next v6 3/3] mlxsw: spectrum: Implement SW stats ndo and expose HW stats by default Jiri Pirko
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=57AAC4E9.4010407@cumulusnetworks.com \
--to=roopa@cumulusnetworks$(echo .)com \
--cc=ast@plumgrid$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=dsa@cumulusnetworks$(echo .)com \
--cc=edumazet@google$(echo .)com \
--cc=eladr@mellanox$(echo .)com \
--cc=eranbe@mellanox$(echo .)com \
--cc=f.fainelli@gmail$(echo .)com \
--cc=gospo@cumulusnetworks$(echo .)com \
--cc=hannes@stressinduktion$(echo .)org \
--cc=idosch@mellanox$(echo .)com \
--cc=jiri@resnulli$(echo .)us \
--cc=linville@tuxdriver$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=nikolay@cumulusnetworks$(echo .)com \
--cc=nogahf@mellanox$(echo .)com \
--cc=ogerlitz@mellanox$(echo .)com \
--cc=sd@queasysnail$(echo .)net \
--cc=sfeldma@gmail$(echo .)com \
--cc=tgraf@suug$(echo .)ch \
--cc=yotamg@mellanox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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