aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorPeng Li <lipeng321@huawei.com>2019-01-31 04:55:50 +0800
committerDavid S. Miller <davem@davemloft.net>2019-01-30 14:50:03 -0800
commiteed9535f9f716a532ec0c5d6cc7a48584acdf435 (patch)
tree5083d2e08b1c1ae17210a44db7029541cde6446c /drivers/net
parentnet: hns3: fix improper error handling in the hclge_init_ae_dev() (diff)
downloadlinux-dev-eed9535f9f716a532ec0c5d6cc7a48584acdf435.tar.xz
linux-dev-eed9535f9f716a532ec0c5d6cc7a48584acdf435.zip
net: hns3: fix an issue for hclgevf_ae_get_hdev
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 93f306f42cf4..95f926971e3b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -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)