2023-09-06, 19:01:33 +0300, Radu Pirea (NXP OSS) wrote:
+
+ nxp_c45_macsec_read(phydev, MACSEC_OPUS, ®);
+ dev_stats->OutPktsUntagged = reg;
Can you read directly into OutPktsUntagged? It would make the code a
little bit more readable.
It's a bit unfortunate that all those stats read turn into 2 (or 4 for
the 64b counters) reads. If the HW's value can be incremented while
we're reading it we'll see an inconsistent value :(
+
+ nxp_c45_macsec_read(phydev, MACSEC_OOE1HS, ®);
+ stats->OutOctetsEncrypted = (u64)reg << 32;
+ nxp_c45_macsec_read(phydev, MACSEC_OOE2HS, ®);
+ stats->OutOctetsEncrypted |= reg;
Since you have a few 64b HW counters, I'd suggest a helper:
stats->OutOctetsEncrypted = nxp_c45_macsec_read64(phydev, MACSEC_OOE1HS, MACSEC_OOE2HS);
Or (more consistent with the 32b reads):
nxp_c45_macsec_read64(phydev, MACSEC_OOE1HS, MACSEC_OOE2HS, &stats->OutOctetsEncrypted);