<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 class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Hello Ferruh,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<blockquote style="margin-left: 0.8ex; padding-left: 1ex; border-left: 3px solid rgb(200, 200, 200);">
<div class="elementToProof"><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><i>As
a brainstorm, what do you think move hairpin related code to its own</i></span><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><i><br>
</i></span><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><i>file,
and have a kind of register logic to the commands, argument</i></span></div>
<div class="elementToProof"><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><i>parsing
and usage() functions etc.</i></span></div>
</blockquote>
<div class="elementToProof"><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">Please consider an option for the testpmd to dynamically add supported commands.</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">Testpmd can still provide some build-in core functionality, but custom test commands<br>
can be added and removed on demand.<br>
In addition, the custom command code does not have to be part of the testpmd.<br>
That will reduce maintanance.</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">Regards,</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">Gregory</span></div>
<div id="appendonsend"></div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display: inline-block; width: 98%;">
<div id="divRplyFwdMsg" dir="ltr"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> Ferruh Yigit <ferruh.yigit@amd.com><br>
<b>Sent:</b> Friday, March 1, 2024 20:54<br>
<b>To:</b> Gregory Etelson <getelson@nvidia.com>; dev@dpdk.org <dev@dpdk.org><br>
<b>Cc:</b> Maayan Kashani <mkashani@nvidia.com>; NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>; Aman Singh <aman.deep.singh@intel.com>; Yuying Zhang <yuying.zhang@intel.com>; David Marchand <david.marchand@redhat.com><br>
<b>Subject:</b> Re: [PATCH v3] testpmd: add hairpin-map parameter</span>
<div> </div>
</div>
<div><span style="font-size: 11pt;">External email: Use caution opening links or attachments<br>
<br>
<br>
On 9/28/2023 4:36 PM, Gregory Etelson wrote:<br>
> Hairpin offloads packet forwarding between ports.<br>
> Packet is expected on Rx port <rp>, Rx queue <rq> and is delivered<br>
> to Tx port <tp> Tx queue <tq>.<br>
><br>
> Testpmd implements a static hairpin configuration scheme.<br>
> The scheme implicitly matches next valid port for given <rp> or <tp>.<br>
> That approach can be used in a single or double port setups only.<br>
><br>
> The new parameter allows explicit selection of Rx and Tx ports and<br>
> queues in hairpin configuration.<br>
> The new `hairpin-map` parameter is provided with 5 parameters,<br>
> separated by `:`<br>
><br>
> `--hairpin-map=Rx port id:Rx queue:Tx port id:Tx queue:queues number`<br>
><br>
> Testpmd operator can provide several `hairpin-map` parameters for<br>
> different hairpin maps.<br>
> Example:<br>
><br>
> dpdk-testpmd <EAL params> -- \<br>
> <testpmd params> \<br>
> --rxq=2 --txq=2 --hairpinq=2 --hairpin-mode=0x12 \<br>
> --hairpin-map=0:2:1:2:1 \ # [1]<br>
> --hairpin-map=0:3:2:2:3 # [2]<br>
><br>
> Hairpin map [1] binds Rx port 0, queue 2 with Tx port 1, queue 2.<br>
> Hairpin map [2] binds<br>
> Rx port 0, queue 3 with Tx port 2, queue 2,<br>
> Rx port 0, queue 4 with Tx port 2, queue 3,<br>
> Rx port 0, queue 5 with Tx port 2, queue 4.<br>
><br>
> The new `hairpin-map` parameter is optional.<br>
> If omitted, testpmd will create "default" hairpin maps.<br>
><br>
<br>
Hi Gregory,<br>
<br>
This patch is waiting for a while in the patchwork, not because there is<br>
a problem with the implementation, but I have a feeling that it is<br>
bloating the testpmd code with the hairpin feature which is not commonly<br>
supported, and I don't know what to do.<br>
<br>
Also there was no review on the code ...<br>
<br>
<br>
As a brainstorm, what do you think move hairpin related code to its own<br>
file, and have a kind of register logic to the commands, argument<br>
parsing and usage() functions etc.<br>
<br>
@David did something similar to move PMD specific testpmd code to the<br>
drivers [1].<br>
<br>
This can be initial steps for the more modular testpmd design and we can<br>
introduce more features with this approach in the future, I think<br>
hairpin support is a good instance to start this work, because of its<br>
limited impact to users.<br>
<br>
<br>
[1]<br>
Commit 592ab76f9f0f ("app/testpmd: register driver specific commands")<br>
Commit 94b3c1a72507 ("net/i40e: move testpmd commands")<br>
<br>
> Signed-off-by: Gregory Etelson <getelson@nvidia.com><br>
> ---<br>
> v2: Fix Windows Server 2019 compilation failure.<br>
> v3: Update the patch comment.<br>
> Fix typo.<br>
> ---<br>
> app/test-pmd/parameters.c | 63 ++++++++<br>
> app/test-pmd/testpmd.c | 212 ++++++++++++++++++--------<br>
> app/test-pmd/testpmd.h | 18 +++<br>
> doc/guides/testpmd_app_ug/run_app.rst | 3 +<br>
> 4 files changed, 230 insertions(+), 66 deletions(-)<br>
><br>
> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c<br>
> index a9ca58339d..c6bdfdf06f 100644<br>
> --- a/app/test-pmd/parameters.c<br>
> +++ b/app/test-pmd/parameters.c<br>
> @@ -206,6 +206,12 @@ usage(char* progname)<br>
> printf(" --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n"<br>
> " 0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n"<br>
> " 0x01 - hairpin ports loop, 0x00 - hairpin port self\n");<br>
> + printf(" --hairpin-map=rxpi:rxq:txpi:txq:n: hairpin map.\n"<br>
> + " rxpi - Rx port index.\n"<br>
> + " rxq - Rx queue.\n"<br>
> + " txpi - Tx port index.\n"<br>
> + " txq - Tx queue.\n"<br>
> + " n - hairpin queues number.\n");<br>
><br>
<br>
'rxpi' or 'port index' are not common usage in DPDK, what about<br>
'rx_port' & 'Rx port id' or similar?<br>
<br>
> }<br>
><br>
> #ifdef RTE_LIB_CMDLINE<br>
> @@ -588,6 +594,55 @@ parse_link_speed(int n)<br>
> return speed;<br>
> }<br>
><br>
> +static __rte_always_inline<br>
> +char *parse_hairpin_map_entry(char *input, char **next)<br>
> +{<br>
><br>
<br>
Why forcing this function to be inline, can make it static and left<br>
decision to compiler.<br>
<br>
<...><br>
<br>
> diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst<br>
> index 6e9c552e76..a202c98b4c 100644<br>
> --- a/doc/guides/testpmd_app_ug/run_app.rst<br>
> +++ b/doc/guides/testpmd_app_ug/run_app.rst<br>
> @@ -566,6 +566,9 @@ The command line options are:<br>
><br>
> The default value is 0. Hairpin will use single port mode and implicit Tx flow mode.<br>
><br>
> +* ``--hairpin-map=Rx port id:Rx queue:Tx port id:Tx queue:queues number``<br>
> +<br>
> + Set explicit hairpin configuration.<br>
><br>
<br>
What 'queues number' does is not intuitive, sample in the commit log<br>
makes it easier to understand.<br>
Can you please either explain or provide sample to clarify what "queues<br>
number" is for?<br>
<br>
</span></div>
</body>
</html>