DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: dev <dev@dpdk.org>,
	 Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>,
	Andy Moreton <amoreton@xilinx.com>
Subject: Re: [dpdk-dev] [PATCH] net/sfc: allow control threads for counter queue polling
Date: Thu, 21 Oct 2021 22:28:38 +0200	[thread overview]
Message-ID: <CAJFAV8xFB2zL3AjaTPYMD1i2N_gsBVkUzqWw+NyrvL_gcK5dcA@mail.gmail.com> (raw)
In-Reply-To: <20211021070355.3547582-1-andrew.rybchenko@oktetlabs.ru>

On Thu, Oct 21, 2021 at 9:04 AM Andrew Rybchenko
<andrew.rybchenko@oktetlabs.ru> wrote:
>
> From: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
>
> MAE counters can be polled from a control thread if no service core is
> allocated for this.
>
> Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Reviewed-by: Andy Moreton <amoreton@xilinx.com>
> ---
> The problem to require service cores for HW offload was raised by
> David on review in 21.08 release cycle.

Thanks for following up!


>
>  doc/guides/rel_notes/release_21_11.rst |   1 +
>  drivers/net/sfc/sfc_mae.h              |  26 +++++-
>  drivers/net/sfc/sfc_mae_counter.c      | 120 ++++++++++++++++++++-----
>  3 files changed, 123 insertions(+), 24 deletions(-)
>
> diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
> index 041383ee2a..9517e0fb0a 100644
> --- a/doc/guides/rel_notes/release_21_11.rst
> +++ b/doc/guides/rel_notes/release_21_11.rst
> @@ -158,6 +158,7 @@ New Features
>
>    * Added port representors support on SN1000 SmartNICs
>    * Added flow API transfer proxy support
> +  * Added support for flow counters without service cores
>
>  * **Updated Marvell cnxk crypto PMD.**
>
> diff --git a/drivers/net/sfc/sfc_mae.h b/drivers/net/sfc/sfc_mae.h
> index 23dcf1e482..45a2fdc3bb 100644
> --- a/drivers/net/sfc/sfc_mae.h
> +++ b/drivers/net/sfc/sfc_mae.h
> @@ -127,6 +127,13 @@ struct sfc_mae_counters {
>         unsigned int                    n_mae_counters;
>  };
>
> +/** Options for MAE counter polling mode */
> +enum sfc_mae_counter_polling_mode {
> +       SFC_MAE_COUNTER_POLLING_OFF = 0,
> +       SFC_MAE_COUNTER_POLLING_SERVICE,
> +       SFC_MAE_COUNTER_POLLING_THREAD,
> +};
> +
>  struct sfc_mae_counter_registry {
>         /* Common counter information */
>         /** Counters collection */
> @@ -143,10 +150,21 @@ struct sfc_mae_counter_registry {
>         bool                            use_credits;
>
>         /* Information used by configuration routines */
> -       /** Counter service core ID */
> -       uint32_t                        service_core_id;
> -       /** Counter service ID */
> -       uint32_t                        service_id;
> +       enum sfc_mae_counter_polling_mode polling_mode;
> +       union {
> +               struct {
> +                       /** Counter service core ID */
> +                       uint32_t                        core_id;
> +                       /** Counter service ID */
> +                       uint32_t                        id;
> +               } service;
> +               struct {
> +                       /** Counter thread ID */
> +                       pthread_t                       id;
> +                       /** The thread should keep running */
> +                       volatile bool                   run;

volatile is probably unneeded.


> +               } thread;
> +       } polling;
>  };
>
>  /**
> diff --git a/drivers/net/sfc/sfc_mae_counter.c b/drivers/net/sfc/sfc_mae_counter.c
> index 418caffe59..5f2aea1bf4 100644
> --- a/drivers/net/sfc/sfc_mae_counter.c
> +++ b/drivers/net/sfc/sfc_mae_counter.c
> @@ -45,9 +45,6 @@ sfc_mae_counter_rxq_required(struct sfc_adapter *sa)
>         if (encp->enc_mae_supported == B_FALSE)
>                 return false;
>
> -       if (sfc_mae_counter_get_service_lcore(sa) == RTE_MAX_LCORE)
> -               return false;
> -
>         return true;
>  }
>
> @@ -402,6 +399,23 @@ sfc_mae_counter_routine(void *arg)
>         return 0;
>  }
>
> +static void *
> +sfc_mae_counter_thread(void *data)
> +{
> +       struct sfc_adapter *sa = data;
> +       struct sfc_mae_counter_registry *counter_registry =
> +               &sa->mae.counter_registry;
> +
> +       /*
> +        * Check run condition without atomic since it is not a problem
> +        * if we run a bit more before we notice stop request
> +        */

I find it clearer when we have clear pairs of atomic acquire
load/release store (maybe because I feel like I understand something
:-)).
So it may not be a problem, but is there a reason to avoid this
(acquire) atomic load?


Otherwise, patch lgtm.
Thanks.


-- 
David Marchand


  parent reply	other threads:[~2021-10-21 20:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21  7:03 Andrew Rybchenko
2021-10-21 20:23 ` Ferruh Yigit
2021-10-21 20:43   ` Ferruh Yigit
2021-10-21 20:28 ` David Marchand [this message]
2021-10-22  7:19   ` Andrew Rybchenko
2021-11-03 12:40 ` [dpdk-dev] [PATCH v2] " Andrew Rybchenko
2021-11-03 13:00   ` David Marchand
2021-11-03 13:13     ` Andrew Rybchenko
2021-11-03 13:13 ` [dpdk-dev] [PATCH v3] " Andrew Rybchenko
2021-11-04 17:05   ` Ferruh Yigit

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=CAJFAV8xFB2zL3AjaTPYMD1i2N_gsBVkUzqWw+NyrvL_gcK5dcA@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=amoreton@xilinx.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=viacheslav.galaktionov@oktetlabs.ru \
    /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).