[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250902182829.2fc36565@kernel.org>
Date: Tue, 2 Sep 2025 18:28:29 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Fan Gong <gongfan1@...wei.com>
Cc: Zhu Yikai <zhuyikai1@...artners.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon
Horman <horms@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
<linux-doc@...r.kernel.org>, Jonathan Corbet <corbet@....net>, Bjorn
Helgaas <helgaas@...nel.org>, luosifu <luosifu@...wei.com>, Xin Guo
<guoxin09@...wei.com>, Shen Chenyang <shenchenyang1@...ilicon.com>, Zhou
Shuai <zhoushuai28@...wei.com>, Wu Like <wulike1@...wei.com>, Shi Jing
<shijing34@...wei.com>, Meny Yossefi <meny.yossefi@...wei.com>, Gur Stavi
<gur.stavi@...wei.com>, Lee Trager <lee@...ger.us>, Michael Ellerman
<mpe@...erman.id.au>, Vadim Fedorenko <vadim.fedorenko@...ux.dev>, Suman
Ghosh <sumang@...vell.com>, Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Joe Damato <jdamato@...tly.com>, Christophe JAILLET
<christophe.jaillet@...adoo.fr>
Subject: Re: [PATCH net-next v03 11/14] hinic3: Add Rss function
On Sat, 30 Aug 2025 16:08:50 +0800 Fan Gong wrote:
> +static void hinic3_fillout_indir_tbl(struct net_device *netdev, u16 *indir)
> +{
> + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> + u16 i, num_qps;
> +
> + num_qps = nic_dev->q_params.num_qps;
> + for (i = 0; i < L2NIC_RSS_INDIR_SIZE; i++)
> + indir[i] = i % num_qps;
ethtool_rxfh_indir_default()
> +/* Get number of CPUs on same NUMA node of device. */
> +static unsigned int dev_num_cpus(struct device *dev)
> +{
> + unsigned int i, num_cpus, num_node_cpus;
> + int dev_node;
> +
> + dev_node = dev_to_node(dev);
> + num_cpus = num_online_cpus();
> + num_node_cpus = 0;
> +
> + for (i = 0; i < num_cpus; i++) {
> + if (cpu_to_node(i) == dev_node)
> + num_node_cpus++;
> + }
> +
> + return num_node_cpus ? : num_cpus;
Please use netif_get_num_default_rss_queues().
If you think its heuristic should be improved -- fix it,
but don't invent driver-local logic.
> +static void decide_num_qps(struct net_device *netdev)
> +{
> + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> + unsigned int dev_cpus;
> +
> + dev_cpus = dev_num_cpus(&nic_dev->pdev->dev);
> + nic_dev->q_params.num_qps = min(dev_cpus, nic_dev->max_qps);
Powered by blists - more mailing lists