DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: Ankur Dwivedi <adwivedi@marvell.com>
Cc: dev@dpdk.org, jerinj@marvell.com, ndabilpuram@marvell.com,
	 kirankumark@marvell.com, skori@marvell.com,
	skoteshwar@marvell.com,  Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [PATCH v2 1/2] common/cnxk: add support to get aged flows
Date: Thu, 28 Sep 2023 13:43:50 +0530	[thread overview]
Message-ID: <CALBAE1P3xy9X7n29Hri4Ptkc7MGeG41aAc=0boiqTk=96G8dtQ@mail.gmail.com> (raw)
In-Reply-To: <CALBAE1OywcTMYz0iqZFBc7VXfac7p3anbGdzZS+=rAer=cGbpA@mail.gmail.com>

On Mon, Aug 14, 2023 at 12:26 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>
> On Tue, Aug 8, 2023 at 2:20 PM Ankur Dwivedi <adwivedi@marvell.com> wrote:
> >
> > Adds support to get aged flows in CNXK driver.
> > The control thread polls the status of flows having age action, every 10
> > seconds and updates a bitmap array with the aged flows. The poll frequency
> > of control thread can be set by devargs.
> >
> > Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> > ---
> >  drivers/common/cnxk/meson.build     |   1 +
> >  drivers/common/cnxk/roc_mbox.h      |  27 +++
> >  drivers/common/cnxk/roc_npc.c       |  22 ++
> >  drivers/common/cnxk/roc_npc.h       |  28 +++
> >  drivers/common/cnxk/roc_npc_aging.c | 315 ++++++++++++++++++++++++++++
> >  drivers/common/cnxk/roc_npc_priv.h  |  17 ++
> >  drivers/common/cnxk/roc_platform.h  |   8 +
> >  drivers/common/cnxk/version.map     |   1 +
> >  8 files changed, 419 insertions(+)
> >  create mode 100644 drivers/common/cnxk/roc_npc_aging.c
>
> Updated the release notes as
> diff --git a/doc/guides/rel_notes/release_23_11.rst
> b/doc/guides/rel_notes/release_23_11.rst
> index 5b01a52593..10d4484685 100644
> --- a/doc/guides/rel_notes/release_23_11.rst
> +++ b/doc/guides/rel_notes/release_23_11.rst
> @@ -58,6 +58,7 @@ New Features
>  * **Updated Marvell cnxk ethdev driver.**
>
>    * Added support for ``RTE_FLOW_ITEM_TYPE_IPV6_ROUTING_EXT`` flow item.
> +  * Added support for ``RTE_FLOW_ACTION_TYPE_AGE`` flow action.
>
> Updated the git commit as follows and applied to
> dpdk-next-net-mrvl/for-next-net. Thanks


Ankur, following changes in upstream changed the thread APIs. I have
adapted to this change in [1]. Please review ASAP - It is blocking rc1
PR.

commit 1c1abf1786a6de044bd396da4cc316961e3fd812
Author: Thomas Monjalon <thomas@monjalon.net>
Date:   Wed Sep 13 13:28:19 2023 +0200

    lib: convert to internal control threads

    Calls to rte_ctrl_thread_create() are replaced with
    rte_thread_create_internal_control().
    Other pthread-related functions are replaced with the rte_thread API.
    Only pthread_cancel() has no replacement.

    Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
    Acked-by: Morten Brørup <mb@smartsharesystems.com>
    Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
    Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru


[1]

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index 83c04880f2..94c8e94400 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -1623,7 +1623,8 @@ roc_npc_flow_destroy(struct roc_npc *roc_npc,
struct roc_npc_flow *flow)
  npc_delete_prio_list_entry(npc, flow);

  npc_age_flow_list_entry_delete(roc_npc, flow);
- if (roc_npc->flow_age.age_flow_refcnt == 0 &&
roc_npc->flow_age.aged_flows_poll_thread)
+ if (roc_npc->flow_age.age_flow_refcnt == 0 &&
+ plt_thread_is_valid(roc_npc->flow_age.aged_flows_poll_thread))
  npc_aging_ctrl_thread_destroy(roc_npc);

 done:
diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
index ad1c3b08cc..5a7117eae4 100644
--- a/drivers/common/cnxk/roc_npc.h
+++ b/drivers/common/cnxk/roc_npc.h
@@ -359,7 +359,7 @@ struct roc_npc_flow_age {
  uint32_t aged_flows_cnt;
  uint32_t start_id;
  uint32_t end_id;
- pthread_t aged_flows_poll_thread;
+ rte_thread_t aged_flows_poll_thread;
  struct plt_bitmap *aged_flows;
  void *age_mem;
  bool aged_flows_get_thread_exit;
diff --git a/drivers/common/cnxk/roc_npc_aging.c
b/drivers/common/cnxk/roc_npc_aging.c
index 4b845954b4..74543f227b 100644
--- a/drivers/common/cnxk/roc_npc_aging.c
+++ b/drivers/common/cnxk/roc_npc_aging.c
@@ -134,7 +134,7 @@ npc_mcam_get_hit_status(struct npc *npc, uint64_t
*mcam_ids, uint16_t start_id,
  return rc;
 }

-void *
+uint32_t
 npc_aged_flows_get(void *args)
 {
  uint64_t hit_status[MCAM_ARR_SIZE] = {0};
@@ -182,7 +182,7 @@ npc_aged_flows_get(void *args)
  rc = npc_mcam_get_hit_status(npc, mcam_ids, start_id, end_id,
       hit_status, true);
  if (rc)
- return NULL;
+ return 0;

  plt_seqcount_write_begin(&flow_age->seq_cnt);
  flow_age->aged_flows_cnt = 0;
@@ -201,7 +201,7 @@ npc_aged_flows_get(void *args)
  sleep(flow_age->aging_poll_freq);
  }

- return NULL;
+ return 0;
 }

 void
