Skip to content

Commit fa5c4ba

Browse files
Chengchang Tangrleon
authored andcommitted
RDMA/hns: Fix warning storm caused by invalid input in IO path
WARN_ON() is called in the IO path. And it could lead to a warning storm. Use WARN_ON_ONCE() instead of WARN_ON(). Fixes: 12542f1 ("RDMA/hns: Refactor process about opcode in post_send()") Signed-off-by: Chengchang Tang <tangchengchang@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://patch.msgid.link/20241220055249.146943-4-huangjunxian6@hisilicon.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 0572ecc commit fa5c4ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp,
468468
valid_num_sge = calc_wr_sge_num(wr, &msg_len);
469469

470470
ret = set_ud_opcode(ud_sq_wqe, wr);
471-
if (WARN_ON(ret))
471+
if (WARN_ON_ONCE(ret))
472472
return ret;
473473

474474
ud_sq_wqe->msg_len = cpu_to_le32(msg_len);
@@ -572,7 +572,7 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp,
572572
rc_sq_wqe->msg_len = cpu_to_le32(msg_len);
573573

574574
ret = set_rc_opcode(hr_dev, rc_sq_wqe, wr);
575-
if (WARN_ON(ret))
575+
if (WARN_ON_ONCE(ret))
576576
return ret;
577577

578578
hr_reg_write(rc_sq_wqe, RC_SEND_WQE_SO,

0 commit comments

Comments
 (0)