net: hns3: fix ROCE base interrupt vector initialization bug
authorJie Wang <wangjie125@huawei.com>
Wed, 10 Nov 2021 13:42:50 +0000 (21:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:17:12 +0000 (19:17 +0100)
[ Upstream commit beb27ca451a57a1c0e52b5268703f3c3173c1f8c ]

Currently, NIC init ROCE interrupt vector with MSIX interrupt. But ROCE use
pci_irq_vector() to get interrupt vector, which adds the relative interrupt
vector again and gets wrong interrupt vector.

So fixes it by assign relative interrupt vector to ROCE instead of MSIX
interrupt vector and delete the unused struct member base_msi_vector
declaration of hclgevf_dev.

Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h

index d891390d492f69e9099f6bd7d24a79031fe5ddbe..ffd85cd297ef35be91755b82a006b42c96ceed5c 100644 (file)
@@ -2498,7 +2498,7 @@ static int hclge_init_roce_base_info(struct hclge_vport *vport)
        if (hdev->num_msi < hdev->num_nic_msi + hdev->num_roce_msi)
                return -EINVAL;
 
-       roce->rinfo.base_vector = hdev->roce_base_vector;
+       roce->rinfo.base_vector = hdev->num_nic_msi;
 
        roce->rinfo.netdev = nic->kinfo.netdev;
        roce->rinfo.roce_io_base = hdev->hw.io_base;
@@ -2534,10 +2534,6 @@ static int hclge_init_msi(struct hclge_dev *hdev)
        hdev->num_msi = vectors;
        hdev->num_msi_left = vectors;
 
-       hdev->base_msi_vector = pdev->irq;
-       hdev->roce_base_vector = hdev->base_msi_vector +
-                               hdev->num_nic_msi;
-
        hdev->vector_status = devm_kcalloc(&pdev->dev, hdev->num_msi,
                                           sizeof(u16), GFP_KERNEL);
        if (!hdev->vector_status) {
index 69cd8f87b4c8643f8d92a4522c08ab98a9a25966..9111b8c84d7861594ae1e8bf23b9d4302906c611 100644 (file)
@@ -876,12 +876,10 @@ struct hclge_dev {
        u16 num_msi;
        u16 num_msi_left;
        u16 num_msi_used;
-       u32 base_msi_vector;
        u16 *vector_status;
        int *vector_irq;
        u16 num_nic_msi;        /* Num of nic vectors for this PF */
        u16 num_roce_msi;       /* Num of roce vectors for this PF */
-       int roce_base_vector;
 
        unsigned long service_timer_period;
        unsigned long service_timer_previous;
index cf00ad7bb881f31502d95277da55906cae71bc82..4cf34f169354477a7eff9c21ff08a55e8179dfb7 100644 (file)
@@ -2557,7 +2557,7 @@ static int hclgevf_init_roce_base_info(struct hclgevf_dev *hdev)
            hdev->num_msi_left == 0)
                return -EINVAL;
 
-       roce->rinfo.base_vector = hdev->roce_base_vector;
+       roce->rinfo.base_vector = hdev->roce_base_msix_offset;
 
        roce->rinfo.netdev = nic->kinfo.netdev;
        roce->rinfo.roce_io_base = hdev->hw.io_base;
@@ -2823,9 +2823,6 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev)
        hdev->num_msi = vectors;
        hdev->num_msi_left = vectors;
 
-       hdev->base_msi_vector = pdev->irq;
-       hdev->roce_base_vector = pdev->irq + hdev->roce_base_msix_offset;
-
        hdev->vector_status = devm_kcalloc(&pdev->dev, hdev->num_msi,
                                           sizeof(u16), GFP_KERNEL);
        if (!hdev->vector_status) {
index 28288d7e33032c33d679d3667591e30a345793b0..4bd922b475012a7982da57ea75e77019fcc71f97 100644 (file)
@@ -308,8 +308,6 @@ struct hclgevf_dev {
        u16 num_nic_msix;       /* Num of nic vectors for this VF */
        u16 num_roce_msix;      /* Num of roce vectors for this VF */
        u16 roce_base_msix_offset;
-       int roce_base_vector;
-       u32 base_msi_vector;
        u16 *vector_status;
        int *vector_irq;