@@ -276,8 +276,8 @@ npc_aging_ctrl_thread_create(struct roc_npc *roc_npc,

  if (flow_age->age_flow_refcnt == 0) {
  flow_age->aged_flows_get_thread_exit = false;
- if (plt_ctrl_thread_create(&flow_age->aged_flows_poll_thread,
-    "Aged Flows Get Ctrl Thread", NULL,
+ if (plt_thread_create_control(&flow_age->aged_flows_poll_thread,
+    "Aged Flows Get Ctrl Thread",
     npc_aged_flows_get, roc_npc) != 0) {
  plt_err("Failed to create thread for age flows");
  errcode = NPC_ERR_ACTION_NOTSUP;
@@ -295,7 +295,7 @@ npc_aging_ctrl_thread_destroy(struct roc_npc *roc_npc)

  flow_age = &roc_npc->flow_age;
  flow_age->aged_flows_get_thread_exit = true;
- pthread_join(flow_age->aged_flows_poll_thread, NULL);
+ plt_thread_join(flow_age->aged_flows_poll_thread, NULL);
  npc_aged_flows_bitmap_free(roc_npc);
 }

diff --git a/drivers/common/cnxk/roc_npc_priv.h
b/drivers/common/cnxk/roc_npc_priv.h
index 6d6cb64c65..424f8e207a 100644
--- a/drivers/common/cnxk/roc_npc_priv.h
+++ b/drivers/common/cnxk/roc_npc_priv.h
@@ -490,7 +490,7 @@ int npc_mcam_init(struct npc *npc, struct
roc_npc_flow *flow, int mcam_id);
 int npc_mcam_move(struct mbox *mbox, uint16_t old_ent, uint16_t new_ent);
 void npc_age_flow_list_entry_add(struct roc_npc *npc, struct
roc_npc_flow *flow);
 void npc_age_flow_list_entry_delete(struct roc_npc *npc, struct
roc_npc_flow *flow);
-void *npc_aged_flows_get(void *args);
+uint32_t npc_aged_flows_get(void *args);
 int npc_aged_flows_bitmap_alloc(struct roc_npc *roc_npc);
 void npc_aged_flows_bitmap_free(struct roc_npc *roc_npc);
 int npc_aging_ctrl_thread_create(struct roc_npc *roc_npc,
diff --git a/drivers/common/cnxk/roc_platform.h
b/drivers/common/cnxk/roc_platform.h
index ad0d1624a3..1e535a527d 100644
--- a/drivers/common/cnxk/roc_platform.h
+++ b/drivers/common/cnxk/roc_platform.h
@@ -145,6 +145,12 @@
 #define plt_thread_create_control    rte_thread_create_internal_control
 #define plt_thread_join              rte_thread_join

+static inline bool
+plt_thread_is_valid(rte_thread_t thr)
+{
+ return thr.opaque_id ? true : false;
+}
+
 #define plt_intr_efd_counter_size_get rte_intr_efd_counter_size_get
 #define plt_intr_efd_counter_size_set rte_intr_efd_counter_size_set
 #define plt_intr_vec_list_index_get rte_intr_vec_list_index_get

  reply	other threads:[~2023-09-28  8:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 11:59 [PATCH v1 0/2] add support for flow aging in CNXK driver Ankur Dwivedi
2023-07-27 11:59 ` [PATCH v1 1/2] common/cnxk: add support to get aged flows Ankur Dwivedi
2023-07-27 11:59 ` [PATCH v1 2/2] net/cnxk: add get flow aged ops Ankur Dwivedi
2023-08-08  8:49 ` [PATCH v2 0/2] add support for flow aging in CNXK driver Ankur Dwivedi
2023-08-08  8:49   ` [PATCH v2 1/2] common/cnxk: add support to get aged flows Ankur Dwivedi
2023-08-14  6:56     ` Jerin Jacob
2023-09-28  8:13       ` Jerin Jacob [this message]
2023-09-28 13:49         ` [EXT] " Ankur Dwivedi
2023-08-08  8:49   ` [PATCH v2 2/2] net/cnxk: add get flow aged ops Ankur Dwivedi

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='CALBAE1P3xy9X7n29Hri4Ptkc7MGeG41aAc=0boiqTk=96G8dtQ@mail.gmail.com' \
    --to=jerinjacobk@gmail.com \
    --cc=adwivedi@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=thomas@monjalon.net \
    /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).