Skip to content

Commit b76522c

Browse files
Yufeng Mogregkh
authored andcommitted
net: hns3: change affinity_mask to numa node range
commit 1dc839e upstream. Currently, affinity_mask is set to a single cpu. As a result, irqbalance becomes invalid in SUBSET or EXACT mode. To solve this problem, change affinity_mask to numa node range. In this way, irqbalance can be performed on the cpu of the numa node. Fixes: 0812545 ("net: hns3: add interrupt affinity support for misc interrupt") Signed-off-by: Yufeng Mo <moyufeng@huawei.com> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 34fc06d commit b76522c

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,9 +1463,10 @@ static void hclge_init_kdump_kernel_config(struct hclge_dev *hdev)
14631463

14641464
static int hclge_configure(struct hclge_dev *hdev)
14651465
{
1466+
const struct cpumask *cpumask = cpu_online_mask;
14661467
struct hclge_cfg cfg;
14671468
unsigned int i;
1468-
int ret;
1469+
int node, ret;
14691470

14701471
ret = hclge_get_cfg(hdev, &cfg);
14711472
if (ret)
@@ -1526,11 +1527,12 @@ static int hclge_configure(struct hclge_dev *hdev)
15261527

15271528
hclge_init_kdump_kernel_config(hdev);
15281529

1529-
/* Set the init affinity based on pci func number */
1530-
i = cpumask_weight(cpumask_of_node(dev_to_node(&hdev->pdev->dev)));
1531-
i = i ? PCI_FUNC(hdev->pdev->devfn) % i : 0;
1532-
cpumask_set_cpu(cpumask_local_spread(i, dev_to_node(&hdev->pdev->dev)),
1533-
&hdev->affinity_mask);
1530+
/* Set the affinity based on numa node */
1531+
node = dev_to_node(&hdev->pdev->dev);
1532+
if (node != NUMA_NO_NODE)
1533+
cpumask = cpumask_of_node(node);
1534+
1535+
cpumask_copy(&hdev->affinity_mask, cpumask);
15341536

15351537
return ret;
15361538
}

0 commit comments

Comments
 (0)