• Vladimir Oltean's avatar
    net: dpaa: eliminate NR_CPUS dependency in egress_fqs[] and conf_fqs[] · e7072750
    Vladimir Oltean authored
    The driver uses the DPAA_TC_TXQ_NUM and DPAA_ETH_TXQ_NUM macros for TX
    queue handling, and they depend on CONFIG_NR_CPUS.
    
    In generic .config files, these can go to very large (8096 CPUs) values
    for the systems that DPAA1 is integrated in (1-24 CPUs). We allocate a
    lot of resources that will never be used. Those are:
    - system memory
    - QMan FQIDs as managed by qman_alloc_fqid_range(). This is especially
      painful since currently, when booting with CONFIG_NR_CPUS=8096, a
      LS1046A-RDB system will only manage to probe 3 of its 6 interfaces.
      The rest will run out of FQD ("/reserved-memory/qman-fqd" in the
      device tree) and fail at the qman_create_fq() stage of the probing
      process.
    - netdev queues as alloc_etherdev_mq() argument. The high queue indices
      are simply hidden from the network stack after the call to
      netif_set_real_num_tx_queues().
    
    With just a tiny bit more effort, we can replace the NR_CPUS
    compile-time constant with the num_possible_cpus() run-time constant,
    and dynamically allocate the egress_fqs[] and conf_fqs[] arrays.
    Even on a system with a high CONFIG_NR_CPUS, num_possible_cpus() will
    remain equal to the number of available cores on the SoC.
    
    The replacement is as follows:
    - DPAA_TC_TXQ_NUM -> dpaa_num_txqs_per_tc()
    - DPAA_ETH_TXQ_NUM -> dpaa_max_num_txqs()
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Acked-by: default avatarMadalin Bucur <madalin.bucur@oss.nxp.com>
    Link: https://patch.msgid.link/20240713225336.1746343-3-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    e7072750
dpaa_eth.h 4.95 KB