From: Huazhong Tan tanhuazhong@huawei.com
mainline inclusion from mainline-v5.8-rc1 commit a4de02287abb9947336dfdccc83f6c0cc182e7d9 category: feature bugzilla: NA CVE: NA
----------------------------
This patch provides a new interface for the client to query whether CMDQ is ready to work.
Signed-off-by: Huazhong Tan tanhuazhong@huawei.com Signed-off-by: Jakub Kicinski kuba@kernel.org Signed-off-by: Yonglong Liu liuyonglong@huawei.com Reviewed-by: Yongxin Li liyongxin1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 9 +++++++++ 2 files changed, 10 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 154df30c8203..da419655a017 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -571,6 +571,7 @@ struct hnae3_ae_ops { int (*set_vf_mac)(struct hnae3_handle *handle, int vf, u8 *p); int (*get_module_eeprom)(struct hnae3_handle *handle, u32 offset, u32 len, u8 *data); + bool (*get_cmdq_stat)(struct hnae3_handle *handle); int (*suspend)(struct hnae3_ae_dev *ae_dev); int (*resume)(struct hnae3_ae_dev *ae_dev); }; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 1e3610e20b28..417734d02ae0 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -6520,6 +6520,14 @@ static bool hclge_get_hw_reset_stat(struct hnae3_handle *handle) (hclge_read_dev(&hdev->hw, HCLGE_FUN_RST_ING) & BIT(0)); }
+static bool hclge_get_cmdq_stat(struct hnae3_handle *handle) +{ + struct hclge_vport *vport = hclge_get_vport(handle); + struct hclge_dev *hdev = vport->back; + + return test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state); +} + static bool hclge_ae_dev_resetting(struct hnae3_handle *handle) { struct hclge_vport *vport = hclge_get_vport(handle); @@ -11596,6 +11604,7 @@ struct hnae3_ae_ops hclge_ops = { .set_vf_rate = hclge_set_vf_rate, .set_vf_mac = hclge_set_vf_mac, .get_module_eeprom = hclge_get_module_eeprom, + .get_cmdq_stat = hclge_get_cmdq_stat, #ifdef CONFIG_PM .suspend = hclge_suspend, .resume = hclge_resume,