Re: [PATCH net-next v7 05/10] bnge: add ethtool support to manage RSS contexts
From: kernel test robot
Date: Sat Nov 14 2026 - 09:18:58 EST
Hi Vikas,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Vikas-Gupta/bnge-restructure-VNIC-and-filter-code/20261114-131733
base: net-next/main
patch link: https://lore.kernel.org/r/20261114074742.1484603-6-vikas.gupta%40broadcom.com
patch subject: [PATCH net-next v7 05/10] bnge: add ethtool support to manage RSS contexts
config: x86_64-buildonly-randconfig-1004-20261114 (https://download.01.org/0day-ci/archive/20261114/202611142235.fFLV6D4T-lkp@xxxxxxxxx/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261114/202611142235.fFLV6D4T-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611142235.fFLV6D4T-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
drivers/net/ethernet/broadcom/bnge/bnge_resc.c: In function 'bnge_reserve_rings':
>> drivers/net/ethernet/broadcom/bnge/bnge_resc.c:314:37: warning: variable 'old_rx_nr_rings' set but not used [-Wunused-but-set-variable]
314 | u16 rx_rings, old_rx_rings, old_rx_nr_rings;
| ^~~~~~~~~~~~~~~
vim +/old_rx_nr_rings +314 drivers/net/ethernet/broadcom/bnge/bnge_resc.c
627c67f038d2e9 Vikas Gupta 2025-07-01 310
627c67f038d2e9 Vikas Gupta 2025-07-01 311 int bnge_reserve_rings(struct bnge_dev *bd)
627c67f038d2e9 Vikas Gupta 2025-07-01 312 {
627c67f038d2e9 Vikas Gupta 2025-07-01 313 u16 aux_dflt_msix = bnge_aux_get_dflt_msix(bd);
d6031788285120 Sachin Holla 2026-08-27 @314 u16 rx_rings, old_rx_rings, old_rx_nr_rings;
627c67f038d2e9 Vikas Gupta 2025-07-01 315 struct bnge_hw_rings hwr = {0};
627c67f038d2e9 Vikas Gupta 2025-07-01 316 u16 nq = bd->nq_nr_rings;
627c67f038d2e9 Vikas Gupta 2025-07-01 317 u16 aux_msix = 0;
c7c6bcf2c57acc Vikas Gupta 2026-11-14 318 bool indir_lost = false;
c7c6bcf2c57acc Vikas Gupta 2026-11-14 319 bool rx_changed;
627c67f038d2e9 Vikas Gupta 2025-07-01 320 bool sh = false;
627c67f038d2e9 Vikas Gupta 2025-07-01 321 u16 tx_cp;
627c67f038d2e9 Vikas Gupta 2025-07-01 322 int rc;
627c67f038d2e9 Vikas Gupta 2025-07-01 323
627c67f038d2e9 Vikas Gupta 2025-07-01 324 if (!bnge_need_reserve_rings(bd))
627c67f038d2e9 Vikas Gupta 2025-07-01 325 return 0;
627c67f038d2e9 Vikas Gupta 2025-07-01 326
627c67f038d2e9 Vikas Gupta 2025-07-01 327 if (!bnge_aux_registered(bd)) {
627c67f038d2e9 Vikas Gupta 2025-07-01 328 aux_msix = bnge_get_avail_msix(bd, aux_dflt_msix);
627c67f038d2e9 Vikas Gupta 2025-07-01 329 if (!aux_msix)
627c67f038d2e9 Vikas Gupta 2025-07-01 330 bnge_aux_set_stat_ctxs(bd, 0);
627c67f038d2e9 Vikas Gupta 2025-07-01 331
627c67f038d2e9 Vikas Gupta 2025-07-01 332 if (aux_msix > aux_dflt_msix)
627c67f038d2e9 Vikas Gupta 2025-07-01 333 aux_msix = aux_dflt_msix;
627c67f038d2e9 Vikas Gupta 2025-07-01 334 hwr.nq = nq + aux_msix;
627c67f038d2e9 Vikas Gupta 2025-07-01 335 } else {
627c67f038d2e9 Vikas Gupta 2025-07-01 336 hwr.nq = bnge_nqs_demand(bd);
627c67f038d2e9 Vikas Gupta 2025-07-01 337 }
627c67f038d2e9 Vikas Gupta 2025-07-01 338
d6031788285120 Sachin Holla 2026-08-27 339 hwr.tx = bnge_tx_rings_demand(bd);
627c67f038d2e9 Vikas Gupta 2025-07-01 340 hwr.rx = bd->rx_nr_rings;
627c67f038d2e9 Vikas Gupta 2025-07-01 341 if (bd->flags & BNGE_EN_SHARED_CHNL)
627c67f038d2e9 Vikas Gupta 2025-07-01 342 sh = true;
d6031788285120 Sachin Holla 2026-08-27 343 hwr.cmpl = bnge_cprs_demand(bd);
627c67f038d2e9 Vikas Gupta 2025-07-01 344
bff7700def65f9 Vikas Gupta 2026-11-14 345 hwr.vnic = bnge_get_total_vnics(bd);
627c67f038d2e9 Vikas Gupta 2025-07-01 346
627c67f038d2e9 Vikas Gupta 2025-07-01 347 if (bnge_is_agg_reqd(bd))
627c67f038d2e9 Vikas Gupta 2025-07-01 348 hwr.rx <<= 1;
627c67f038d2e9 Vikas Gupta 2025-07-01 349 hwr.grp = bd->rx_nr_rings;
bff7700def65f9 Vikas Gupta 2026-11-14 350 hwr.rss_ctx = bnge_get_total_rss_ctxs(bd, &hwr);
627c67f038d2e9 Vikas Gupta 2025-07-01 351 hwr.stat = bnge_func_stat_ctxs_demand(bd);
627c67f038d2e9 Vikas Gupta 2025-07-01 352 old_rx_rings = bd->hw_resc.resv_rx_rings;
d6031788285120 Sachin Holla 2026-08-27 353 old_rx_nr_rings = bd->rx_nr_rings;
627c67f038d2e9 Vikas Gupta 2025-07-01 354
627c67f038d2e9 Vikas Gupta 2025-07-01 355 rc = bnge_hwrm_reserve_rings(bd, &hwr);
627c67f038d2e9 Vikas Gupta 2025-07-01 356 if (rc)
627c67f038d2e9 Vikas Gupta 2025-07-01 357 return rc;
627c67f038d2e9 Vikas Gupta 2025-07-01 358
627c67f038d2e9 Vikas Gupta 2025-07-01 359 bnge_copy_reserved_rings(bd, &hwr);
627c67f038d2e9 Vikas Gupta 2025-07-01 360
d6031788285120 Sachin Holla 2026-08-27 361 /* Exclude the MPC reservation before adjusting the L2 rings. */
d6031788285120 Sachin Holla 2026-08-27 362 if (bnge_is_roce_en(bd)) {
d6031788285120 Sachin Holla 2026-08-27 363 if (hwr.tx <= 1 || hwr.cmpl <= 2)
d6031788285120 Sachin Holla 2026-08-27 364 return -ENOMEM;
d6031788285120 Sachin Holla 2026-08-27 365 hwr.tx--;
d6031788285120 Sachin Holla 2026-08-27 366 hwr.cmpl--;
d6031788285120 Sachin Holla 2026-08-27 367 }
d6031788285120 Sachin Holla 2026-08-27 368
627c67f038d2e9 Vikas Gupta 2025-07-01 369 rx_rings = hwr.rx;
627c67f038d2e9 Vikas Gupta 2025-07-01 370 if (bnge_is_agg_reqd(bd)) {
627c67f038d2e9 Vikas Gupta 2025-07-01 371 if (hwr.rx >= 2)
627c67f038d2e9 Vikas Gupta 2025-07-01 372 rx_rings = hwr.rx >> 1;
627c67f038d2e9 Vikas Gupta 2025-07-01 373 else
627c67f038d2e9 Vikas Gupta 2025-07-01 374 return -ENOMEM;
627c67f038d2e9 Vikas Gupta 2025-07-01 375 }
627c67f038d2e9 Vikas Gupta 2025-07-01 376
627c67f038d2e9 Vikas Gupta 2025-07-01 377 rx_rings = min_t(u16, rx_rings, hwr.grp);
627c67f038d2e9 Vikas Gupta 2025-07-01 378 hwr.nq = min_t(u16, hwr.nq, bd->nq_nr_rings);
627c67f038d2e9 Vikas Gupta 2025-07-01 379 if (hwr.stat > bnge_aux_get_stat_ctxs(bd))
627c67f038d2e9 Vikas Gupta 2025-07-01 380 hwr.stat -= bnge_aux_get_stat_ctxs(bd);
627c67f038d2e9 Vikas Gupta 2025-07-01 381 hwr.nq = min_t(u16, hwr.nq, hwr.stat);
627c67f038d2e9 Vikas Gupta 2025-07-01 382
627c67f038d2e9 Vikas Gupta 2025-07-01 383 /* Adjust the rings */
d6031788285120 Sachin Holla 2026-08-27 384 rc = bnge_fix_rings_count(&rx_rings, &hwr.tx, hwr.cmpl, false);
d6031788285120 Sachin Holla 2026-08-27 385 if (rc)
d6031788285120 Sachin Holla 2026-08-27 386 return rc;
627c67f038d2e9 Vikas Gupta 2025-07-01 387 rc = bnge_adjust_rings(bd, &rx_rings, &hwr.tx, hwr.nq, sh);
d6031788285120 Sachin Holla 2026-08-27 388 if (rc)
d6031788285120 Sachin Holla 2026-08-27 389 return rc;
627c67f038d2e9 Vikas Gupta 2025-07-01 390 if (bnge_is_agg_reqd(bd))
627c67f038d2e9 Vikas Gupta 2025-07-01 391 hwr.rx = rx_rings << 1;
627c67f038d2e9 Vikas Gupta 2025-07-01 392 tx_cp = hwr.tx;
627c67f038d2e9 Vikas Gupta 2025-07-01 393 hwr.nq = sh ? max_t(u16, tx_cp, rx_rings) : tx_cp + rx_rings;
c7c6bcf2c57acc Vikas Gupta 2026-11-14 394
c7c6bcf2c57acc Vikas Gupta 2026-11-14 395 /* One ring group per rx ring, so rss_ctx is checked against the final
c7c6bcf2c57acc Vikas Gupta 2026-11-14 396 * rx ring count. Fail before any driver state is changed, so that a
c7c6bcf2c57acc Vikas Gupta 2026-11-14 397 * retry reserves again instead of finding the failed values in place.
c7c6bcf2c57acc Vikas Gupta 2026-11-14 398 */
c7c6bcf2c57acc Vikas Gupta 2026-11-14 399 hwr.grp = rx_rings;
c7c6bcf2c57acc Vikas Gupta 2026-11-14 400 if (!bnge_rings_ok(&hwr))
c7c6bcf2c57acc Vikas Gupta 2026-11-14 401 return -ENOMEM;
c7c6bcf2c57acc Vikas Gupta 2026-11-14 402
627c67f038d2e9 Vikas Gupta 2025-07-01 403 bd->tx_nr_rings = hwr.tx;
d6031788285120 Sachin Holla 2026-08-27 404 if (!bd->num_tc)
d6031788285120 Sachin Holla 2026-08-27 405 bd->tx_nr_rings_per_tc = bd->tx_nr_rings;
627c67f038d2e9 Vikas Gupta 2025-07-01 406
c7c6bcf2c57acc Vikas Gupta 2026-11-14 407 rx_changed = rx_rings != bd->rx_nr_rings;
c7c6bcf2c57acc Vikas Gupta 2026-11-14 408 if (rx_changed) {
627c67f038d2e9 Vikas Gupta 2025-07-01 409 dev_warn(bd->dev, "RX rings resv reduced to %d than earlier %d requested\n",
627c67f038d2e9 Vikas Gupta 2025-07-01 410 rx_rings, bd->rx_nr_rings);
c7c6bcf2c57acc Vikas Gupta 2026-11-14 411 indir_lost = bd->netdev &&
c7c6bcf2c57acc Vikas Gupta 2026-11-14 412 netif_is_rxfh_configured(bd->netdev) &&
c7c6bcf2c57acc Vikas Gupta 2026-11-14 413 (bnge_cal_nr_rss_ctxs(bd->rx_nr_rings) !=
c7c6bcf2c57acc Vikas Gupta 2026-11-14 414 bnge_cal_nr_rss_ctxs(rx_rings) ||
c7c6bcf2c57acc Vikas Gupta 2026-11-14 415 bnge_get_max_rss_ring(bd) >= rx_rings);
c7c6bcf2c57acc Vikas Gupta 2026-11-14 416 bnge_check_rss_ctxs_lost(bd, rx_rings);
c7c6bcf2c57acc Vikas Gupta 2026-11-14 417 }
627c67f038d2e9 Vikas Gupta 2025-07-01 418
627c67f038d2e9 Vikas Gupta 2025-07-01 419 bd->rx_nr_rings = rx_rings;
627c67f038d2e9 Vikas Gupta 2025-07-01 420 bd->nq_nr_rings = hwr.nq;
627c67f038d2e9 Vikas Gupta 2025-07-01 421
c7c6bcf2c57acc Vikas Gupta 2026-11-14 422 if (old_rx_rings != bd->hw_resc.resv_rx_rings || rx_changed) {
c7c6bcf2c57acc Vikas Gupta 2026-11-14 423 if (!bd->netdev || indir_lost ||
c7c6bcf2c57acc Vikas Gupta 2026-11-14 424 !netif_is_rxfh_configured(bd->netdev))
c7c6bcf2c57acc Vikas Gupta 2026-11-14 425 bnge_set_dflt_rss_indir_tbl(bd, NULL);
c7c6bcf2c57acc Vikas Gupta 2026-11-14 426 bnge_refill_dflt_rss_ctxs(bd);
c7c6bcf2c57acc Vikas Gupta 2026-11-14 427 }
627c67f038d2e9 Vikas Gupta 2025-07-01 428
c7c6bcf2c57acc Vikas Gupta 2026-11-14 429 /* Notify only now, so the notification reports the new ring count
c7c6bcf2c57acc Vikas Gupta 2026-11-14 430 * and the reset indirection table.
c7c6bcf2c57acc Vikas Gupta 2026-11-14 431 */
c7c6bcf2c57acc Vikas Gupta 2026-11-14 432 if (indir_lost)
c7c6bcf2c57acc Vikas Gupta 2026-11-14 433 ethtool_rxfh_indir_lost(bd->netdev);
627c67f038d2e9 Vikas Gupta 2025-07-01 434
627c67f038d2e9 Vikas Gupta 2025-07-01 435 if (!bnge_aux_registered(bd)) {
627c67f038d2e9 Vikas Gupta 2025-07-01 436 u16 resv_msix, resv_ctx, aux_ctxs;
627c67f038d2e9 Vikas Gupta 2025-07-01 437 struct bnge_hw_resc *hw_resc;
627c67f038d2e9 Vikas Gupta 2025-07-01 438
627c67f038d2e9 Vikas Gupta 2025-07-01 439 hw_resc = &bd->hw_resc;
627c67f038d2e9 Vikas Gupta 2025-07-01 440 resv_msix = hw_resc->resv_irqs - bd->nq_nr_rings;
627c67f038d2e9 Vikas Gupta 2025-07-01 441 aux_msix = min_t(u16, resv_msix, aux_msix);
627c67f038d2e9 Vikas Gupta 2025-07-01 442 bnge_aux_set_msix_num(bd, aux_msix);
627c67f038d2e9 Vikas Gupta 2025-07-01 443 resv_ctx = hw_resc->resv_stat_ctxs - bd->nq_nr_rings;
627c67f038d2e9 Vikas Gupta 2025-07-01 444 aux_ctxs = min(resv_ctx, bnge_aux_get_stat_ctxs(bd));
627c67f038d2e9 Vikas Gupta 2025-07-01 445 bnge_aux_set_stat_ctxs(bd, aux_ctxs);
627c67f038d2e9 Vikas Gupta 2025-07-01 446 }
627c67f038d2e9 Vikas Gupta 2025-07-01 447
627c67f038d2e9 Vikas Gupta 2025-07-01 448 return rc;
627c67f038d2e9 Vikas Gupta 2025-07-01 449 }
18a975389fcc81 Vikas Gupta 2025-07-01 450
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki