From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Ivan Malov <ivan.malov@arknetworks.am>, dev@dpdk.org
Cc: Denis Pryazhennikov <denis.pryazhennikov@arknetworks.am>,
Andy Moreton <andy.moreton@amd.com>,
Pieter Jansen Van Vuuren <pieter.jansen-van-vuuren@amd.com>,
Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
Subject: Re: [PATCH 35/46] common/sfc_efx/base: support MAC statistics on Medford4 NICs
Date: Thu, 17 Apr 2025 10:43:29 +0300 [thread overview]
Message-ID: <fc881a88-03d1-4fc8-b9f5-bd9103c9b540@oktetlabs.ru> (raw)
In-Reply-To: <20250416140016.36127-36-ivan.malov@arknetworks.am>
On 4/16/25 17:00, Ivan Malov wrote:
> Supply Medford4-specific methods to clear, upload and update
> MAC statistics, as well as the method to toggle periodic DMA
> updates. All of these leverage the same netport MCDI command.
>
> Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
> Reviewed-by: Andy Moreton <andy.moreton@amd.com>
> Reviewed-by: Pieter Jansen Van Vuuren <pieter.jansen-van-vuuren@amd.com>
[snip]
> diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c
> index eb1b68b17e..31fcb361f2 100644
> --- a/drivers/common/sfc_efx/base/ef10_nic.c
> +++ b/drivers/common/sfc_efx/base/ef10_nic.c
> @@ -2523,7 +2523,9 @@ ef10_nic_probe(
>
> #if EFSYS_OPT_MAC_STATS
> /* Wipe the MAC statistics */
> - if ((rc = efx_mcdi_mac_stats_clear(enp)) != 0)
> +
> + rc = efx_mcdi_mac_stats_clear(enp);
> + if (rc != 0)
it looks like unrelated style change.
> goto fail6;
> #endif
>
[snip]
> diff --git a/drivers/common/sfc_efx/base/efx_np.c b/drivers/common/sfc_efx/base/efx_np.c
> index d4ee17ffb4..df836f09a6 100644
> --- a/drivers/common/sfc_efx/base/efx_np.c
> +++ b/drivers/common/sfc_efx/base/efx_np.c
> @@ -1291,3 +1291,92 @@ efx_np_mac_ctrl(
> EFSYS_PROBE1(fail1, efx_rc_t, rc);
> return (rc);
> }
> +
> +#if EFSYS_OPT_MAC_STATS
> + __checkReturn efx_rc_t
> +efx_np_mac_stats(
> + __in efx_nic_t *enp,
> + __in efx_np_handle_t nph,
> + __in efx_stats_action_t action,
> + __in_opt const efsys_mem_t *esmp,
> + __in uint16_t period_ms)
> +{
> + EFX_MCDI_DECLARE_BUF(payload,
> + MC_CMD_GET_NETPORT_STATISTICS_IN_LEN,
> + MC_CMD_GET_NETPORT_STATISTICS_OUT_LENMIN);
> + int enable = (action == EFX_STATS_ENABLE_NOEVENTS);
> + int events = (action == EFX_STATS_ENABLE_EVENTS);
> + int disable = (action == EFX_STATS_DISABLE);
> + int upload = (action == EFX_STATS_UPLOAD);
> + int clear = (action == EFX_STATS_CLEAR);
IMHO boolean_t should be used for 5 above variables.
> + efx_mcdi_req_t req;
> + efx_rc_t rc;
[snip]
> +
> + /* TODO: validate encp->enc_mac_stats_nstats */
TODO again. The new code is full of TODO and FIXME. It looks like it has
huge backlog. What's the problem to fix the TODO? Is the driver really
ready?
> + sz = encp->enc_mac_stats_nstats * sizeof (efx_qword_t);
> +
[snip]
> + __checkReturn efx_rc_t
> +medford4_mac_stats_periodic(
> + __in efx_nic_t *enp,
> + __in efsys_mem_t *esmp,
> + __in uint16_t period_ms,
> + __in boolean_t events)
> +{
> + efx_port_t *epp = &(enp->en_port);
> + efx_rc_t rc;
> +
> + if (period_ms == 0) {
> + rc = efx_np_mac_stats(enp, epp->ep_np_handle,
> + EFX_STATS_DISABLE, NULL, 0);
> + } else if (events != B_FALSE) {
> + rc = efx_np_mac_stats(enp, epp->ep_np_handle,
> + EFX_STATS_ENABLE_EVENTS, esmp, period_ms);
> + } else {
> + rc = efx_np_mac_stats(enp, epp->ep_np_handle,
> + EFX_STATS_ENABLE_NOEVENTS, esmp, period_ms);
> + }
> +
> + if (rc != 0)
> + goto fail1;
> +
> + return (0);
> +
> +fail1:
> + EFSYS_PROBE1(fail1, efx_rc_t, rc);
> + return (rc);
> +}
> +
> +#define MEDFORD4_MAC_STAT_READ(_esmp, _field, _eqp) \
> + EFSYS_MEM_READQ((_esmp), (_field) * sizeof (efx_qword_t), _eqp)
> +
> + __checkReturn efx_rc_t
> +medford4_mac_stats_update(
> + __in efx_nic_t *enp,
> + __in efsys_mem_t *esmp,
> + __inout_ecount(EFX_MAC_NSTATS) efsys_stat_t *stats,
> + __inout_opt uint32_t *generationp)
> +{
> + const efx_nic_cfg_t *encp = &enp->en_nic_cfg;
> + efx_port_t *epp = &(enp->en_port);
> + efx_qword_t generation_start;
> + efx_qword_t generation_end;
> + unsigned int i;
> + efx_rc_t rc;
> +
> + /* TODO: validate encp->enc_mac_stats_nstats */
> + if (EFSYS_MEM_SIZE(esmp) <
> + (encp->enc_mac_stats_nstats * sizeof (efx_qword_t))) {
> + /* DMA buffer too small */
> + rc = ENOSPC;
> + goto fail1;
> + }
> +
> + /* Read END first so we don't race with the MC */
> + EFSYS_DMA_SYNC_FOR_KERNEL(esmp, 0, EFSYS_MEM_SIZE(esmp));
> + MEDFORD4_MAC_STAT_READ(esmp, (encp->enc_mac_stats_nstats - 1),
> + &generation_end);
> + EFSYS_MEM_READ_BARRIER();
> +
> + for (i = 0; i < EFX_ARRAY_SIZE(epp->ep_np_mac_stat_lut); ++i) {
> + efx_qword_t value;
> +
> + if (epp->ep_np_mac_stat_lut[i].ens_valid == B_FALSE)
> + continue;
> +
> + MEDFORD4_MAC_STAT_READ(esmp,
> + epp->ep_np_mac_stat_lut[i].ens_dma_fld, &value);
> +
> + EFSYS_STAT_SET_QWORD(&(stats[i]), &value);
> + }
> +
> + /* TODO: care about VADAPTOR statistics */
TODO again
> +
> + /* Read START generation counter */
> + EFSYS_DMA_SYNC_FOR_KERNEL(esmp, 0, EFSYS_MEM_SIZE(esmp));
> + EFSYS_MEM_READ_BARRIER();
> +
> + /* FIXME: we never parse marker descriptors; assume start is 0 offset */
FIXME again
> + MEDFORD4_MAC_STAT_READ(esmp, 0, &generation_start);
> +
> + /* Check that we didn't read the stats in the middle of a DMA */
> + if (memcmp(&generation_start, &generation_end,
> + sizeof (generation_start)) != 0)
> + return (EAGAIN);
> +
> + if (generationp != NULL)
> + *generationp = EFX_QWORD_FIELD(generation_start, EFX_DWORD_0);
> +
> + return (0);
> +
> +fail1:
> + EFSYS_PROBE1(fail1, efx_rc_t, rc);
> + return (rc);
> +}
> +
> +#undef MEDFORD4_MAC_STAT_READ
> #endif /* EFSYS_OPT_MAC_STATS */
> #endif /* EFSYS_OPT_MEDFORD4 */
next prev parent reply other threads:[~2025-04-17 7:43 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 13:59 [PATCH 00/46] Support AMD Solarflare X45xx adaptors Ivan Malov
2025-04-16 13:59 ` [PATCH 01/46] common/sfc_efx/base: add Medford4 PCI IDs to common code Ivan Malov
2025-04-16 13:59 ` [PATCH 02/46] common/sfc_efx/base: add efsys option for Medford4 Ivan Malov
2025-04-17 7:08 ` Andrew Rybchenko
2025-04-17 15:07 ` Stephen Hemminger
2025-04-18 7:25 ` Andrew Rybchenko
2025-04-16 13:59 ` [PATCH 03/46] common/sfc_efx/base: add Medford4 support to NIC module Ivan Malov
2025-04-17 7:14 ` Andrew Rybchenko
2025-04-16 13:59 ` [PATCH 04/46] common/sfc_efx/base: add Medford4 support to EV module Ivan Malov
2025-04-16 13:59 ` [PATCH 05/46] common/sfc_efx/base: add Medford4 support to FILTER module Ivan Malov
2025-04-16 13:59 ` [PATCH 06/46] common/sfc_efx/base: add Medford4 support to INTR module Ivan Malov
2025-04-16 13:59 ` [PATCH 07/46] common/sfc_efx/base: add Medford4 support to MAC module Ivan Malov
2025-04-16 13:59 ` [PATCH 08/46] common/sfc_efx/base: add Medford4 support to PHY module Ivan Malov
2025-04-16 13:59 ` [PATCH 09/46] common/sfc_efx/base: add Medford4 support to TUNNEL module Ivan Malov
2025-04-16 13:59 ` [PATCH 10/46] common/sfc_efx/base: add Medford4 support to MCDI module Ivan Malov
2025-04-16 13:59 ` [PATCH 11/46] common/sfc_efx/base: add Medford4 support to Rx module Ivan Malov
2025-04-16 13:59 ` [PATCH 12/46] common/sfc_efx/base: add Medford4 support to Tx module Ivan Malov
2025-04-16 13:59 ` [PATCH 13/46] drivers: enable support for AMD Solarflare X4 adapter family Ivan Malov
2025-04-16 13:59 ` [PATCH 14/46] common/sfc_efx/base: update X4 BAR layout and PCI IDs Ivan Malov
2025-04-16 13:59 ` [PATCH 15/46] net/sfc: add Medford4 with only full feature datapath engine Ivan Malov
2025-04-16 13:59 ` [PATCH 16/46] common/sfc_efx/base: add port mode for 8 port hardware Ivan Malov
2025-04-16 13:59 ` [PATCH 17/46] common/sfc_efx/base: add new X4 port mode Ivan Malov
2025-04-16 13:59 ` [PATCH 18/46] common/sfc_efx/base: extend list of supported X4 port modes Ivan Malov
2025-04-16 13:59 ` [PATCH 19/46] common/sfc_efx/base: update MCDI headers Ivan Malov
2025-04-16 13:59 ` [PATCH 20/46] common/sfc_efx/base: provide a stub for basic netport attach Ivan Malov
2025-04-16 13:59 ` [PATCH 21/46] common/sfc_efx/base: provide defaults on netport attach path Ivan Malov
2025-04-16 13:59 ` [PATCH 22/46] common/sfc_efx/base: obtain assigned netport handle from NIC Ivan Malov
2025-04-16 13:59 ` [PATCH 23/46] common/sfc_efx/base: allow for const in MCDI struct accessor Ivan Malov
2025-04-16 13:59 ` [PATCH 24/46] common/sfc_efx/base: get netport fixed capabilities on probe Ivan Malov
2025-04-16 13:59 ` [PATCH 25/46] common/sfc_efx/base: decode netport link state on probe path Ivan Malov
2025-04-16 13:59 ` [PATCH 26/46] common/sfc_efx/base: fill in loopback modes on netport probe Ivan Malov
2025-04-16 13:59 ` [PATCH 27/46] common/sfc_efx/base: introduce Medford4 stub for PHY methods Ivan Malov
2025-04-16 13:59 ` [PATCH 28/46] common/sfc_efx/base: refactor EF10 link mode decoding helper Ivan Malov
2025-04-16 13:59 ` [PATCH 29/46] common/sfc_efx/base: provide PHY link get method on Medford4 Ivan Malov
2025-04-16 14:00 ` [PATCH 30/46] common/sfc_efx/base: implement PHY link control for Medford4 Ivan Malov
2025-04-17 7:31 ` Andrew Rybchenko
2025-04-16 14:00 ` [PATCH 31/46] common/sfc_efx/base: introduce Medford4 stub for MAC methods Ivan Malov
2025-04-16 14:00 ` [PATCH 32/46] common/sfc_efx/base: add MAC reconfigure method for Medford4 Ivan Malov
2025-04-17 7:34 ` Andrew Rybchenko
2025-04-16 14:00 ` [PATCH 33/46] common/sfc_efx/base: fill in software LUT for MAC statistics Ivan Malov
2025-04-16 14:00 ` [PATCH 34/46] common/sfc_efx/base: fill in MAC statistics mask on Medford4 Ivan Malov
2025-04-16 14:00 ` [PATCH 35/46] common/sfc_efx/base: support MAC statistics on Medford4 NICs Ivan Malov
2025-04-17 7:43 ` Andrew Rybchenko [this message]
2025-04-16 14:00 ` [PATCH 36/46] common/sfc_efx/base: implement MAC PDU controls for Medford4 Ivan Malov
2025-04-16 14:00 ` [PATCH 37/46] common/sfc_efx/base: correct MAC PDU calculation on Medford4 Ivan Malov
2025-04-16 14:00 ` [PATCH 38/46] net/sfc: make use of generic EFX MAC PDU calculation helpers Ivan Malov
2025-04-16 14:00 ` [PATCH 39/46] common/sfc_efx/base: ignore legacy link events on new boards Ivan Malov
2025-04-16 14:00 ` [PATCH 40/46] common/sfc_efx/base: add link event processing " Ivan Malov
2025-04-16 14:00 ` [PATCH 41/46] net/sfc: query link status on link change events on new NICs Ivan Malov
2025-04-16 14:00 ` [PATCH 42/46] common/sfc_efx/base: subscribe to netport link change events Ivan Malov
2025-04-16 14:00 ` [PATCH 43/46] net/sfc: offer support for 200G link ability on new adaptors Ivan Malov
2025-04-16 14:00 ` [PATCH 44/46] common/sfc_efx/base: support controls for netport lane count Ivan Malov
2025-04-17 7:57 ` Andrew Rybchenko
2025-04-16 14:00 ` [PATCH 45/46] net/sfc: add support for control of physical port " Ivan Malov
2025-04-16 14:00 ` [PATCH 46/46] doc: advertise support for AMD Solarflare X45xx adapters Ivan Malov
2025-04-16 15:14 ` [PATCH 00/46] Support AMD Solarflare X45xx adaptors Stephen Hemminger
2025-04-16 15:38 ` Ivan Malov
2025-04-16 16:31 ` Stephen Hemminger
2025-04-16 17:37 ` Ivan Malov
2025-04-16 21:44 ` Stephen Hemminger
2025-04-17 8:09 ` Andrew Rybchenko
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=fc881a88-03d1-4fc8-b9f5-bd9103c9b540@oktetlabs.ru \
--to=andrew.rybchenko@oktetlabs.ru \
--cc=andy.moreton@amd.com \
--cc=denis.pryazhennikov@arknetworks.am \
--cc=dev@dpdk.org \
--cc=ivan.malov@arknetworks.am \
--cc=pieter.jansen-van-vuuren@amd.com \
--cc=viacheslav.galaktionov@arknetworks.am \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).