[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200221174820.GD3530@kwain>
Date: Fri, 21 Feb 2020 18:48:20 +0100
From: Antoine Tenart <antoine.tenart@...tlin.com>
To: Igor Russkikh <irusskikh@...vell.com>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
Antoine Tenart <antoine.tenart@...tlin.com>,
Mark Starovoytov <mstarovoitov@...vell.com>,
Dmitry Bogdanov <dbogdanov@...vell.com>
Subject: Re: [RFC 09/18] net: macsec: add support for getting offloaded stats
Hello,
On Fri, Feb 14, 2020 at 06:02:49PM +0300, Igor Russkikh wrote:
> From: Dmitry Bogdanov <dbogdanov@...vell.com>
>
> report sw stats only if offloaded stats are not supported
Please improve the changelog.
> -static int copy_tx_sa_stats(struct sk_buff *skb,
> - struct macsec_tx_sa_stats __percpu *pstats)
> +static void get_tx_sa_stats(struct net_device *dev, int an,
> + struct macsec_tx_sa *tx_sa,
> + struct macsec_tx_sa_stats *sum)
> {
> - struct macsec_tx_sa_stats sum = {0, };
> + struct macsec_dev *macsec = macsec_priv(dev);
> + int err = -EOPNOTSUPP;
> int cpu;
>
> + /* If h/w offloading is available, propagate to the device */
> + if (macsec_is_offloaded(macsec)) {
> + const struct macsec_ops *ops;
> + struct macsec_context ctx;
> +
> + ops = macsec_get_ops(macsec, &ctx);
> + if (ops) {
> + ctx.sa.assoc_num = an;
> + ctx.sa.tx_sa = tx_sa;
> + ctx.stats.tx_sa_stats = sum;
> + ctx.secy = &macsec_priv(dev)->secy;
> + err = macsec_offload(ops->mdo_get_tx_sa_stats, &ctx);
> + }
> + }
> +
> + if (err != -EOPNOTSUPP)
> + return;
If offloading is enabled and ops->mdo_get_tx_sa_stats is returning
-EOPNOTSUPP, do we really want to return the s/w stats as they'll be
wrong and out of sync with the hardware anyway?
(The same applies for the other statistics retrieval in the same patch).
> +
> for_each_possible_cpu(cpu) {
> - const struct macsec_tx_sa_stats *stats = per_cpu_ptr(pstats, cpu);
> + const struct macsec_tx_sa_stats *stats =
> + per_cpu_ptr(tx_sa->stats, cpu);
>
> - sum.OutPktsProtected += stats->OutPktsProtected;
> - sum.OutPktsEncrypted += stats->OutPktsEncrypted;
> + sum->OutPktsProtected += stats->OutPktsProtected;
> + sum->OutPktsEncrypted += stats->OutPktsEncrypted;
> }
> +}
Thanks!
Antoine
--
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists