DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@amd.com>
Cc: <dev@dpdk.org>
Subject: [RFC 0/3] introduce coroutine library
Date: Mon, 24 Apr 2023 13:02:05 +0000	[thread overview]
Message-ID: <20230424130208.9517-1-fengchengwen@huawei.com> (raw)

This patchset introduces the coroutine library which will help refactor
the hns3 PMD's reset process.

The hns3 single function reset process consists of the following steps:
    1.stop_service();
    2.prepare_reset();
    3.delay(100ms);
    4.notify_hw();
    5.wait_hw_reset_done(); // multiple sleep waits are involved.
    6.reinit();
    7.restore_conf();

If the DPDK process take over multiple hns3 functions (e.g. 100),
it's impractical to reset and restore functions in sequence:
    1.proc_func(001); // will completed in 100+ms range.
    2.proc_func(002); // will completed in 100~200+ms range.
    ...
    x.proc_func(100); // will completed in 9900~10000+ms range.
The later functions will process fail because it's too late to deal with.

One solution is that create a reset thread for each function, and it
will lead to large number of threads if the DPDK process take over
multiple hns3 functions.

So the current hns3 driver uses asynchronous mechanism, for examples, it
use rte_eal_alarm_set() when process delay(100ms), it splits a serial
process into multiple asynchronous processes, and the code is complex
and difficult to understand.

The coroutine is a good mechanism to provide programmers with the 
simplicity of keeping serial processes within a limited number of
threads.

This patchset use <ucontext.h> to build the coroutine framework, and it
just provides a demo. More APIs maybe added in the future.

In addition, we would like to ask the community whether it it possible
to accept the library. If not, whether it is allowed to provide the
library in hns3 PMD.

Chengwen Feng (3):
  lib/coroutine: add coroutine library
  examples/coroutine: support coroutine examples
  net/hns3: refactor reset process with coroutine

 drivers/net/hns3/hns3_ethdev.c    | 217 ++++++++++++++++++++++++++++++
 drivers/net/hns3/hns3_ethdev.h    |   3 +
 drivers/net/hns3/hns3_intr.c      |  38 ++++++
 drivers/net/hns3/meson.build      |   2 +-
 examples/coroutine/main.c         | 153 +++++++++++++++++++++
 examples/coroutine/meson.build    |  10 ++
 examples/meson.build              |   1 +
 lib/coroutine/meson.build         |   8 ++
 lib/coroutine/rte_coroutine.c     | 190 ++++++++++++++++++++++++++
 lib/coroutine/rte_coroutine.h     | 110 +++++++++++++++
 lib/coroutine/rte_coroutine_imp.h |  46 +++++++
 lib/coroutine/version.map         |  11 ++
 lib/meson.build                   |   1 +
 13 files changed, 789 insertions(+), 1 deletion(-)
 create mode 100644 examples/coroutine/main.c
 create mode 100644 examples/coroutine/meson.build
 create mode 100644 lib/coroutine/meson.build
 create mode 100644 lib/coroutine/rte_coroutine.c
 create mode 100644 lib/coroutine/rte_coroutine.h
 create mode 100644 lib/coroutine/rte_coroutine_imp.h
 create mode 100644 lib/coroutine/version.map

-- 
2.17.1


             reply	other threads:[~2023-04-24 13:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 13:02 Chengwen Feng [this message]
2023-04-24 13:02 ` [RFC 1/3] lib/coroutine: add " Chengwen Feng
2023-04-26 11:28   ` Ferruh Yigit
2023-04-24 13:02 ` [RFC 2/3] examples/coroutine: support coroutine examples Chengwen Feng
2023-04-24 13:02 ` [RFC 3/3] net/hns3: refactor reset process with coroutine Chengwen Feng
2023-04-24 16:08 ` [RFC 0/3] introduce coroutine library Stephen Hemminger
2023-04-25  2:11   ` fengchengwen
2023-04-25  2:16     ` Stephen Hemminger
2023-04-25  2:50       ` fengchengwen
2023-04-25  2:59         ` Garrett D'Amore
2023-04-25 21:06           ` Stephen Hemminger
2023-04-26 11:27     ` Ferruh Yigit
2023-04-28  7:20       ` fengchengwen
2023-04-25  9:27 ` Mattias Rönnblom

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=20230424130208.9517-1-fengchengwen@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.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).