From: Serhii Iliushyk <sil-plv@napatech.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
Mykola Kostenok <mko-plv@napatech.com>,
Christian Koue Muf <ckm@napatech.com>
Subject: Re: [PATCH v2 1/7] net/ntnic: introduce service API for NTNIC PMD
Date: Mon, 15 Sep 2025 10:10:39 +0000 [thread overview]
Message-ID: <VE1P190MB08305B788F9E11C757A19CFB8015A@VE1P190MB0830.EURP190.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20250913092304.1ca77333@hermes.local>
[-- Attachment #1: Type: text/plain, Size: 6241 bytes --]
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: 13 September 2025 19:23
To: Serhii Iliushyk <sil-plv@napatech.com>
Cc: dev@dpdk.org <dev@dpdk.org>; Mykola Kostenok <mko-plv@napatech.com>; Christian Koue Muf <ckm@napatech.com>
Subject: Re: [PATCH v2 1/7] net/ntnic: introduce service API for NTNIC PMD
On Mon, 8 Sep 2025 16:17:33 +0200
Serhii Iliushyk <sil-plv@napatech.com> wrote:
> diff --git a/doc/guides/nics/ntnic.rst b/doc/guides/nics/ntnic.rst
> index b3d6ad70c1..a173eaa2ac 100644
> --- a/doc/guides/nics/ntnic.rst
> +++ b/doc/guides/nics/ntnic.rst
> @@ -185,3 +185,115 @@ There are list of characteristics that age timeout action has:
> - after flow is aged-out it's not automatically deleted;
> - aged-out flow can be updated with ``flow update`` command,
> and its aged-out status will be reverted;
> +
> +Service API
> +-----------
> +
> +**nthw_service_add**
> +**nthw_service_del**
> +**nthw_service_get_info**
> +
> +The NTNIC PMD provides a service API that allows applications to configure services
> +
> +The services are responsible for handling the vital functionality of the NTNIC PMD:
> +
> +- **FLM Update**: is responsible for creating and destroying flows;
> +- **Statistics**: is responsible for collecting statistics;
> +- **Port event**: is responsible for handling port events: aging, port load, and flow load;
> +- **Adapter monitor** is responsible for link control;
> +
> +**NOTE**: Use next EAL options to configure set service cores
> + * -s SERVICE COREMASK Hexadecimal bitmask of cores to be used as service cores;
> + * -S SERVICE CORELIST List of cores to run services on;
> +
> +**NOTE**: **At least 5 lcores must be reserved** for the ntnic services by EAL options. above.
> +
> +For example
> +
> +.. code-block:: console
> +
> + dpdk-testpmd -S 8,9,10,11,12
> +
> +The PMD registers each service during initialization by function:
> +
> +.. code-block:: c
> +
> + int nthw_service_add(struct rte_service_spec *srv_spec, const enum rte_ntnic_service_tag tag)
> +
> +and unregistered by the PMD during deinitialization by the function:
> +
> +.. code-block:: c
> +
> + int nthw_service_del(const enum rte_ntnic_service_tag tag)
> +
> +The service info may be retrieved by function:
> +
> +.. code-block:: c
> +
> + struct nt_service *nthw_service_get_info(const enum rte_ntnic_service_tag tag)
> +
> +The service info includes the service ID, assigned lcore, and initialization state.
> +
> +Service API for user applications
> +---------------------------------
> +**rte_pmd_ntnic_service_set_lcore**
> +**rte_pmd_ntnic_service_get_id**
> +
> +The exported service API is available for applications to configure the services.
> +
> +By API function:
> +
> +.. code-block:: c
> +
> + int rte_pmd_ntnic_service_set_lcore(enum rte_ntnic_service_tag tag, uint32_t lcore_id)
> +
> +For example to assign lcores 8,9,10,11,12 to the services, the application can use:
> +
> +.. code-block:: c
> +
> + rte_pmd_ntnic_service_set_lcore(RTE_NTNIC_SERVICE_STAT, 8);
> + rte_pmd_ntnic_service_set_lcore(RTE_NTNIC_SERVICE_ADAPTER_MON, 9);
> + rte_pmd_ntnic_service_set_lcore(RTE_NTNIC_SERVICE_PORT_0_EVENT, 10);
> + rte_pmd_ntnic_service_set_lcore(RTE_NTNIC_SERVICE_PORT_1_EVENT,11);
> + rte_pmd_ntnic_service_set_lcore(RTE_NTNIC_SERVICE_FLM_UPDATE, 12);
> +
> +The API will automatically lcore to service core list and map the service to the lcore.
> +
> +.. note:: Use `rte_service_lcore_start` to start the lcore after mapping it to the service.
> +
> +Each service has its own tag to identify it.
> +
> +.. code-block:: c
> +
> + enum rte_ntnic_service_tag {
> + RTE_NTNIC_SERVICE_FLM_UPDATE = 0,
> + RTE_NTNIC_SERVICE_STAT = 1,
> + RTE_NTNIC_SERVICE_PORT_0_EVENT = 2,
> + RTE_NTNIC_SERVICE_PORT_1_EVENT = 3,
> + RTE_NTNIC_SERVICE_ADAPTER_MON = 4,
> + RTE_NTNIC_SERVICE_MAX
> + };
> +
> +The application may use next API function to retrieve the service id:
> +
> +.. code-block:: c
> +
> + int rte_pmd_ntnic_service_get_id(enum rte_ntnic_service_tag tag);
> +
> +
> +For example, to enable statistics for flm_update service, the application can use:
> +
> +.. code-block:: c
> +
> + int flm_update_id = rte_pmd_ntnic_service_get_id(RTE_NTNIC_SERVICE_FLM_UPDATE);
> + rte_service_set_stats_enable(flm_update_id, 1);
> +
> +All other manipulations with the service can be done with the service ID and rte_service* API.
> +
> +To use the service API, an application must have included the header file:
> +
> +.. code-block:: c
> +
> + #include <rte_pmd_ntnic.h>
> +
> +And linked with the library: `https://linkprotect.cudasvc.com/url?a=https%3a%2f%2flibrte_net_ntnic.so&c=E,1,Y0L6xj9VNKcZFYqAqRe-8zIt_7rMPD4KOWRMISoqVC_WIz7nsVj8xFm2zsiLl9o97z8bgkUxWD4uEioCtxO_S3AIO5hqm9inj17-Hase1qRv2byMWjlBinC_4A,,&typo=1` or `librte_net_ntnic.a` for static linking.
It is not clear what happens if application does not use the driver API?
What happens "out of the box" with OVS and VPP?
The fact that it requires special driver API's shows that there is a missing
feature in the service lcore library. Should be able to do this stuff through that
API. But that is not your problem, and doesn't need solving in this set.
Hi Stephen!
I will add some details here. There is an approach to run any application that can pass the EAL option to the rte_eal_init funtion.
Only one option is required here (-S SERVICE CORELIST or -s SERVICE COREMASK).
If this option is passed, then the ntnic services will be started with the function rte_service_start_with_defaults https://git.dpdk.org/dpdk/tree/lib/eal/linux/eal.c#n1259 inside of the rte_eal_init, since they are already registered after rte_bus_probe.
For OVS it is possible due to option dpdk_extra.
For example: ovs-vsctl set Open_vSwitch . other_config:dpdk_extra="-S 8,9,10,11,12 ..."
On the other side, the VPP has a "whitelist" of the EAL options, as far as I understand.
That list does not include handling service cores, so a small extension for the DPDK plugin is necessary here to support extra EAL option(s).
BR,
Serhii
[-- Attachment #2: Type: text/html, Size: 9964 bytes --]
next prev parent reply other threads:[~2025-09-15 10:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-08 11:04 [PATCH v1 0/7] migrate threads to DPDK service framework Serhii Iliushyk
2025-09-08 11:04 ` [PATCH v1 1/7] net/ntnic: introduce service API for NTNIC PMD Serhii Iliushyk
2025-09-08 11:04 ` [PATCH v1 2/7] net/ntnic: migrate flm update thread to service Serhii Iliushyk
2025-09-08 11:04 ` [PATCH v1 3/7] net/ntnic: migrate statistic " Serhii Iliushyk
2025-09-08 11:04 ` [PATCH v1 4/7] net/ntnic: migrate port event " Serhii Iliushyk
2025-09-08 11:04 ` [PATCH v1 5/7] net/ntnic: migrate adapter mon " Serhii Iliushyk
2025-09-08 11:04 ` [PATCH v1 6/7] net/ntnic: add warning about service cores Serhii Iliushyk
2025-09-08 11:04 ` [PATCH v1 7/7] net/ntnic: cleanup using pthreads and rte_thread Serhii Iliushyk
2025-09-08 14:17 ` [PATCH v2 0/7] migrate threads to DPDK service framework Serhii Iliushyk
2025-09-08 14:17 ` [PATCH v2 1/7] net/ntnic: introduce service API for NTNIC PMD Serhii Iliushyk
2025-09-13 16:23 ` Stephen Hemminger
2025-09-15 10:10 ` Serhii Iliushyk [this message]
2025-09-15 15:46 ` Stephen Hemminger
2025-09-08 14:17 ` [PATCH v2 2/7] net/ntnic: migrate flm update thread to service Serhii Iliushyk
2025-09-08 14:17 ` [PATCH v2 3/7] net/ntnic: migrate statistic " Serhii Iliushyk
2025-09-08 14:17 ` [PATCH v2 4/7] net/ntnic: migrate port event " Serhii Iliushyk
2025-09-08 14:17 ` [PATCH v2 5/7] net/ntnic: migrate adapter mon " Serhii Iliushyk
2025-09-08 14:17 ` [PATCH v2 6/7] net/ntnic: add warning about service cores Serhii Iliushyk
2025-09-08 14:17 ` [PATCH v2 7/7] net/ntnic: cleanup using pthreads and rte_thread Serhii Iliushyk
2025-09-08 20:08 ` [PATCH v1 0/7] migrate threads to DPDK service framework Stephen Hemminger
2025-09-10 12:13 ` Serhii Iliushyk
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=VE1P190MB08305B788F9E11C757A19CFB8015A@VE1P190MB0830.EURP190.PROD.OUTLOOK.COM \
--to=sil-plv@napatech.com \
--cc=ckm@napatech.com \
--cc=dev@dpdk.org \
--cc=mko-plv@napatech.com \
--cc=stephen@networkplumber.org \
/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).