Skip to content

Commit 1dc839e

Browse files
Yufeng Modavem330
authored andcommitted
net: hns3: change affinity_mask to numa node range
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>
1 parent d18e811 commit 1dc839e

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
@@ -1528,9 +1528,10 @@ static void hclge_init_kdump_kernel_config(struct hclge_dev *hdev)
15281528
static int hclge_configure(struct hclge_dev *hdev)
15291529
{
15301530
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
1531+
const struct cpumask *cpumask = cpu_online_mask;
15311532
struct hclge_cfg cfg;
15321533
unsigned int i;
1533-
int ret;
1534+
int node, ret;
15341535

15351536
ret = hclge_get_cfg(hdev, &cfg);
15361537
if (ret)
@@ -1595,11 +1596,12 @@ static int hclge_configure(struct hclge_dev *hdev)
15951596

15961597
hclge_init_kdump_kernel_config(hdev);
15971598

1598-
/* Set the init affinity based on pci func number */
1599-
i = cpumask_weight(cpumask_of_node(dev_to_node(&hdev->pdev->dev)));
1600-
i = i ? PCI_FUNC(hdev->pdev->devfn) % i : 0;
1601-
cpumask_set_cpu(cpumask_local_spread(i, dev_to_node(&hdev->pdev->dev)),
1602-
&hdev->affinity_mask);
1599+
/* Set the affinity based on numa node */
1600+
node = dev_to_node(&hdev->pdev->dev);
1601+
if (node != NUMA_NO_NODE)
1602+
cpumask = cpumask_of_node(node);
1603+
1604+
cpumask_copy(&hdev->affinity_mask, cpumask);
16031605

16041606
return ret;
16051607
}

0 commit comments

Comments
 (0)