[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7dc08daf1e56de6d56fdfe711eeffa9f9bb9ace7.camel@perches.com>
Date: Mon, 23 Mar 2020 22:14:35 -0700
From: Joe Perches <joe@...ches.com>
To: Igor Russkikh <irusskikh@...vell.com>, netdev@...r.kernel.org
Cc: Mark Starovoytov <mstarovoitov@...vell.com>,
Sabrina Dubroca <sd@...asysnail.net>,
Antoine Tenart <antoine.tenart@...tlin.com>,
Dmitry Bogdanov <dbogdanov@...vell.com>
Subject: Re: [PATCH net-next 16/17] net: atlantic: MACSec offload statistics
implementation
On Mon, 2020-03-23 at 16:13 +0300, Igor Russkikh wrote:
> From: Dmitry Bogdanov <dbogdanov@...vell.com>
>
> This patch adds support for MACSec statistics on Atlantic network cards.
trivia:
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
[]
> @@ -96,6 +97,62 @@ static const char aq_ethtool_queue_stat_names[][ETH_GSTRING_LEN] = {
> "Queue[%d] InErrors",
> };
[]
> +static const char aq_macsec_txsc_stat_names[][ETH_GSTRING_LEN + 1] = {
> + "MACSecTXSC%d ProtectedPkts\0",
> + "MACSecTXSC%d EncryptedPkts\0",
> + "MACSecTXSC%d ProtectedOctets\0",
> + "MACSecTXSC%d EncryptedOctets\0",
> +};
> +
> +static const char aq_macsec_txsa_stat_names[][ETH_GSTRING_LEN + 1] = {
> + "MACSecTXSC%dSA%d HitDropRedirect\0",
> + "MACSecTXSC%dSA%d Protected2Pkts\0",
> + "MACSecTXSC%dSA%d ProtectedPkts\0",
> + "MACSecTXSC%dSA%d EncryptedPkts\0",
> +};
> +
> +static const char aq_macsec_rxsa_stat_names[][ETH_GSTRING_LEN + 1] = {
> + "MACSecRXSC%dSA%d UntaggedHitPkts\0",
> + "MACSecRXSC%dSA%d CtrlHitDrpRedir\0",
> + "MACSecRXSC%dSA%d NotUsingSa\0",
> + "MACSecRXSC%dSA%d UnusedSa\0",
> + "MACSecRXSC%dSA%d NotValidPkts\0",
> + "MACSecRXSC%dSA%d InvalidPkts\0",
> + "MACSecRXSC%dSA%d OkPkts\0",
> + "MACSecRXSC%dSA%d LatePkts\0",
> + "MACSecRXSC%dSA%d DelayedPkts\0",
> + "MACSecRXSC%dSA%d UncheckedPkts\0",
> + "MACSecRXSC%dSA%d ValidatedOctets\0",
> + "MACSecRXSC%dSA%d DecryptedOctets\0",
> +};
The terminating \0 is odd and aren't these used only
for format strings?
If so, why are these [][ETH_GSTRING_LEN + 1] and not
static const char * [] ?
[]
> +#if IS_ENABLED(CONFIG_MACSEC)
> + if (!aq_nic->macsec_cfg)
> + break;
> +
> + memcpy(p, aq_macsec_stat_names, sizeof(aq_macsec_stat_names));
> + p = p + sizeof(aq_macsec_stat_names);
> + for (i = 0; i < AQ_MACSEC_MAX_SC; i++) {
> + struct aq_macsec_txsc *aq_txsc;
> +
> + if (!(test_bit(i, &aq_nic->macsec_cfg->txsc_idx_busy)))
> + continue;
> +
> + for (si = 0;
> + si < ARRAY_SIZE(aq_macsec_txsc_stat_names);
> + si++) {
> + snprintf(p, ETH_GSTRING_LEN,
> + aq_macsec_txsc_stat_names[si], i);
Used as format string, etc...
> + p += ETH_GSTRING_LEN;
> + }
> + aq_txsc = &aq_nic->macsec_cfg->aq_txsc[i];
> + for (sa = 0; sa < MACSEC_NUM_AN; sa++) {
> + if (!(test_bit(sa, &aq_txsc->tx_sa_idx_busy)))
> + continue;
> + for (si = 0;
> + si < ARRAY_SIZE(aq_macsec_txsa_stat_names);
> + si++) {
> + snprintf(p, ETH_GSTRING_LEN,
> + aq_macsec_txsa_stat_names[si],
> + i, sa);
> + p += ETH_GSTRING_LEN;
> + }
> + }
> + }
> + for (i = 0; i < AQ_MACSEC_MAX_SC; i++) {
> + struct aq_macsec_rxsc *aq_rxsc;
> +
> + if (!(test_bit(i, &aq_nic->macsec_cfg->rxsc_idx_busy)))
> + continue;
> +
> + aq_rxsc = &aq_nic->macsec_cfg->aq_rxsc[i];
> + for (sa = 0; sa < MACSEC_NUM_AN; sa++) {
> + if (!(test_bit(sa, &aq_rxsc->rx_sa_idx_busy)))
> + continue;
> + for (si = 0;
> + si < ARRAY_SIZE(aq_macsec_rxsa_stat_names);
> + si++) {
> + snprintf(p, ETH_GSTRING_LEN,
> + aq_macsec_rxsa_stat_names[si],
> + i, sa);
> + p += ETH_GSTRING_LEN;
> + }
> + }
> + }
> +#endif
etc...
Powered by blists - more mailing lists