Skip to content

Commit d81fb65

Browse files
Junxian Huangrleon
authored andcommitted
RDMA/hns: Use dev_* printings in hem code instead of ibdev_*
The hem code is executed before ib_dev is registered, so use dev_* printing instead of ibdev_* to avoid log like this: (null): set HEM address to HW failed! Fixes: 2f49de2 ("RDMA/hns: Optimize mhop get flow for multi-hop addressing") Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://patch.msgid.link/20241024124000.2931869-5-huangjunxian6@hisilicon.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 370a935 commit d81fb65

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

drivers/infiniband/hw/hns/hns_roce_hem.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ static int calc_hem_config(struct hns_roce_dev *hr_dev,
300300
struct hns_roce_hem_mhop *mhop,
301301
struct hns_roce_hem_index *index)
302302
{
303-
struct ib_device *ibdev = &hr_dev->ib_dev;
303+
struct device *dev = hr_dev->dev;
304304
unsigned long mhop_obj = obj;
305305
u32 l0_idx, l1_idx, l2_idx;
306306
u32 chunk_ba_num;
@@ -331,14 +331,14 @@ static int calc_hem_config(struct hns_roce_dev *hr_dev,
331331
index->buf = l0_idx;
332332
break;
333333
default:
334-
ibdev_err(ibdev, "table %u not support mhop.hop_num = %u!\n",
335-
table->type, mhop->hop_num);
334+
dev_err(dev, "table %u not support mhop.hop_num = %u!\n",
335+
table->type, mhop->hop_num);
336336
return -EINVAL;
337337
}
338338

339339
if (unlikely(index->buf >= table->num_hem)) {
340-
ibdev_err(ibdev, "table %u exceed hem limt idx %llu, max %lu!\n",
341-
table->type, index->buf, table->num_hem);
340+
dev_err(dev, "table %u exceed hem limt idx %llu, max %lu!\n",
341+
table->type, index->buf, table->num_hem);
342342
return -EINVAL;
343343
}
344344

@@ -448,22 +448,22 @@ static int set_mhop_hem(struct hns_roce_dev *hr_dev,
448448
struct hns_roce_hem_mhop *mhop,
449449
struct hns_roce_hem_index *index)
450450
{
451-
struct ib_device *ibdev = &hr_dev->ib_dev;
451+
struct device *dev = hr_dev->dev;
452452
u32 step_idx;
453453
int ret = 0;
454454

455455
if (index->inited & HEM_INDEX_L0) {
456456
ret = hr_dev->hw->set_hem(hr_dev, table, obj, 0);
457457
if (ret) {
458-
ibdev_err(ibdev, "set HEM step 0 failed!\n");
458+
dev_err(dev, "set HEM step 0 failed!\n");
459459
goto out;
460460
}
461461
}
462462

463463
if (index->inited & HEM_INDEX_L1) {
464464
ret = hr_dev->hw->set_hem(hr_dev, table, obj, 1);
465465
if (ret) {
466-
ibdev_err(ibdev, "set HEM step 1 failed!\n");
466+
dev_err(dev, "set HEM step 1 failed!\n");
467467
goto out;
468468
}
469469
}
@@ -475,7 +475,7 @@ static int set_mhop_hem(struct hns_roce_dev *hr_dev,
475475
step_idx = mhop->hop_num;
476476
ret = hr_dev->hw->set_hem(hr_dev, table, obj, step_idx);
477477
if (ret)
478-
ibdev_err(ibdev, "set HEM step last failed!\n");
478+
dev_err(dev, "set HEM step last failed!\n");
479479
}
480480
out:
481481
return ret;
@@ -485,14 +485,14 @@ static int hns_roce_table_mhop_get(struct hns_roce_dev *hr_dev,
485485
struct hns_roce_hem_table *table,
486486
unsigned long obj)
487487
{
488-
struct ib_device *ibdev = &hr_dev->ib_dev;
489488
struct hns_roce_hem_index index = {};
490489
struct hns_roce_hem_mhop mhop = {};
490+
struct device *dev = hr_dev->dev;
491491
int ret;
492492

493493
ret = calc_hem_config(hr_dev, table, obj, &mhop, &index);
494494
if (ret) {
495-
ibdev_err(ibdev, "calc hem config failed!\n");
495+
dev_err(dev, "calc hem config failed!\n");
496496
return ret;
497497
}
498498

@@ -504,15 +504,15 @@ static int hns_roce_table_mhop_get(struct hns_roce_dev *hr_dev,
504504

505505
ret = alloc_mhop_hem(hr_dev, table, &mhop, &index);
506506
if (ret) {
507-
ibdev_err(ibdev, "alloc mhop hem failed!\n");
507+
dev_err(dev, "alloc mhop hem failed!\n");
508508
goto out;
509509
}
510510

511511
/* set HEM base address to hardware */
512512
if (table->type < HEM_TYPE_MTT) {
513513
ret = set_mhop_hem(hr_dev, table, obj, &mhop, &index);
514514
if (ret) {
515-
ibdev_err(ibdev, "set HEM address to HW failed!\n");
515+
dev_err(dev, "set HEM address to HW failed!\n");
516516
goto err_alloc;
517517
}
518518
}
@@ -575,7 +575,7 @@ static void clear_mhop_hem(struct hns_roce_dev *hr_dev,
575575
struct hns_roce_hem_mhop *mhop,
576576
struct hns_roce_hem_index *index)
577577
{
578-
struct ib_device *ibdev = &hr_dev->ib_dev;
578+
struct device *dev = hr_dev->dev;
579579
u32 hop_num = mhop->hop_num;
580580
u32 chunk_ba_num;
581581
u32 step_idx;
@@ -605,21 +605,21 @@ static void clear_mhop_hem(struct hns_roce_dev *hr_dev,
605605

606606
ret = hr_dev->hw->clear_hem(hr_dev, table, obj, step_idx);
607607
if (ret)
608-
ibdev_warn(ibdev, "failed to clear hop%u HEM, ret = %d.\n",
609-
hop_num, ret);
608+
dev_warn(dev, "failed to clear hop%u HEM, ret = %d.\n",
609+
hop_num, ret);
610610

611611
if (index->inited & HEM_INDEX_L1) {
612612
ret = hr_dev->hw->clear_hem(hr_dev, table, obj, 1);
613613
if (ret)
614-
ibdev_warn(ibdev, "failed to clear HEM step 1, ret = %d.\n",
615-
ret);
614+
dev_warn(dev, "failed to clear HEM step 1, ret = %d.\n",
615+
ret);
616616
}
617617

618618
if (index->inited & HEM_INDEX_L0) {
619619
ret = hr_dev->hw->clear_hem(hr_dev, table, obj, 0);
620620
if (ret)
621-
ibdev_warn(ibdev, "failed to clear HEM step 0, ret = %d.\n",
622-
ret);
621+
dev_warn(dev, "failed to clear HEM step 0, ret = %d.\n",
622+
ret);
623623
}
624624
}
625625
}
@@ -629,14 +629,14 @@ static void hns_roce_table_mhop_put(struct hns_roce_dev *hr_dev,
629629
unsigned long obj,
630630
int check_refcount)
631631
{
632-
struct ib_device *ibdev = &hr_dev->ib_dev;
633632
struct hns_roce_hem_index index = {};
634633
struct hns_roce_hem_mhop mhop = {};
634+
struct device *dev = hr_dev->dev;
635635
int ret;
636636

637637
ret = calc_hem_config(hr_dev, table, obj, &mhop, &index);
638638
if (ret) {
639-
ibdev_err(ibdev, "calc hem config failed!\n");
639+
dev_err(dev, "calc hem config failed!\n");
640640
return;
641641
}
642642

0 commit comments

Comments
 (0)