<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Aptos;
        panose-1:2 11 0 4 2 2 2 2 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:10.0pt;
        font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="en-DE" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Hi Dariusz,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Thanks for your speedy reply and provided hints. I am able to capture matched packets on one PF for the DPDK application by installing the following async rules based on your suggestions.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.5pt"><Command to install QUEUE action><o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:10.5pt">port stop all</span><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow configure 0 queues_number 1 queues_size 10 counters_number 0 aging_counters_number 0 meters_number 0 flags 0</span><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow configure 1 queues_number 1 queues_size 10 counters_number 0 aging_counters_number 0 meters_number 0 flags 0</span><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow configure 2 queues_number 1 queues_size 10 counters_number 0 aging_counters_number 0 meters_number 0 flags 0</span><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow configure 3 queues_number 1 queues_size 10 counters_number 0 aging_counters_number 0 meters_number 0 flags 0</span><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">port start all<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow pattern_template 0 create
<b>ingress</b> relaxed no pattern_template_id 10  template  eth type is 0x86dd  / end</span><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow actions_template 0 create
<b>ingress</b>  actions_template_id 10  template queue / end mask queue index 0xffff / end</span><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow template_table 0 create group 0  priority 0 
<b>ingress</b>  table_id 5 rules_number 8 pattern_template 10 actions_template 10</span><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow queue 0 create 0 template_table 5 pattern_template 0 actions_template 0 postpone no pattern  eth type is 0x86dd  / end actions queue index 0 / end<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt">flow push 0 queue 0<o:p></o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.5pt"></Command to install QUEUE action><o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">In our application, once the DPDK application processes the captured packets, it may need to install additional flow rules to perform decap/encap/port actions to deliver packets from PFs to VFs. These dynamically
 installed flow rules might look like those shown below, which you may have seen in my previous emails.</span><span lang="EN-US" style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.5pt"><Command to install finer matching and port action rule><o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow pattern_template 0 create
<b>transfer</b> relaxed no pattern_template_id 20  template represented_port ethdev_port_id is 0 / eth type is 0x86dd / ipv6 dst is
</span><span style="font-size:10.5pt;color:black">ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff </span><span style="font-size:10.5pt">/ end</span><span style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">set raw_decap 0 eth  / ipv6 / end_set<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">set raw_encap 0 eth src is 11:22:33:44:55:66 dst is 66:9d:a7:fd:fb:43 type is 0x0800 / end_set<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow actions_template 0 create
<b>transfer</b>  actions_template_id 20  template raw_decap index 0 / raw_encap index 0 / represented_port / end mask raw_decap index 0 / raw_encap index 0 /  represented_port  / end<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow template_table 0 create  group 0 priority 0 
<b>transfer</b> wire_orig table_id 6 rules_number 8 pattern_template 20 actions_template 20<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt">flow queue 0 create 0 template_table 6 pattern_template 0 actions_template 0 postpone no pattern represented_port ethdev_port_id is 0 / eth type is 0x86dd / ipv6 dst is
</span><span lang="EN-US" style="font-size:10.5pt">abcd</span><span style="font-size:10.5pt">:</span><span lang="EN-US" style="font-size:10.5pt">efgh</span><span style="font-size:10.5pt">:</span><span lang="EN-US" style="font-size:10.5pt">1234</span><span style="font-size:10.5pt">:</span><span lang="EN-US" style="font-size:10.5pt">5678</span><span style="font-size:10.5pt">:0:1:0:1 
 / end actions raw_decap index 0 / raw_encap index 0 /  represented_port ethdev_port_id 3 / end<o:p></o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.5pt"></Command to install finer matching and port action rule><o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">In the synchronous installation approach, we achieved our goal by installing these flow rules with finer granularity matching patterns, similar to the above, into the same table as the QUEUE action
 rules. As you pointed out, it is not intended to support QUEUE and RSS actions on transfer flow tables in async mode. Installing these decap/encap/port action rules in the same table is not viable due to the ingress attribute of the table. Jumping between
 ingress and transfer tables is also not an option since they are not within the same eswitch domain.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">To summarize the demands,  we need to capture a portion of packets for the DPDK application while performing decap/encap/port actions on other portions of packets on the same interface. Could
 you provide additional hints on how to address this use case? Thanks in advance.</span><span lang="EN-US" style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Tao Li</span><span lang="EN-US" style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Dariusz Sosnowski <dsosnowski@nvidia.com><br>
