<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div id="divRplyFwdMsg">
<div style="direction: ltr; font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<b>From:</b> Stephen Hemminger <stephen@networkplumber.org><br>
<b>Sent:</b> 13 September 2025 19:23<br>
<b>To:</b> Serhii Iliushyk <sil-plv@napatech.com><br>
<b>Cc:</b> dev@dpdk.org <dev@dpdk.org>; Mykola Kostenok <mko-plv@napatech.com>; Christian Koue Muf <ckm@napatech.com><br>
<b>Subject:</b> Re: [PATCH v2 1/7] net/ntnic: introduce service API for NTNIC PMD</div>
<div style="direction: ltr;"> </div>
</div>
<div style="font-size: 11pt;" class="elementToProof">On Mon, 8 Sep 2025 16:17:33 +0200<br>
Serhii Iliushyk <sil-plv@napatech.com> wrote:<br>
<br>
> diff --git a/doc/guides/nics/ntnic.rst b/doc/guides/nics/ntnic.rst<br>
> index b3d6ad70c1..a173eaa2ac 100644<br>
> --- a/doc/guides/nics/ntnic.rst<br>
> +++ b/doc/guides/nics/ntnic.rst<br>
> @@ -185,3 +185,115 @@ There are list of characteristics that age timeout action has:<br>
> - after flow is aged-out it's not automatically deleted;<br>
> - aged-out flow can be updated with ``flow update`` command,<br>
> and its aged-out status will be reverted;<br>
> +<br>
> +Service API<br>
> +-----------<br>
> +<br>
> +**nthw_service_add**<br>
> +**nthw_service_del**<br>
> +**nthw_service_get_info**<br>
> +<br>
> +The NTNIC PMD provides a service API that allows applications to configure services<br>
> +<br>
> +The services are responsible for handling the vital functionality of the NTNIC PMD:<br>
> +<br>
> +- **FLM Update**: is responsible for creating and destroying flows;<br>
> +- **Statistics**: is responsible for collecting statistics;<br>
> +- **Port event**: is responsible for handling port events: aging, port load, and flow load;<br>
> +- **Adapter monitor** is responsible for link control;<br>
> +<br>
> +**NOTE**: Use next EAL options to configure set service cores<br>
> + * -s SERVICE COREMASK Hexadecimal bitmask of cores to be used as service cores;<br>
> + * -S SERVICE CORELIST List of cores to run services on;<br>
> +<br>
> +**NOTE**: **At least 5 lcores must be reserved** for the ntnic services by EAL options. above.<br>
> +<br>
> +For example<br>
> +<br>
> +.. code-block:: console<br>
> +<br>
> + dpdk-testpmd -S 8,9,10,11,12<br>
> +<br>
> +The PMD registers each service during initialization by function:<br>
> +<br>
> +.. code-block:: c<br>
> +<br>
> + int nthw_service_add(struct rte_service_spec *srv_spec, const enum rte_ntnic_service_tag tag)<br>
> +<br>
> +and unregistered by the PMD during deinitialization by the function:<br>
> +<br>
> +.. code-block:: c<br>
> +<br>
> + int nthw_service_del(const enum rte_ntnic_service_tag tag)<br>
> +<br>
> +The service info may be retrieved by function:<br>
> +<br>
> +.. code-block:: c<br>
> +<br>
> + struct nt_service *nthw_service_get_info(const enum rte_ntnic_service_tag tag)<br>
> +<br>
> +The service info includes the service ID, assigned lcore, and initialization state.<br>
> +<br>
> +Service API for user applications<br>
> +---------------------------------<br>
> +**rte_pmd_ntnic_service_set_lcore**<br>
> +**rte_pmd_ntnic_service_get_id**<br>
> +<br>
> +The exported service API is available for applications to configure the services.<br>
> +<br>
> +By API function:<br>
> +<br>
> +.. code-block:: c<br>
> +<br>
> + int rte_pmd_ntnic_service_set_lcore(enum rte_ntnic_service_tag tag, uint32_t lcore_id)<br>
> +<br>
> +For example to assign lcores 8,9,10,11,12 to the services, the application can use:<br>
> +<br>
> +.. code-block:: c<br>
> +<br>
> + rte_pmd_ntnic_service_set_lcore(RTE_NTNIC_SERVICE_STAT, 8);<br>
> + rte_pmd_ntnic_service_set_lcore(RTE_NTNIC_SERVICE_ADAPTER_MON, 9);<br>
> + rte_pmd_ntnic_service_set_lcore(RTE_NTNIC_SERVICE_PORT_0_EVENT, 10);<br>
> + rte_pmd_ntnic_service_set_lcore(RTE_NTNIC_SERVICE_PORT_1_EVENT,11);<br>
> + rte_pmd_ntnic_service_set_lcore(RTE_NTNIC_SERVICE_FLM_UPDATE, 12);<br>
> +<br>
> +The API will automatically lcore to service core list and map the service to the lcore.<br>
> +<br>
> +.. note:: Use `rte_service_lcore_start` to start the lcore after mapping it to the service.<br>
> +<br>
> +Each service has its own tag to identify it.<br>
> +<br>
> +.. code-block:: c<br>
> +<br>
> + enum rte_ntnic_service_tag {<br>
> + RTE_NTNIC_SERVICE_FLM_UPDATE = 0,<br>
> + RTE_NTNIC_SERVICE_STAT = 1,<br>
> + RTE_NTNIC_SERVICE_PORT_0_EVENT = 2,<br>
> + RTE_NTNIC_SERVICE_PORT_1_EVENT = 3,<br>
> + RTE_NTNIC_SERVICE_ADAPTER_MON = 4,<br>
> + RTE_NTNIC_SERVICE_MAX<br>
> + };<br>
> +<br>
> +The application may use next API function to retrieve the service id:<br>
> +<br>
> +.. code-block:: c<br>
> +<br>
> + int rte_pmd_ntnic_service_get_id(enum rte_ntnic_service_tag tag);<br>
> +<br>
> +<br>
> +For example, to enable statistics for flm_update service, the application can use:<br>
> +<br>
> +.. code-block:: c<br>
> +<br>
> + int flm_update_id = rte_pmd_ntnic_service_get_id(RTE_NTNIC_SERVICE_FLM_UPDATE);<br>
> + rte_service_set_stats_enable(flm_update_id, 1);<br>
> +<br>
> +All other manipulations with the service can be done with the service ID and rte_service* API.<br>
> +<br>
> +To use the service API, an application must have included the header file:<br>
> +<br>
> +.. code-block:: c<br>
> +<br>
> + #include <rte_pmd_ntnic.h><br>
> +<br>
> +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.<br>
<br>
It is not clear what happens if application does not use the driver API?<br>
What happens "out of the box" with OVS and VPP?<br>
<br>
The fact that it requires special driver API's shows that there is a missing<br>
feature in the service lcore library. Should be able to do this stuff through that<br>
API. But that is not your problem, and doesn't need solving in this set.</div>
<div style="font-size: 11pt;" class="elementToProof"><br>
</div>
<div style="font-size: 11pt;" class="elementToProof"><br>
</div>
<div style="font-size: 11pt;" class="elementToProof"><br>
</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
Hi Stephen!</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
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.</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Only one option is required here (-S SERVICE CORELIST or -s SERVICE COREMASK).</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
If this option is passed, then the ntnic services will be started with the function rte_service_start_with_defaults <a class="OWAAutoLink" id="LPlnk880194" href="https://git.dpdk.org/dpdk/tree/lib/eal/linux/eal.c#n1259">https://git.dpdk.org/dpdk/tree/lib/eal/linux/eal.c#n1259</a> inside
of the rte_eal_init, since they are already registered after rte_bus_probe.</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
For OVS it is possible due to option dpdk_extra. </div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
For example: ovs-vsctl set Open_vSwitch . other_config:dpdk_extra="-S 8,9,10,11,12 ..."</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
On the other side, the VPP has a "whitelist" of the EAL options, as far as I understand.</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
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).</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
BR,</div>
<div style="font-family: Verdana, Geneva, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Serhii</div>
</body>
</html>