]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: ravb: Allocate correct number of queues based on SoC support
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Thu, 23 Oct 2025 11:21:11 +0000 (12:21 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 25 Oct 2025 02:04:34 +0000 (19:04 -0700)
Use the per-SoC match data flag `nc_queues` to decide how many TX/RX
queues to allocate. If the SoC does not provide a network-control queue,
fall back to a single TX/RX queue. Obtain the match data before calling
alloc_etherdev_mqs() so the allocation is sized correctly.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Link: https://patch.msgid.link/20251023112111.215198-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/renesas/ravb_main.c

index cb5ae9f85252b27483dc449866d4859736b98445..c3fc15f9ec8526b5419c4618db07d7026f3fd163 100644 (file)
@@ -2946,13 +2946,14 @@ static int ravb_probe(struct platform_device *pdev)
                return dev_err_probe(&pdev->dev, PTR_ERR(rstc),
                                     "failed to get cpg reset\n");
 
+       info = of_device_get_match_data(&pdev->dev);
+
        ndev = alloc_etherdev_mqs(sizeof(struct ravb_private),
-                                 NUM_TX_QUEUE, NUM_RX_QUEUE);
+                                 info->nc_queues ? NUM_TX_QUEUE : 1,
+                                 info->nc_queues ? NUM_RX_QUEUE : 1);
        if (!ndev)
                return -ENOMEM;
 
-       info = of_device_get_match_data(&pdev->dev);
-
        ndev->features = info->net_features;
        ndev->hw_features = info->net_hw_features;
        ndev->vlan_features = info->vlan_features;