mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-12 12:25:18 +02:00
RDMA/hns: Fix unmatch exception handling when init eq table fails
[ Upstream commit543fb987bd
] The hw ctx should be destroyed when init eq table fails. Fixes:a5073d6054
("RDMA/hns: Add eq support of hip08") Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://lore.kernel.org/r/20240710133705.896445-4-huangjunxian6@hisilicon.com Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
72bbfe07f7
commit
f098ad96eb
|
@ -6261,9 +6261,16 @@ static void hns_roce_v2_int_mask_enable(struct hns_roce_dev *hr_dev,
|
||||||
roce_write(hr_dev, ROCEE_VF_ABN_INT_CFG_REG, enable_flag);
|
roce_write(hr_dev, ROCEE_VF_ABN_INT_CFG_REG, enable_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hns_roce_v2_destroy_eqc(struct hns_roce_dev *hr_dev, u32 eqn)
|
static void free_eq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_eq *eq)
|
||||||
|
{
|
||||||
|
hns_roce_mtr_destroy(hr_dev, &eq->mtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hns_roce_v2_destroy_eqc(struct hns_roce_dev *hr_dev,
|
||||||
|
struct hns_roce_eq *eq)
|
||||||
{
|
{
|
||||||
struct device *dev = hr_dev->dev;
|
struct device *dev = hr_dev->dev;
|
||||||
|
int eqn = eq->eqn;
|
||||||
int ret;
|
int ret;
|
||||||
u8 cmd;
|
u8 cmd;
|
||||||
|
|
||||||
|
@ -6274,12 +6281,9 @@ static void hns_roce_v2_destroy_eqc(struct hns_roce_dev *hr_dev, u32 eqn)
|
||||||
|
|
||||||
ret = hns_roce_destroy_hw_ctx(hr_dev, cmd, eqn & HNS_ROCE_V2_EQN_M);
|
ret = hns_roce_destroy_hw_ctx(hr_dev, cmd, eqn & HNS_ROCE_V2_EQN_M);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(dev, "[mailbox cmd] destroy eqc(%u) failed.\n", eqn);
|
dev_err(dev, "[mailbox cmd] destroy eqc(%d) failed.\n", eqn);
|
||||||
}
|
|
||||||
|
|
||||||
static void free_eq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_eq *eq)
|
free_eq_buf(hr_dev, eq);
|
||||||
{
|
|
||||||
hns_roce_mtr_destroy(hr_dev, &eq->mtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_eq_config(struct hns_roce_dev *hr_dev, struct hns_roce_eq *eq)
|
static void init_eq_config(struct hns_roce_dev *hr_dev, struct hns_roce_eq *eq)
|
||||||
|
@ -6585,7 +6589,7 @@ err_request_irq_fail:
|
||||||
|
|
||||||
err_create_eq_fail:
|
err_create_eq_fail:
|
||||||
for (i -= 1; i >= 0; i--)
|
for (i -= 1; i >= 0; i--)
|
||||||
free_eq_buf(hr_dev, &eq_table->eq[i]);
|
hns_roce_v2_destroy_eqc(hr_dev, &eq_table->eq[i]);
|
||||||
kfree(eq_table->eq);
|
kfree(eq_table->eq);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -6605,11 +6609,8 @@ static void hns_roce_v2_cleanup_eq_table(struct hns_roce_dev *hr_dev)
|
||||||
__hns_roce_free_irq(hr_dev);
|
__hns_roce_free_irq(hr_dev);
|
||||||
destroy_workqueue(hr_dev->irq_workq);
|
destroy_workqueue(hr_dev->irq_workq);
|
||||||
|
|
||||||
for (i = 0; i < eq_num; i++) {
|
for (i = 0; i < eq_num; i++)
|
||||||
hns_roce_v2_destroy_eqc(hr_dev, i);
|
hns_roce_v2_destroy_eqc(hr_dev, &eq_table->eq[i]);
|
||||||
|
|
||||||
free_eq_buf(hr_dev, &eq_table->eq[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
kfree(eq_table->eq);
|
kfree(eq_table->eq);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user