Re: [RFC net-next v2 4/5] net: phy: nxp-c45-tja11xx: add MACsec statistics

Sabrina Dubroca
2023-08-25T13:41:42Z

2023-08-24, 12:16:14 +0300, Radu Pirea (NXP OSS) wrote:
> @@ -1323,8 +1469,10 @@ static int nxp_c45_mdo_del_txsa(struct macsec_context *ctx)
>
> nxp_c45_select_secy(phydev, phy_secy->secy_id);
>
> - if (tx_sa->is_enabled)
> + if (tx_sa->is_enabled) {
> nxp_c45_update_key_status(phydev, tx_sa);
> + nxp_c45_tx_sa_stats_clear(phydev, tx_sa);

If the TXSA was already disabled (via mdo_upd_txsa), don't you need to
clear the stats as well?

[...]
> +static int nxp_c45_mdo_get_tx_sc_stats(struct macsec_context *ctx)
> +{
[...]
> + nxp_c45_macsec_read(phydev, MACSEC_OOE1HS, &reg);
> + stat = (u64)reg << 32;
> + nxp_c45_macsec_read(phydev, MACSEC_OOE2HS, &reg);
> + stat |= reg;
> + if (ctx->secy->tx_sc.encrypt)
> + tx_sc_stats->OutOctetsEncrypted = stat;
> + else
> + tx_sc_stats->OutOctetsEncrypted = 0;
> +
> + if (ctx->secy->protect_frames)
> + tx_sc_stats->OutOctetsProtected = stat;
> + else
> + tx_sc_stats->OutOctetsProtected = 0;

This doesn't look consistent with macsec_count_tx
(drivers/net/macsec.c).

--
Sabrina