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>
This commit is contained in:
Peng Li 2019-01-31 04:55:50 +08:00 committed by David S. Miller
parent 9fc5541327
commit eed9535f9f
1 changed files with 6 additions and 1 deletions

View 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)