<html xmlns:v="urn:schemas-microsoft-com:vml" 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=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@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;}
@font-face
{font-family:"Aptos Mono";
panose-1:2 11 0 9 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:10.0pt;
font-family:"Aptos",sans-serif;}
p.elementtoproof, li.elementtoproof, div.elementtoproof
{mso-style-name:elementtoproof;
margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.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;}
/* List Definitions */
@list l0
{mso-list-id:1921286126;
mso-list-template-ids:1086197678;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="en-DE" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Hello Gregory,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thanks for suggesting the workaround. Looking forward to the investigation result and the fix.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Tao<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">Gregory Etelson <getelson@nvidia.com><br>
<b>Date: </b>Wednesday, 20. March 2024 at 17:36<br>
<b>To: </b>Tao Li <byteocean@hotmail.com>, Suanming Mou <suanmingm@nvidia.com>, guvenc.gulce@gmail.com <guvenc.gulce@gmail.com>, users@dpdk.org <users@dpdk.org><br>
<b>Subject: </b>Re: mlx5: rte_flow template/async API raw_encap validation bug ?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">Hello Tao,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">I reproduced the PMD crash you've described.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">We'll investigate it and will issue a fix shortly.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">In the meanwhile, I can suggest a workaround.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;color:black">Please consider creating actions template with the fully masked RAW_ENCAP action.<br>
The fully masked RAW_ENCAP provides data and size parameters in the action description and sets non-zero values in the action mask configuration.<br>
Testpmd commands are:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Aptos Mono";color:black">dpdk-testpmd -a $PCI,dv_flow_en=2,representor=vf\[0-1\] -- -i<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Aptos Mono";color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Aptos Mono";color:black">port stop all<o:p></o:p></span></p>
</div>
<p style="white-space:pre-wrap"><span style="font-family:"Aptos Mono";color:black">flow configure 0 queues_number 4 queues_size 64</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p style="white-space:pre-wrap"><span style="font-family:"Aptos Mono";color:black">flow configure 1 queues_number 4 queues_size 64</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p style="white-space:pre-wrap"><span style="font-family:"Aptos Mono";color:black">flow configure 2 queues_number 4 queues_size 64</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p style="white-space:pre-wrap"><span style="font-family:"Aptos Mono";color:black">port start all</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p style="white-space:pre-wrap"><span style="font-family:"Aptos Mono";color:black">set verbose 1</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p style="white-space:pre-wrap"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p style="white-space:pre-wrap"><span style="font-family:"Aptos Mono";color:black">set raw_decap 0 eth / ipv6 / end_set</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p style="white-space:pre-wrap"><span style="font-family:"Aptos Mono";color:black">set raw_encap 0 eth src is 11:22:33:44:55:66 dst is aa:bb:cc:dd:ee:aa type is 0x0800 has_vlan is 0 / end_set</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p style="white-space:pre-wrap"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p style="white-space:pre-wrap"><span style="font-family:"Aptos Mono";color:black">flow actions_template 0 create transfer actions_template_id 1 template raw_decap / raw_encap index 0 / represented_port / end mask raw_decap / raw_encap index 0 / represented_port
/ end</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p style="white-space:pre-wrap"><span style="font-family:"Aptos Mono";color:black">flow pattern_template 0 create transfer pattern_template_id 1 template eth / ipv6 / end</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="elementtoproof" style="white-space:pre-wrap"><span style="font-size:10.0pt;font-family:"Aptos Mono";color:black">flow template_table 0 create transfer table_id 1 group 0 priority 0 rules_number 1 pattern_template 1 actions_template 1</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">Regards,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">Gregory<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt">
<hr size="0" width="100%" align="center">
</span></div>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Tao Li <byteocean@hotmail.com><br>
<b>Sent:</b> Wednesday, March 20, 2024 17:19<br>
<b>To:</b> Gregory Etelson <getelson@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; guvenc.gulce@gmail.com <guvenc.gulce@gmail.com>; users@dpdk.org <users@dpdk.org><br>
<b>Subject:</b> Re: mlx5: rte_flow template/async API raw_encap validation bug ?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"> <o:p></o:p></span></p>
</div>
<table class="MsoNormalTable" border="0" cellpadding="0" style="background:#FFEB9C">
<tbody>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><b><span style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:black">External email: Use caution opening links or attachments</span></b><span style="font-size:12.0pt"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p><span style="font-size:12.0pt;color:black">Hello Gregory,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p style="margin-bottom:12.0pt"><span style="font-size:12.0pt;color:black">I am the colleague from Guevenc. Thanks a lot for providing detailed explaination, and we appreciate your support very much.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">The guidance on the usage of the RAW_ENCAP mask is adopted and experimented, which currently leads to the segmentation fault in our setup. The example code used to create the action template and table template is
as following:</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><b><span style="font-family:"Calibri",sans-serif"><Code Excerpt></span></b><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> // first action template</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> struct rte_flow_action_raw_decap decap_action = {.size = (sizeof(struct rte_ether_hdr)+sizeof(struct rte_ipv6_hdr))}; // remove IPinIP packet’s header</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> struct rte_flow_action_raw_encap encap_action = {.data = NULL, .size = sizeof(struct rte_ether_hdr)}; // add ether header for VMs</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> struct rte_flow_action act[] = {</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> [0] = {.type = RTE_FLOW_ACTION_TYPE_RAW_DECAP, .conf = &decap_action}, //?</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> [1] = {.type = RTE_FLOW_ACTION_TYPE_RAW_ENCAP, .conf = &encap_action}, //?</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> [2] = {.type = RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,},</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> [3] = {.type = RTE_FLOW_ACTION_TYPE_END,},</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> };</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> struct rte_flow_action msk[] = {</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> [0] = {.type = RTE_FLOW_ACTION_TYPE_RAW_DECAP, .conf= &decap_action},</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> [1] = {.type = RTE_FLOW_ACTION_TYPE_RAW_ENCAP, .conf= &encap_action},</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> [2] = {.type = RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,},</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> [3] = {.type = RTE_FLOW_ACTION_TYPE_END,},</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> };</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> port_template_info_pf.actions_templates[0] = create_actions_template(main_eswitch_port, act, msk);</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> // create template table</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> port_template_info_pf.template_table = create_table_template(main_eswitch_port, &table_attr_pf,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> (struct rte_flow_pattern_template **)&port_template_info_pf.pattern_templates, MAX_NR_OF_PATTERN_TEMPLATE,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> (struct rte_flow_actions_template **)&port_template_info_pf.actions_templates, MAX_NR_OF_ACTION_TEMPLATE);</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><b><span style="font-family:"Calibri",sans-serif"></Code Excerpt></span></b><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt;font-family:"Calibri",sans-serif">Using gdb, the following segfault trace is captured:</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span></b><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><b><span style="font-family:"Calibri",sans-serif"><Trace Excerpt></span></b><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">#0 0x00005555579bfb62 in mlx5dr_action_prepare_decap_l3_data (src=0x0, dst=0x7fffffffb3cc "", num_of_actions=6) at ../drivers/net/mlx5/hws/mlx5dr_action.c:2774</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">#1 0x00005555579c2136 in mlx5dr_action_handle_tunnel_l3_to_l2 (action=0x55555f089dc0, num_of_hdrs=1 '\001', hdrs=0x7fffffffb720, log_bulk_sz=1) at ../drivers/net/mlx5/hws/mlx5dr_action.c:1468</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">#2 0x00005555579bd56f in mlx5dr_action_create_reformat_hws (action=0x55555f089dc0, num_of_hdrs=1 '\001', hdrs=0x7fffffffb720, bulk_size=1) at ../drivers/net/mlx5/hws/mlx5dr_action.c:1537</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">#3 0x00005555579bd0eb in mlx5dr_action_create_reformat (ctx=0x55555e756b40, reformat_type=MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2, num_of_hdrs=1 '\001', hdrs=0x7fffffffb720, log_bulk_size=1, flags=32) at ../drivers/net/mlx5/hws/mlx5dr_action.c:1594</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">#4 0x0000555557927826 in mlx5_tbl_multi_pattern_process (dev=0x555559167300 <rte_eth_devices>, tbl=0x17fdd1280, mpat=0x7fffffffb9c8, error=0x7fffffffd050) at ../drivers/net/mlx5/mlx5_flow_hw.c:4146</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">#5 0x000055555795f133 in mlx5_hw_build_template_table (dev=0x555559167300 <rte_eth_devices>, nb_action_templates=1 '\001', action_templates=0x555558dc1830 <port_template_info_pf+16>, at=0x7fffffffcf00, tbl=0x17fdd1280,
error=0x7fffffffd050)</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> at ../drivers/net/mlx5/mlx5_flow_hw.c:4235</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">#6 0x00005555579022d3 in flow_hw_table_create (dev=0x555559167300 <rte_eth_devices>, table_cfg=0x7fffffffdec8, item_templates=0x555558dc1828 <port_template_info_pf+8>, nb_item_templates=1 '\001',</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> action_templates=0x555558dc1830 <port_template_info_pf+16>, nb_action_templates=1 '\001', error=0x7fffffffe0f8) at ../drivers/net/mlx5/mlx5_flow_hw.c:4401</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">#7 0x00005555577f89ec in flow_hw_template_table_create (dev=0x555559167300 <rte_eth_devices>, attr=0x5555589cc1e4 <table_attr_pf>, item_templates=0x555558dc1828 <port_template_info_pf+8>, nb_item_templates=1
'\001',</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> action_templates=0x555558dc1830 <port_template_info_pf+16>, nb_action_templates=1 '\001', error=0x7fffffffe0f8) at ../drivers/net/mlx5/mlx5_flow_hw.c:4589</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">#8 0x0000555556ca21e8 in mlx5_flow_table_create (dev=0x555559167300 <rte_eth_devices>, attr=0x5555589cc1e4 <table_attr_pf>, item_templates=0x555558dc1828 <port_template_info_pf+8>, nb_item_templates=1 '\001',</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> action_templates=0x555558dc1830 <port_template_info_pf+16>, nb_action_templates=1 '\001', error=0x7fffffffe0f8) at ../drivers/net/mlx5/mlx5_flow.c:9357</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">#9 0x0000555555c07c9a in rte_flow_template_table_create (port_id=0, table_attr=0x5555589cc1e4 <table_attr_pf>, pattern_templates=0x555558dc1828 <port_template_info_pf+8>, nb_pattern_templates=1 '\001',</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> actions_templates=0x555558dc1830 <port_template_info_pf+16>, nb_actions_templates=1 '\001', error=0x7fffffffe0f8) at ../lib/ethdev/rte_flow.c:1928</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><b><span style="font-family:"Calibri",sans-serif"></Trace Excerpt></span></b><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">Any comment or suggestions on this issue would be appreciated. Thanks in advance.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">Best regards,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">Tao Li</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt">
<hr size="0" width="100%" align="center">
</span></div>
<p><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Gregory Etelson <getelson@nvidia.com><br>
<b>Sent:</b> 19 March 2024 14:25<br>
<b>To:</b> Suanming Mou <suanmingm@nvidia.com>; Guvenc Gulce <guvenc.gulce@gmail.com>; users@dpdk.org <users@dpdk.org><br>
<b>Cc:</b> Ori Kam <orika@nvidia.com>; Maayan Kashani <mkashani@nvidia.com><br>
<b>Subject:</b> Re: mlx5: rte_flow template/async API raw_encap validation bug ?</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt"> <o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black">Hello Guvenc,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p style="margin-bottom:12.0pt"><span style="font-size:11.0pt;color:black">Flow actions in MLX5 PMD actions template are translated according to these general rules:</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<ol style="margin-top:0cm" start="1" type="1">
<li class="MsoNormal" style="color:black;margin-bottom:12.0pt;mso-list:l0 level1 lfo1">
<span style="font-size:11.0pt">If flow action configuration in template mask was not NULL, PMD constructs the action according<br>
to the action configuration parameters.<br>
PMD will use that pre-build action during async flow creation.<br>
The action parameters cannot be changed during async flow creation.</span><span style="font-size:12.0pt"><o:p></o:p></span></li><li class="MsoNormal" style="color:black;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt">If flow action configuration in template mask was NULL, PMD ignores the action configuration in the template.<br>
The action will be constructed according to configuration data provided during async flow creation.</span><span style="font-size:12.0pt"><o:p></o:p></span></li></ol>
<p><span style="font-size:11.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black">Before patch 2e543b6f18a2 ("net/mlx5: reuse reformat and modify actions in a table")<br>
the PMD ignored the RAW_ENCAP NULL mask configuration and used the action configuration for construction.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black;background:white">2e543b6f18a2</span><span style="font-size:11.0pt;color:black"> does not allow access to RAW_ENCAP configuration if the action did not provide correct mask.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black">If flow action configuration has several parameters, the action template can be partially translated -<br>
some action parameters will be provided with the template and other with async flow.<br>
In that case, if the action mask parameter has any non-zero value, it's configuration parameter will be used in a template.<br>
If the action mask parameter is 0, that parameter value will be provided during async flow.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black">Partial action translation used for pre-defined flow actions. </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black">MLX5 PMD requires the `size` parameter of the RAW_ENCAP action during the template action translation.<br>
The action data can be provided ether with the template action configuration or with async flow.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black">Therefore, the RAW_ENCAP template configuration can be fully masked with the action size and data or partially masked with size only.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black">Regards,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black">Gregory</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;color:black"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt">
<hr size="0" width="100%" align="center">
</span></div>
<p><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Suanming Mou <suanmingm@nvidia.com><br>
<b>Sent:</b> Tuesday, March 19, 2024 02:24<br>
<b>To:</b> Guvenc Gulce <guvenc.gulce@gmail.com>; users@dpdk.org <users@dpdk.org>; Gregory Etelson <getelson@nvidia.com><br>
<b>Cc:</b> Ori Kam <orika@nvidia.com>; Maayan Kashani <mkashani@nvidia.com><br>
<b>Subject:</b> RE: mlx5: rte_flow template/async API raw_encap validation bug ?</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt"> <o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Hi Guvenc,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Guvenc Gulce <guvenc.gulce@gmail.com><br>
<b>Sent:</b> Monday, March 18, 2024 6:26 PM<br>
<b>To:</b> users@dpdk.org<br>
<b>Cc:</b> Suanming Mou <suanmingm@nvidia.com>; Ori Kam <orika@nvidia.com><br>
<b>Subject:</b> mlx5: rte_flow template/async API raw_encap validation bug ?</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Hi all,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">It is great that we have rte_flow async/template api integrated to mlx5 </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">driver code and it is being established as the new standard rte_flow API.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">I have the following raw_encap problem when using the rte_flow async/template API </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">with mlx5 driver:</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">- raw_encap rte_flow action template fails during validation when the action mask</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">conf is NULL but this clearly contradicts the explanation from Suanming Mou's </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">commit 7f6daa490d9 which clearly states that the raw encap action mask is allowed </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">to be NULL.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><Excerpt from commit 7f6daa490d9></span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> 2. RAW encap (encap_data: raw) </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> action conf (raw_data) </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> a. action mask conf (not NULL) </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> - encap_data constant. </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> b. action mask conf (NULL) </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> - encap_data will change.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"></Excerpt from commit 7f6daa490d9></span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Commenting out the raw_encap validation would make it possible to create</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">rte_flow template with null mask conf which can be concretized later on. </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Things seem to work after relaxing the rte_flow raw_encap validation.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">The change would look like:</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">[Suanming] I guess maybe it is due to the raw_encap and raw_decap combination. I added Gregory who added that code maybe can explain it better.
<a id="OWAAMD01DCBAEF9F84ED9BA95BE5AFA046ABA" href="mailto:getelson@nvidia.com"><span style="font-family:"Calibri",sans-serif;text-decoration:none">@Gregory Etelson</span></a></span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><Excerpt></span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">index 35f1ed7a03..3f57fd9286 100644</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">--- a/drivers/net/mlx5/mlx5_flow_hw.c</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">+++ b/drivers/net/mlx5/mlx5_flow_hw.c</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">@@ -6020,10 +6020,10 @@ flow_hw_validate_action_raw_encap(const struct rte_flow_action *action,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> const struct rte_flow_action_raw_encap *mask_conf = mask->conf;</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> const struct rte_flow_action_raw_encap *action_conf = action->conf;</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">- if (!mask_conf || !mask_conf->size)</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">+/* if (!mask_conf || !mask_conf->size)</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> return rte_flow_error_set(error, EINVAL,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> RTE_FLOW_ERROR_TYPE_ACTION, mask,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">- "raw_encap: size must be masked");</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">+ "raw_encap: size must be masked"); */</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> if (!action_conf || !action_conf->size)</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> return rte_flow_error_set(error, EINVAL,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> RTE_FLOW_ERROR_TYPE_ACTION, action,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"></Excerpt></span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">But this can not be the proper solution. Please advise a solution how to make the </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">raw_encap work with rte_flow template/async API. If relaxing the validation is ok, I can </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">also prepare and send a patch.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Thanks in advance,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Guvenc Gulce</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>