[PATCH net-next v04 4/4] hinic3: Keep max_qps at the hardware maximum when RSS setup fails
From: Fan Gong
Date: Tue Nov 17 2026 - 07:09:36 EST
nic_dev->max_qps sizes the per-queue software arrays: txqs, rxqs,
intr_coalesce and qps_msix_entries are allocated with one entry per
max_qps by hinic3_sw_init() and hinic3_open(). The number of queues the
driver uses is nic_dev->q_params.num_qps: decide_num_qps() clamps it to
max_qps and hinic3_config_num_qps() forces it to 1 on every open while
HINIC3_RSS_ENABLE is clear.
hinic3_try_to_enable_rss() also shrank max_qps to 1 on its error paths.
The netdev is created with alloc_etherdev_mq(..., max_qps) queues, while
netif_set_real_num_queues() only lowers real_num_{tx,rx}_queues on a
successful open, so between probe and the first open the queue count the
netdev advertises and the size of these arrays disagreed.
This is a design change, not a bug fix, so it carries no Fixes: tag: the
old fallback was self consistent (one txq, one rxq, one coalesce entry,
one MSI-X entry and num_qps = 1), and nothing can reach the mismatch
today. hinic3_xmit_frame() is bounded by q_params.num_qps and
hinic3_get_stats64() by max_qps, and the queue count cannot grow later
either, as the driver has no ethtool set_channels or set_rxfh callback.
Keeping the arrays at the hardware maximum is what the per-queue
statistics that will walk real_num_*_queues need, since they must not be
able to index past the end of a one-element array.
After this change nothing sets max_qps to 1 any more. Keep it at
hinic3_func_max_qnum() in every branch, which is also the value
hinic3_init_nic_io() uses for the hardware queue capacity, and reduce
only q_params.num_qps. err_reset_q_params() now sets it to 1 explicitly
instead of copying max_qps, since one queue is what the device uses while
RSS is disabled.
Co-developed-by: Wu Di <wudi234@xxxxxxxxxx>
Signed-off-by: Wu Di <wudi234@xxxxxxxxxx>
Co-developed-by: Teng Peisen <tengpeisen@xxxxxxxxxx>
Signed-off-by: Teng Peisen <tengpeisen@xxxxxxxxxx>
Signed-off-by: Fan Gong <gongfan1@xxxxxxxxxx>
---
drivers/net/ethernet/huawei/hinic3/hinic3_rss.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_rss.c b/drivers/net/ethernet/huawei/hinic3/hinic3_rss.c
index 25db74d8c7dd..a5717e728545 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_rss.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_rss.c
@@ -312,10 +312,8 @@ void hinic3_try_to_enable_rss(struct net_device *netdev)
goto err_reset_q_params;
err = alloc_rss_resource(netdev);
- if (err) {
- nic_dev->max_qps = 1;
+ if (err)
goto err_reset_q_params;
- }
set_bit(HINIC3_RSS_ENABLE, &nic_dev->flags);
decide_num_qps(netdev);
@@ -324,7 +322,6 @@ void hinic3_try_to_enable_rss(struct net_device *netdev)
if (err) {
dev_err(hwdev->dev, "Failed to set hardware rss parameters\n");
hinic3_clear_rss_config(netdev);
- nic_dev->max_qps = 1;
goto err_reset_q_params;
}
@@ -332,5 +329,5 @@ void hinic3_try_to_enable_rss(struct net_device *netdev)
err_reset_q_params:
clear_bit(HINIC3_RSS_ENABLE, &nic_dev->flags);
- nic_dev->q_params.num_qps = nic_dev->max_qps;
+ nic_dev->q_params.num_qps = 1;
}
--
2.43.0