Netdev List
 help / color / mirror / Atom feed
From: Etienne AUJAMES <eaujames@ddn.com>
To: Dragos Tatulea <dtatulea@nvidia.com>
Cc: Tariq Toukan <tariqt@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>, Mark Bloch <mbloch@nvidia.com>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	Feng Liu <feliu@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	COURRIER Guillaume <guillaume.courrier@cea.fr>
Subject: Re: [PATCH net] net/mlx5e: guard child PKEY channel stats lookup in rx path
Date: Fri, 27 Nov 2026 21:31:56 +0100	[thread overview]
Message-ID: <awnovA2_GjB8ETZR@eaujamesFR0130> (raw)
In-Reply-To: <5e95879a-0b9f-41b9-be6d-c91a1c5c0666@nvidia.com>

On 27/11/26, Dragos Tatulea wrote:
> On 27.11.26 12:03, Etienne AUJAMES wrote:
> > Can you confirm that the parent channel count cannot be resized while
> > a sub-interface is present (whether UP or DOWN)?"
> >
> True. I had forgotten about this change. However, it is still possible to have
> a parent created with > 128 channels and the pkeys created afterwards. And then
> you can run into the issue again...

I am not sure to understand.
Are you referring to the following commit?

commit dbc94a0fb81771a38733c0e8f2ea8c4fa6934dc1
Author: Dragos Tatulea <dtatulea@nvidia.com>
Date:   Thu Dec 8 09:52:54 2022 +0200

    IB/IPoIB: Fix queue count inconsistency for PKEY child interfaces

    There are 2 ways to create IPoIB PKEY child interfaces:
    1) Writing a PKEY to /sys/class/net/<ib parent interface>/create_child.
    2) Using netlink with iproute.
...
    This change adds the get_num_tx/rx_queues() ops which allows for
    interfaces with multiple queues to be created over netlink. This
    constant only represents the max number of tx and rx queues on that
    net device.

+static unsigned int ipoib_get_max_num_queues(void)
+{
+       return min_t(unsigned int, num_possible_cpus(), 128);
+}
+

A child interface created via netlink (ip link add link ... type ipoib)
ends up with min(num_possible_cpus(), 128) RX/TX queues. The parent
may therefore have more allocated channels than the child, which would
trigger the same crash in the receive path.

Is there another scenario you had in mind?

The following guard should prevent most crash cases:
31c70bfe58 ("net/mlx5e: IPoIB, Block PKEY interfaces with less rx queues than parent")

@@ -168,6 +168,15 @@ static int mlx5i_pkey_dev_init(struct net_device *dev)
                return -EINVAL;
        }

+       if (dev->num_rx_queues < parent_dev->real_num_rx_queues) {
+               mlx5_core_warn(priv->mdev,
+                              "failed to create child device with rx queues [%d] less than parent's [%d]\n",
+

While digging I found a related problem in mlx5e_calc_max_nch(), which
sizes priv->channel_stats[] (max_nch) for the child:

        /* netdev rx queues */
        max_nch = min_t(unsigned int, max_nch, netdev->num_rx_queues);

        /* netdev tx queues */
        tmp = netdev->num_tx_queues;
        if (mlx5_qos_is_supported(mdev))
                tmp -= mlx5e_qos_max_leaf_nodes(mdev);
        if (MLX5_CAP_GEN(mdev, ts_cqe_to_dest_cqn))
                tmp -= profile->max_tc;
        tmp = tmp / profile->max_tc;
        max_nch = min_t(unsigned int, max_nch, tmp);

1/ It subtracts the QoS and PTP TX queues based only on the HW
   capabilities, not on the profile. Commit 1958c2bddfa2 ("net/mlx5e: Add
   profile indications for PTP and QOS HTB features") made the txq
   allocation depend on profile->features, but did not update
   mlx5e_calc_max_nch(). The IPoIB profiles have no .features, so they
   never get these queues.

2/ I am not entiery sure but I think 'tmp' (unsigned int) can underflow
   for the netlink allocation path (if the firmwares return true for
   mlx5_qos_is_supported() and for MLX5_CAP_GEN(mdev, ts_cqe_to_dest_cqn).

Thanks

Etienne

  reply	other threads:[~2026-11-27 20:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 18:24 [PATCH net] net/mlx5e: guard child PKEY channel stats lookup in rx path Etienne AUJAMES
2026-11-25 18:27 ` netdev-bot+sinfo
2026-11-25 19:17   ` Etienne AUJAMES
2026-11-26 14:41 ` Dragos Tatulea
2026-11-27 11:03   ` Etienne AUJAMES
2026-11-27 13:56     ` Dragos Tatulea
2026-11-27 20:31       ` Etienne AUJAMES [this message]
2026-11-26 18:27 ` netdev-bot+sashiko

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=awnovA2_GjB8ETZR@eaujamesFR0130 \
    --to=eaujames@ddn.com \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=feliu@nvidia.com \
    --cc=guillaume.courrier@cea.fr \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@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