提交 06bb9b07 编写于 作者: C Chengchang Tang 提交者: ZhouJuan

RDMA/hns: Add clear_hem return value to log

mainline inclusion
from mainline-v6.5-rc1
commit a519a612a71848b69b70b18b4d14d165b2d8aaf7
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I7R61Q
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a519a612a71848b69b70b18b4d14d165b2d8aaf7

----------------------------------------------------------------------

Log return value of clear_hem() to help diagnose.

Link: https://lore.kernel.org/r/20230523121641.3132102-4-huangjunxian6@hisilicon.comSigned-off-by: NChengchang Tang <tangchengchang@huawei.com>
Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: NJuan Zhou <zhoujuan51@h-partners.com>
上级 a3276ab0
...@@ -619,6 +619,7 @@ static void clear_mhop_hem(struct hns_roce_dev *hr_dev, ...@@ -619,6 +619,7 @@ static void clear_mhop_hem(struct hns_roce_dev *hr_dev,
u32 hop_num = mhop->hop_num; u32 hop_num = mhop->hop_num;
u32 chunk_ba_num; u32 chunk_ba_num;
u32 step_idx; u32 step_idx;
int ret;
index->inited = HEM_INDEX_BUF; index->inited = HEM_INDEX_BUF;
chunk_ba_num = mhop->bt_chunk_size / BA_BYTE_LEN; chunk_ba_num = mhop->bt_chunk_size / BA_BYTE_LEN;
...@@ -642,16 +643,24 @@ static void clear_mhop_hem(struct hns_roce_dev *hr_dev, ...@@ -642,16 +643,24 @@ static void clear_mhop_hem(struct hns_roce_dev *hr_dev,
else else
step_idx = hop_num; step_idx = hop_num;
if (hr_dev->hw->clear_hem(hr_dev, table, obj, step_idx)) ret = hr_dev->hw->clear_hem(hr_dev, table, obj, step_idx);
ibdev_warn(ibdev, "failed to clear hop%u HEM.\n", hop_num); if (ret)
ibdev_warn(ibdev, "failed to clear hop%u HEM, ret = %d.\n",
if (index->inited & HEM_INDEX_L1) hop_num, ret);
if (hr_dev->hw->clear_hem(hr_dev, table, obj, 1))
ibdev_warn(ibdev, "failed to clear HEM step 1.\n"); if (index->inited & HEM_INDEX_L1) {
ret = hr_dev->hw->clear_hem(hr_dev, table, obj, 1);
if (ret)
ibdev_warn(ibdev, "failed to clear HEM step 1, ret = %d.\n",
ret);
}
if (index->inited & HEM_INDEX_L0) if (index->inited & HEM_INDEX_L0) {
if (hr_dev->hw->clear_hem(hr_dev, table, obj, 0)) ret = hr_dev->hw->clear_hem(hr_dev, table, obj, 0);
ibdev_warn(ibdev, "failed to clear HEM step 0.\n"); if (ret)
ibdev_warn(ibdev, "failed to clear HEM step 0, ret = %d.\n",
ret);
}
} }
} }
...@@ -688,6 +697,7 @@ void hns_roce_table_put(struct hns_roce_dev *hr_dev, ...@@ -688,6 +697,7 @@ void hns_roce_table_put(struct hns_roce_dev *hr_dev,
{ {
struct device *dev = hr_dev->dev; struct device *dev = hr_dev->dev;
unsigned long i; unsigned long i;
int ret;
if (hns_roce_check_whether_mhop(hr_dev, table->type)) { if (hns_roce_check_whether_mhop(hr_dev, table->type)) {
hns_roce_table_mhop_put(hr_dev, table, obj, 1); hns_roce_table_mhop_put(hr_dev, table, obj, 1);
...@@ -700,8 +710,10 @@ void hns_roce_table_put(struct hns_roce_dev *hr_dev, ...@@ -700,8 +710,10 @@ void hns_roce_table_put(struct hns_roce_dev *hr_dev,
&table->mutex)) &table->mutex))
return; return;
if (hr_dev->hw->clear_hem(hr_dev, table, obj, HEM_HOP_STEP_DIRECT)) ret = hr_dev->hw->clear_hem(hr_dev, table, obj, HEM_HOP_STEP_DIRECT);
dev_warn(dev, "failed to clear HEM base address.\n"); if (ret)
dev_warn(dev, "failed to clear HEM base address, ret = %d.\n",
ret);
hns_roce_free_hem(hr_dev, table->hem[i]); hns_roce_free_hem(hr_dev, table->hem[i]);
table->hem[i] = NULL; table->hem[i] = NULL;
...@@ -917,6 +929,8 @@ void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev, ...@@ -917,6 +929,8 @@ void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev,
{ {
struct device *dev = hr_dev->dev; struct device *dev = hr_dev->dev;
unsigned long i; unsigned long i;
int obj;
int ret;
if (hns_roce_check_whether_mhop(hr_dev, table->type)) { if (hns_roce_check_whether_mhop(hr_dev, table->type)) {
hns_roce_cleanup_mhop_hem_table(hr_dev, table); hns_roce_cleanup_mhop_hem_table(hr_dev, table);
...@@ -925,9 +939,11 @@ void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev, ...@@ -925,9 +939,11 @@ void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev,
for (i = 0; i < table->num_hem; ++i) for (i = 0; i < table->num_hem; ++i)
if (table->hem[i]) { if (table->hem[i]) {
if (hr_dev->hw->clear_hem(hr_dev, table, obj = i * table->table_chunk_size / table->obj_size;
i * table->table_chunk_size / table->obj_size, 0)) ret = hr_dev->hw->clear_hem(hr_dev, table, obj, 0);
dev_err(dev, "Clear HEM base address failed.\n"); if (ret)
dev_err(dev, "clear HEM base address failed, ret = %d.\n",
ret);
hns_roce_free_hem(hr_dev, table->hem[i]); hns_roce_free_hem(hr_dev, table->hem[i]);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册