<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 Guvenc,</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>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Flow actions in MLX5 PMD actions template are translated according to these general rules:<br>
<br>
</div>
<ol start="1" data-editing-info="{"orderedStyleType":1,"unorderedStyleType":1}" data-listchain="__List_Chain_570" style="margin-top: 0px; margin-bottom: 0px; list-style-type: decimal;">
<li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
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.<br>
<br>
</div>
</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
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.</div>
</li></ol>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
  </div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
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.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">2e543b6f18a2</span><span style="font-size: 11pt;"> does not allow access to RAW_ENCAP configuration if the action did not provide correct mask.</span></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>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
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.</div>
<div style="text-align: left; text-indent: 0px; margin: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="text-align: left; text-indent: 0px; margin: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Partial action translation used for pre-defined flow actions. </div>
<div class="elementToProof" style="text-align: left; text-indent: 0px; margin: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
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.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Therefore, the RAW_ENCAP template configuration can be fully masked with the action size and data or partially masked with size only.</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>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Regards,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Gregory</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>
<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 dir="ltr" id="divRplyFwdMsg"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> 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>
<div> </div>
</div>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">Hi Guvenc,</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<div style="padding: 0in 0in 0in 4pt; border-left: 1.5pt solid blue;">
<div style="padding: 3pt 0in 0in; border-top: 1pt solid rgb(225, 225, 225);">
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"><b>From:</b> 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 ?</p>
</div>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">Hi all,</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">It is great that we have rte_flow async/template api integrated to mlx5 </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">driver code and it is being established as the new standard rte_flow API.</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">I have the following raw_encap problem when using the rte_flow async/template API </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">with mlx5 driver:</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">- raw_encap rte_flow action template fails during validation when the action mask</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">conf is NULL but this clearly contradicts the explanation from Suanming Mou's </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">commit 7f6daa490d9 which clearly states that the raw encap action mask is allowed </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">to be NULL.</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"><Excerpt from commit 7f6daa490d9></p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">    2. RAW encap (encap_data: raw)     </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">            action conf (raw_data)                               </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">                                                                 </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">            a. action mask conf (not NULL)                 </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">              - encap_data constant.                             </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">            b. action mask conf (NULL)                                                                                            </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">              - encap_data will change.</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"></Excerpt from commit 7f6daa490d9></p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">Commenting out the raw_encap validation would make it possible to create</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">rte_flow template with null mask conf which can be concretized later on. </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">Things seem to work after relaxing the rte_flow raw_encap validation.</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">The change would look like:</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">[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 href="mailto:getelson@nvidia.com" id="OWAAMD01DCBAEF9F84ED9BA95BE5AFA046ABA" data-loopstyle="linkonly" style="margin-top: 0px; margin-bottom: 0px;">
@Gregory Etelson</a></p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"><Excerpt></p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">index 35f1ed7a03..3f57fd9286 100644</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">--- a/drivers/net/mlx5/mlx5_flow_hw.c</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">+++ b/drivers/net/mlx5/mlx5_flow_hw.c</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">@@ -6020,10 +6020,10 @@ flow_hw_validate_action_raw_encap(const struct rte_flow_action *action,</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">        const struct rte_flow_action_raw_encap *mask_conf = mask->conf;</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">        const struct rte_flow_action_raw_encap *action_conf = action->conf;</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">-       if (!mask_conf || !mask_conf->size)</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">+/*     if (!mask_conf || !mask_conf->size)</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">                return rte_flow_error_set(error, EINVAL,</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">                                          RTE_FLOW_ERROR_TYPE_ACTION, mask,</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">-                                         "raw_encap: size must be masked");</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">+                                         "raw_encap: size must be masked"); */</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">        if (!action_conf || !action_conf->size)</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">                return rte_flow_error_set(error, EINVAL,</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">                                          RTE_FLOW_ERROR_TYPE_ACTION, action,</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"></Excerpt></p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">But this can not be the proper solution. Please advise a solution how to make the </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">raw_encap work with rte_flow template/async API. If relaxing the validation is ok, I can </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">also prepare and send a patch.</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">Thanks in advance,</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;"> </p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">Guvenc Gulce</p>
<p style="margin: 0in; font-family: Calibri, sans-serif; font-size: 11pt;">  </p>
</div>
</body>
</html>