aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c
diff options
context:
space:
mode:
authorGuangbin Huang <huangguangbin2@huawei.com>2020-09-27 15:12:41 +0800
committerDavid S. Miller <davem@davemloft.net>2020-09-27 13:25:22 -0700
commitca850f2b0ecbb24f03a706d4d11203565030570a (patch)
treef7f32274418548af2d1e4f0ee6233e9a3ac2fb7e /drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c
parentnet: hns3: delete redundant PCI revision judgement (diff)
downloadlinux-ca850f2b0ecbb24f03a706d4d11203565030570a.tar.xz
linux-ca850f2b0ecbb24f03a706d4d11203565030570a.zip
net: hns3: add support to query device capability
In order to improve code maintainability and compatibility, add support to query the device capability by expanding the existing version query command. The device capability refers to the features supported by the device. Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c')
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c
index b32375668311..3a1f7b5a347f 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c
@@ -313,7 +313,7 @@ int hclgevf_cmd_send(struct hclgevf_hw *hw, struct hclgevf_desc *desc, int num)
return status;
}
-static int hclgevf_cmd_query_version(struct hclgevf_dev *hdev)
+static int hclgevf_cmd_query_version_and_capability(struct hclgevf_dev *hdev)
{
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
struct hclgevf_query_version_cmd *resp;
@@ -333,6 +333,12 @@ static int hclgevf_cmd_query_version(struct hclgevf_dev *hdev)
HNAE3_PCI_REVISION_BIT_SIZE;
ae_dev->dev_version |= hdev->pdev->revision;
+ if (!resp->caps[0] &&
+ ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) {
+ hnae3_set_bit(ae_dev->flag, HNAE3_DEV_SUPPORT_FD_B, 1);
+ hnae3_set_bit(ae_dev->flag, HNAE3_DEV_SUPPORT_GRO_B, 1);
+ }
+
return status;
}
@@ -400,9 +406,11 @@ int hclgevf_cmd_init(struct hclgevf_dev *hdev)
goto err_cmd_init;
}
- ret = hclgevf_cmd_query_version(hdev);
+ /* get version and device capabilities */
+ ret = hclgevf_cmd_query_version_and_capability(hdev);
if (ret) {
- dev_err(&hdev->pdev->dev, "failed(%d) to query version\n", ret);
+ dev_err(&hdev->pdev->dev,
+ "failed to query version and capabilities, ret = %d\n", ret);
goto err_cmd_init;
}