diff options
author | Guangbin Huang <huangguangbin2@huawei.com> | 2020-09-27 10:12:41 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-09-27 23:25:22 +0300 |
commit | ca850f2b0ecbb24f03a706d4d11203565030570a (patch) | |
tree | f7f32274418548af2d1e4f0ee6233e9a3ac2fb7e /drivers/net/ethernet/hisilicon/hns3/hns3vf | |
parent | 9b56d9a5a7ad7d02d1b1a1601cad730dfee6bce1 (diff) | |
download | linux-ca850f2b0ecbb24f03a706d4d11203565030570a.tar.xz |
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')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c | 14 | ||||
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.h | 4 |
2 files changed, 14 insertions, 4 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; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.h index 0601df65755a..52e76511de64 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.h @@ -141,10 +141,12 @@ struct hclgevf_ctrl_vector_chain { u8 resv; }; +#define HCLGEVF_QUERY_CAP_LENGTH 3 struct hclgevf_query_version_cmd { __le32 firmware; __le32 hardware; - __le32 rsv[4]; + __le32 rsv; + __le32 caps[HCLGEVF_QUERY_CAP_LENGTH]; /* capabilities of device */ }; #define HCLGEVF_MSIX_OFT_ROCEE_S 0 |