]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: hns3: fix an issue for hclgevf_ae_get_hdev
authorPeng Li <lipeng321@huawei.com>
Wed, 30 Jan 2019 20:55:50 +0000 (04:55 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Jan 2019 22:50:03 +0000 (14:50 -0800)
HNS3 VF driver support NIC and Roce, hdev stores NIC
handle and Roce handle, should use correct parameter for
container_of.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

index 93f306f42cf4261a164b530498069e7f34f5c5d0..95f926971e3b0733f4d9b4cc942d8b1a66d71756 100644 (file)
@@ -86,7 +86,12 @@ static const u32 tqp_intr_reg_addr_list[] = {HCLGEVF_TQP_INTR_CTRL_REG,
 static inline struct hclgevf_dev *hclgevf_ae_get_hdev(
        struct hnae3_handle *handle)
 {
-       return container_of(handle, struct hclgevf_dev, nic);
+       if (!handle->client)
+               return container_of(handle, struct hclgevf_dev, nic);
+       else if (handle->client->type == HNAE3_CLIENT_ROCE)
+               return container_of(handle, struct hclgevf_dev, roce);
+       else
+               return container_of(handle, struct hclgevf_dev, nic);
 }
 
 static int hclgevf_tqps_update_stats(struct hnae3_handle *handle)