DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Robin Jarry" <rjarry@redhat.com>
To: "Ori Kam" <orika@nvidia.com>
Cc: <dev@dpdk.org>, "Kevin Traynor" <ktraynor@redhat.com>,
	"Christophe Fontaine" <cfontain@redhat.com>,
	"<dev@openvswitch.org>" <dev@openvswitch.org>
Subject: mlx5 rte_eth_dev_info.reta_size value
Date: Mon, 05 Dec 2022 16:57:00 +0100	[thread overview]
Message-ID: <CAN_Gwq+VAG=4MxmyYOkbCtZXaL1GRXWLgXZ4pR1jYz=kFuZ9TA@mail.gmail.com> (raw)

Hi Ori,

While working on a patch for OvS[1], I have tried to reconfigure the
redirection table using the code examples that are layout around in
testpmd and other places.

[1]: http://patchwork.ozlabs.org/project/openvswitch/patch/20221021145308.141933-1-rjarry@redhat.com/

Here is a stripped down version of the code I use:

 int update_reta(int port_id, int num_rxq)
 {
   struct rte_eth_rss_reta_entry64 *conf;
   struct rte_eth_dev_info info;
   size_t conf_size;
   int err;

   rte_eth_dev_info_get(port_id, &info);
   conf_size = (info.reta_size / RTE_ETH_RETA_GROUP_SIZE) * sizeof(*conf);
   conf = malloc(conf_size);
   memset(conf, 0, conf_size);

   for (uint16_t i = 0; i < info.reta_size; i++) {
     uint16_t idx = i / RTE_ETH_RETA_GROUP_SIZE;
     uint16_t shift = i % RTE_ETH_RETA_GROUP_SIZE;
     reta_conf[idx].mask |= 1ULL << shift;
     reta_conf[idx].reta[shift] = i % num_rxq;
   }
   err = rte_eth_dev_rss_reta_update(port_id, conf, info.reta_size);
   free(conf);

   return err;
 }

This works well for i40e and ice drivers but I get very confusing
reta_size values with mlx5.

mlx5_ethdev.c

333├>        info->reta_size = priv->reta_idx_n ?
334│                 priv->reta_idx_n : config->ind_table_max_size;

(gdb) p priv->reta_idx_n
$5 = 2
(gdb) p config->ind_table_max_size
$6 = 512

Obviously, info.reta_size / RTE_ETH_RETA_GROUP_SIZE = 1 / 512 = 0

From what I had understood info.reta_size should be a multiple of
RTE_ETH_RETA_GROUP_SIZE. This is what I can observe with i40e and ice at
least. Is it possible that the mlx5 driver has an issue there?

I found this commit[2] from 2015 that may have introduced an issue but
I am surprised that no one has ever encountered that before me. The
suspicious code bit is:

+    /* If the requested number of RX queues is not a power of two, use the
+     * maximum indirection table size for better balancing.
+     * The result is always rounded to the next power of two. */
+    reta_idx_n = (1 << log2above((rxqs_n & (rxqs_n - 1)) ?
+                    priv->ind_table_max_size :
+                    rxqs_n));

When rxqs_n == 2, reta_idx_n is initialized to 2 as well.

[2]: https://git.dpdk.org/dpdk/commit/?id=634efbc2c8c05

If you can provide any help, that would be much appreciated.

Thanks!

-- 
Robin Jarry
Principal Software Engineer
Red Hat


             reply	other threads:[~2022-12-05 15:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 15:57 Robin Jarry [this message]
2022-12-06 12:09 ` Robin Jarry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN_Gwq+VAG=4MxmyYOkbCtZXaL1GRXWLgXZ4pR1jYz=kFuZ9TA@mail.gmail.com' \
    --to=rjarry@redhat.com \
    --cc=cfontain@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dev@openvswitch.org \
    --cc=ktraynor@redhat.com \
    --cc=orika@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).