<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=Windows-1252">
<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:Aptos;
        panose-1:2 11 0 4 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;}
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:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="FR-BE" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt">Hi all,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt">As Ivan mentioned, this is exactly what we did in RSS++.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt">For the concern about RSS reprogramming in « live », it depends on the NIC. I remember the Intel card we used could use the “global” API just fine. For the Mellanox cards we had to use the rte_flow
 RSS action as reprogramming the global RETA table would lead to a (partial ?) device restart and would lead to the loss of many packets.
</span><span style="font-size:12.0pt">We had to play with priority and prefixes, but<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">rte_flow and mlx5 support has evolved since then, it might be a bit simpler, just using priorities and groups maybe.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt">The biggest challenge was the state, as written in the paper. We ended up with using the rte_flow rules anyway so we can use an epoch “mark” action that marks the version of the distribution table
 and allow an efficient passing of the state of flows going from one core to another.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt">The code of RSS++ is still coupled a bit to FastClick, but it was mostly separated already here :
<a href="https://github.com/tbarbette/fastclick/tree/main/vendor/nicscheduler">https://github.com/tbarbette/fastclick/tree/main/vendor/nicscheduler</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt">We also had a version for the Linux Kernel with XDP for counting.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt">We can chat about that if you want.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt">NB : my address has changed, I’m not at kth anymore.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt">Tom<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="NL" style="font-size:12.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<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 lang="NL" style="font-size:12.0pt;color:black">De :
</span></b><span lang="NL" style="font-size:12.0pt;color:black">Stephen Hemminger <stephen@networkplumber.org><br>
<b>Date : </b>mardi, 15 juillet 2025 ŕ 23:40<br>
<b>Ŕ : </b>Scott Wasson <swasson@microsoft.com><br>
<b>Cc : </b>users@dpdk.org <users@dpdk.org><br>
<b>Objet : </b>Re: rte_eth_dev_rss_reta_update() locking considerations?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="NL" style="font-size:11.0pt">On Tue, 15 Jul 2025 16:15:22 +0000<br>
Scott Wasson <swasson@microsoft.com> wrote:<br>
<br>
> Hi,<br>
> <br>
> We're using multiqueue, and RSS doesn't always balance the load very well.  I had a clever idea to periodically measure the load distribution (cpu load on the IO cores)  in the background pthread, and use rte_eth_dev_rss_reta_update() to adjust the redirection
 table dynamically if the imbalance exceeds a given threshold.  In practice it seems to work nicely.   But I'm concerned about:<br>
> <br>
> </span><a href="https://doc.dpdk.org/api/rte__ethdev_8h.html#a3c1540852c9cf1e576a883902c2e310d"><span lang="NL" style="font-size:11.0pt">https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fapi%2Frte__ethdev_8h.html%23a3c1540852c9cf1e576a883902c2e310d&data=05%7C02%7Ctom.barbette%40uclouvain.be%7Cebeee334aef74a19446308ddc3e83545%7C7ab090d4fa2e4ecfbc7c4127b4d582ec%7C1%7C0%7C638882124267510617%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=BopyVlMOW0CGCdLDk9Q%2BLf87r81NOzCG%2Bv4w4rMezDI%3D&reserved=0</span></a><span lang="NL" style="font-size:11.0pt"><br>
> <br>
> Which states:<br>
> <br>
> By default, all the functions of the Ethernet Device API exported by a PMD are lock-free functions which assume to not be invoked in parallel on different logical cores to work on the same target object. For instance, the receive function of a PMD cannot
 be invoked in parallel on two logical cores to poll the same Rx queue [of the same port].
</span><span style="font-size:11.0pt">Of course, this function can be invoked in parallel by different logical cores on different Rx queues. It is the responsibility of the upper level application to enforce this rule.<br>
</span><span lang="NL" style="font-size:11.0pt">> <br>
> In this context, what is the "target object"?  The queue_id of the port?  Or the port itself?  Would I need to add port-level spinlocks around every invocation of rte_eth_dev_*()?  That's a hard no, it would destroy performance.<br>
> <br>
> Alternatively, if I were to periodically call rte_eth_dev_rss_reta_update() from the IO cores instead of the background core, as the above paragraph suggests, that doesn't seem correct either. 
</span><span style="font-size:11.0pt">The function takes a reta_conf[] array that affects all RETA entries for that port and maps them to a queue_id.  Is it safe to remap RETA entries for a given port on one IO core while another IO core is potentially reading
 from its rx queue for that same port?  </span><span lang="NL" style="font-size:11.0pt">That problem seems not much different from remapping in the background core as I am now.<br>
</span><span style="font-size:11.0pt">> <br>
> I'm starting to suspect this function was intended to be initialized once on startup before rte_eth_dev_start(), and/or the ports must be stopped before calling it.  If that's the case, then I'll call this idea too clever by half and give it up now.<br>
> <br>
> Thanks in advance for your help!<br>
> <br>
> -Scott<br>
> <br>
<br>
There is no locking in driver path for control.<br>
It is expected that application will manage access to control path (RSS being one example)<br>
so that only one thread modifies the PMD.<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>