RDMA/hns: Clear extended doorbell info before using
Subsystems (2)
PATCH 1/1 RDMA/hns: Clear extended doorbell info before using
From: Xi Wang <[email protected]>
Both of HIP08 and HIP09 require the extended doorbell information to be cleared before being used.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 16 ++++++++++++++++ drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 1 + 2 files changed, 17 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +16 -0
@@ -1572,6 +1572,20 @@ static void hns_roce_function_clear(struct hns_roce_dev *hr_dev) } } +static void hns_roce_clear_extdb_list_info (struct hns_roce_dev *hr_dev) +{ +struct hns_roce_cmq_desc desc; +int ret; + +hns_roce_cmq_setup_basic_desc (&desc,HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO , + false); + ret =hns_roce_cmq_send (hr_dev, &desc,1 ); +if (ret) +ibdev_warn (&hr_dev->ib_dev, +"failed to clear extended doorbell info, ret = %d.\n" , + ret); +} +static int hns_roce_query_fw_ver (struct hns_roce_dev *hr_dev) {struct hns_roce_query_fw_info *resp;
@@ -2684,6 +2698,8 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)if (ret)return ret; +/* The hns ROCEE requires the extdb info to be cleared before using */ +hns_roce_clear_extdb_list_info (hr_dev);if (hr_dev->is_vf)return 0 ;
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +1 -0
@@ -250,6 +250,7 @@ enum hns_roce_opcode_type {HNS_ROCE_OPC_CLR_SCCC =0x8509 ,HNS_ROCE_OPC_QUERY_SCCC =0x850a ,HNS_ROCE_OPC_RESET_SCCC =0x850b , +HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO =0x850d ,HNS_ROCE_OPC_QUERY_VF_RES =0x850e ,HNS_ROCE_OPC_CFG_GMV_TBL =0x850f , HNS_ROCE_OPC_CFG_GMV_BT = 0x8510,
Signature · 1 line
2.7.4
Quoted 4 lines · Weihang Li
From: Xi Wang <[email protected]>
Both of HIP08 and HIP09 require the extended doorbell information to be cleared before being used.
Is it bugfix or feature?
For the fix, it needs to have Fixes ... line.
Quoted 34 lines
Signed-off-by Xi Wang <[email protected]>Signed-off-by Weihang Li <[email protected]>--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 16 ++++++++++++++++ drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 1 + 2 files changed, 17 insertions(+)drivers/infiniband/hw/hns/hns_roce_hw_v2.c +14
-0@@ -1572,6 +1572,20 @@ static void hns_roce_function_clear(struct hns_roce_dev *hr_dev) } } +static void hns_roce_clear_extdb_list_info (struct hns_roce_dev *hr_dev) +{ +struct hns_roce_cmq_desc desc; +int ret; + +hns_roce_cmq_setup_basic_desc (&desc,HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO , + false); + ret =hns_roce_cmq_send (hr_dev, &desc,1 ); +if (ret) +ibdev_warn (&hr_dev->ib_dev, +"failed to clear extended doorbell info, ret = %d.\n" , + ret); +} +static int hns_roce_query_fw_ver (struct hns_roce_dev *hr_dev) {struct hns_roce_query_fw_info *resp;
drivers/infiniband/hw/hns/hns_roce_hw_v2.c static int hns_roce_v2_init(struct hns_roce_dev *hr_dev) · line 2702
Quoted 5 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +2
-0@@ -2684,6 +2698,8 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)if (ret)return ret; +/* The hns ROCEE requires the extdb info to be cleared before using */ +hns_roce_clear_extdb_list_info (hr_dev);
If it "requires", why do you proceed anyway? Why don't you check for success/failure?
Thanks
Quoted 18 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +0
-0if (hr_dev->is_vf)return 0 ;drivers/infiniband/hw/hns/hns_roce_hw_v2.h +1
-0@@ -250,6 +250,7 @@ enum hns_roce_opcode_type {HNS_ROCE_OPC_CLR_SCCC =0x8509 ,HNS_ROCE_OPC_QUERY_SCCC =0x850a ,HNS_ROCE_OPC_RESET_SCCC =0x850b , +HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO =0x850d ,HNS_ROCE_OPC_QUERY_VF_RES =0x850e ,HNS_ROCE_OPC_CFG_GMV_TBL =0x850f , HNS_ROCE_OPC_CFG_GMV_BT = 0x8510,Signature · 1 line
2.7.4
Quoted 9 lines · Leon Romanovsky
Quoted 4 lines · Weihang Li
From: Xi Wang <[email protected]>
Both of HIP08 and HIP09 require the extended doorbell information to be cleared before being used.
Is it bugfix or feature?
For the fix, it needs to have Fixes ... line.
It is a bugfix, I will add a fixes tag, thanks.
Quoted 37 lines
Quoted 37 lines
Signed-off-by Xi Wang <[email protected]>Signed-off-by Weihang Li <[email protected]>--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 16 ++++++++++++++++ drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 1 + 2 files changed, 17 insertions(+)drivers/infiniband/hw/hns/hns_roce_hw_v2.c +14
-0@@ -1572,6 +1572,20 @@ static void hns_roce_function_clear(struct hns_roce_dev *hr_dev) } } +static void hns_roce_clear_extdb_list_info (struct hns_roce_dev *hr_dev) +{ +struct hns_roce_cmq_desc desc; +int ret; + +hns_roce_cmq_setup_basic_desc (&desc,HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO , + false); + ret =hns_roce_cmq_send (hr_dev, &desc,1 ); +if (ret) +ibdev_warn (&hr_dev->ib_dev, +"failed to clear extended doorbell info, ret = %d.\n" , + ret); +} +static int hns_roce_query_fw_ver (struct hns_roce_dev *hr_dev) {struct hns_roce_query_fw_info *resp;@@ -2684,6 +2698,8 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)if (ret)return ret;
Quoted 8 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c static int hns_roce_v2_init(struct hns_roce_dev *hr_dev) · line 2702
Quoted 2 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +2
-0+/* The hns ROCEE requires the extdb info to be cleared before using */ +hns_roce_clear_extdb_list_info (hr_dev);If it "requires", why do you proceed anyway? Why don't you check for success/failure?
Thanks
You are right, we should check for it's return value.
Weihang
Quoted 19 lines
Quoted 18 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +0
-0if (hr_dev->is_vf)return 0 ;drivers/infiniband/hw/hns/hns_roce_hw_v2.h +1
-0@@ -250,6 +250,7 @@ enum hns_roce_opcode_type {HNS_ROCE_OPC_CLR_SCCC =0x8509 ,HNS_ROCE_OPC_QUERY_SCCC =0x850a ,HNS_ROCE_OPC_RESET_SCCC =0x850b , +HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO =0x850d ,HNS_ROCE_OPC_QUERY_VF_RES =0x850e ,HNS_ROCE_OPC_CFG_GMV_TBL =0x850f , HNS_ROCE_OPC_CFG_GMV_BT = 0x8510,Signature · 1 line
2.7.4