<b>Date: </b>Wednesday, 12. June 2024 at 18:08<br>
<b>To: </b>Tao Li <byteocean@hotmail.com>, users@dpdk.org <users@dpdk.org><br>
<b>Cc: </b>tao.li06@sap.com <tao.li06@sap.com><br>
<b>Subject: </b>RE: Failed to install QUEUE action using async API on ConnectX-6 NIC<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><br>
Hi,<br>
<br>
> From: Tao Li <byteocean@hotmail.com> <br>
> Sent: Wednesday, June 12, 2024 16:45<br>
> To: users@dpdk.org<br>
> Cc: tao.li06@sap.com<br>
> Subject: Failed to install QUEUE action using async API on ConnectX-6 NIC<br>
> <br>
> Hi all,<br>
> <br>
> I am using the async API to install flow rules to perform the QUEUE action to capture packets matching a certain pattern for processing by a DPDK application. The ConnectX-6 NIC is configured in multiport e-switch mode, as outlined in the documentation (</span><a href="https://doc.dpdk.org/guides/nics/mlx5.html#multiport-e-switch"><span style="font-size:11.0pt">https://doc.dpdk.org/guides/nics/mlx5.html#multiport-e-switch</span></a><span style="font-size:11.0pt">).
 Currently, I am facing an issue where I cannot create the corresponding templates for this purpose. The command to start test-pmd and create pattern and action templates are as follows:<br>
> <br>
> <Command to start test-pmd><br>
> sudo ./dpdk-testpmd -a 3b:00.0,dv_flow_en=2,representor=pf0-1vf0 -- -i --rxq=1 --txq=1 --flow-isolate-all<br>
> </Command to start test-pmd><br>
> <br>
> <Not working test-pmd commands><br>
> port stop all<br>
> flow configure 0 queues_number 1 queues_size 10 counters_number 0 aging_counters_number 0 meters_number 0 flags 0<br>
> flow configure 1 queues_number 1 queues_size 10 counters_number 0 aging_counters_number 0 meters_number 0 flags 0<br>
> flow configure 2 queues_number 1 queues_size 10 counters_number 0 aging_counters_number 0 meters_number 0 flags 0<br>
> flow configure 3 queues_number 1 queues_size 10 counters_number 0 aging_counters_number 0 meters_number 0 flags 0<br>
> port start all<br>
> <br>
> flow pattern_template 0 create transfer relaxed no pattern_template_id 10  template represented_port ethdev_port_id is 0 / eth type is 0x86dd  / end<br>
> flow actions_template 0 create ingress  actions_template_id 10  template queue / end mask queue index 0xffff / end<br>
> flow template_table 0 create  group 0 priority 0  transfer wire_orig table_id 5 rules_number 8 pattern_template 10 actions_template 10<br>
> flow queue 0 create 0 template_table 5 pattern_template 0 actions_template 0 postpone no pattern represented_port ethdev_port_id is 0 / eth type is 0x86dd  / end actions queue index 0 / end<br>
> flow push 0 queue 0<br>
> </Not working test-pmd commands><br>
> <br>
> The error encountered during the execution of the above test-pmd commands is:<br>
> <br>
> <Encounted error><br>
> mlx5_net: [mlx5dr_action_print_combo]: Invalid action_type sequence<br>
> mlx5_net: [mlx5dr_action_print_combo]: TIR<br>
> mlx5_net: [mlx5dr_matcher_check_and_process_at]: Invalid combination in action template<br>
> mlx5_net: [mlx5dr_matcher_bind_at]: Invalid at 0<br>
> </Encounted error><br>
> <br>
> Upon closer inspection of the driver code in DPDK 23.11 (also  the latest DPDK main branch), it appears that the error is due to the fact that MLX5DR_ACTION_TYP_TIR is not listed as a valid action in the MLX5DR_TABLE_TYPE_FDB field. If the following patch
 is applied, the error is resolved, and the DPDK application is able to capture matching packets:<br>
> <br>
> <patch to apply><br>
> diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c<br>
> index 862ee3e332..c444ec761e 100644<br>
> --- a/drivers/net/mlx5/hws/mlx5dr_action.c<br>
> +++ b/drivers/net/mlx5/hws/mlx5dr_action.c<br>
> @@ -85,6 +85,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_<br>
>                 BIT(MLX5DR_ACTION_TYP_VPORT) |<br>
>                 BIT(MLX5DR_ACTION_TYP_DROP) |<br>
>                 BIT(MLX5DR_ACTION_TYP_DEST_ROOT) |<br>
> +               BIT(MLX5DR_ACTION_TYP_TIR) |<br>
>                 BIT(MLX5DR_ACTION_TYP_DEST_ARRAY),<br>
>                 BIT(MLX5DR_ACTION_TYP_LAST),<br>
>         }, <br>
> </patch to apply><br>
> I would greatly appreciate it if anyone could provide insight into whether this behavior is intentional or if it is a bug in the driver. Many thanks in advance.<br>
<br>
The fact that it works with this code change is not an intended behavior and we do not support using QUEUE and RSS actions on transfer flow tables.<br>
<br>
Also, there's another issue with table and actions template attributes:<br>
<br>
- table is using transfer,<br>
- actions template is using ingress.<br>
<br>
Using them together is incorrect.<br>
In the upcoming DPDK release, we are adding additional validations which would guard against that.<br>
<br>
With your configuration, it is enough that you create an ingress flow table on port 0,<br>
which will contain a flow rule matching IPv6 traffic and forwarding it to a queue on port 0.<br>
<br>
By default, any traffic which is not explicitly dropped or forwarded in E-Switch, will be handled by ingress flow rules of the port on which this packet was received.<br>
Since you're running with flow isolation enabled, this means that traffic will go to kernel interface, unless you explicitly match it on ingress.<br>
<br>
> <br>
> Best regards,<br>
> Tao<br>
<br>
Best regards,<br>
Dariusz Sosnowski<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>