mirror of https://gitee.com/openkylin/linux.git
RDMA/hns: Fixes missing error code of CMDQ
When posting a multi-descriptors command, the error code of previous
failed descriptors may be rewrote to 0 by a later successful descriptor.
Fixes: a04ff739f2
("RDMA/hns: Add command queue support for hip08 RoCE driver")
Link: https://lore.kernel.org/r/1612688143-28226-3-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
229557230c
commit
8f86e2eada
|
@ -1317,7 +1317,7 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
|
||||||
u32 timeout = 0;
|
u32 timeout = 0;
|
||||||
int handle = 0;
|
int handle = 0;
|
||||||
u16 desc_ret;
|
u16 desc_ret;
|
||||||
int ret = 0;
|
int ret;
|
||||||
int ntc;
|
int ntc;
|
||||||
|
|
||||||
spin_lock_bh(&csq->lock);
|
spin_lock_bh(&csq->lock);
|
||||||
|
@ -1361,15 +1361,14 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
|
||||||
|
|
||||||
if (hns_roce_cmq_csq_done(hr_dev)) {
|
if (hns_roce_cmq_csq_done(hr_dev)) {
|
||||||
handle = 0;
|
handle = 0;
|
||||||
|
ret = 0;
|
||||||
while (handle < num) {
|
while (handle < num) {
|
||||||
/* get the result of hardware write back */
|
/* get the result of hardware write back */
|
||||||
desc_to_use = &csq->desc[ntc];
|
desc_to_use = &csq->desc[ntc];
|
||||||
desc[handle] = *desc_to_use;
|
desc[handle] = *desc_to_use;
|
||||||
dev_dbg(hr_dev->dev, "Get cmq desc:\n");
|
dev_dbg(hr_dev->dev, "Get cmq desc:\n");
|
||||||
desc_ret = le16_to_cpu(desc[handle].retval);
|
desc_ret = le16_to_cpu(desc[handle].retval);
|
||||||
if (desc_ret == CMD_EXEC_SUCCESS)
|
if (unlikely(desc_ret != CMD_EXEC_SUCCESS))
|
||||||
ret = 0;
|
|
||||||
else
|
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
|
|
||||||
ntc++;
|
ntc++;
|
||||||
|
|
Loading…
Reference in New Issue