<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Hi Stephen,<br>
    </p>
    <div class="moz-cite-prefix">On 15/10/2024 23:29, Stephen Hemminger
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20241015152945.530926a1@hermes.local">
      <pre class="moz-quote-pre" wrap="">On Fri, 11 Oct 2024 18:17:00 +0000
Vladimir Medvedkin <a class="moz-txt-link-rfc2396E" href="mailto:vladimir.medvedkin@intel.com"><vladimir.medvedkin@intel.com></a> wrote:

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">+
+uint32_t
+rte_thash_get_rand_poly(uint32_t poly_degree)
+{
+       uint32_t ret_poly;
+
+       if (poly_degree > 32)
+               return 0;
+
+       do
+               ret_poly = __thash_get_rand_poly(poly_degree);
+       while (thash_test_poly_order(ret_poly, poly_degree));
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Unbounded loop adds some risk, should there be an upper limit on retries.</pre>
    </blockquote>
    <p><span class="EzKURWReUAB5oZgtQNkl" data-src-align="0:3" style="white-space: pre-wrap;">This</span><span style="white-space: pre-wrap;"> is the </span><span class="EzKURWReUAB5oZgtQNkl" data-src-align="4:13" style="white-space: pre-wrap;">probabilistic</span><span style="white-space: pre-wrap;"> </span><span class="EzKURWReUAB5oZgtQNkl" data-src-align="18:5" style="white-space: pre-wrap;">part</span><span style="white-space: pre-wrap;"> of the </span><span class="EzKURWReUAB5oZgtQNkl" data-src-align="24:9" style="white-space: pre-wrap;">algorithm</span><span class="EzKURWReUAB5oZgtQNkl" data-src-align="33:1" style="white-space: pre-wrap;">.</span><span style="white-space: pre-wrap;"> </span></p>
    <p> __thash_get_rand_poly() returns a random polynomial that either
      satisfies the order criteria (element <x> of the field must
      generate multiplicative subgroup of order not less than some
      number), or not. The probability that it does not meet this
      criteria is strictly less than 1. Thus, with each attempt, the
      probability of not finding suitable polynomial exponentially tends
      to zero.<br>
    </p>
    <blockquote type="cite" cite="mid:20241015152945.530926a1@hermes.local">
      <pre class="moz-quote-pre" wrap="">

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">+
+       return ret_poly;
+}
diff --git a/lib/hash/version.map b/lib/hash/version.map
index 4f13f1d5aa..7ce6ab1121 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -61,4 +61,5 @@ INTERNAL {
 
        rte_thash_gfni_stub;
        rte_thash_gfni_bulk_stub;
+       rte_thash_get_rand_poly;
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Why does this function need to be moved to its own file?
Only used in one place in rte_thash.c.</pre>
    </blockquote>
    It was done just for convenience. If you insist, I'll move it to
    rte_thash.c<br>
    <blockquote type="cite" cite="mid:20241015152945.530926a1@hermes.local">
      <pre class="moz-quote-pre" wrap="">
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Regards,
Vladimir</pre>
  </body>
</html>