@@ -49,7 +49,7 @@ static int hns_roce_cmd_mbox_post_hw(struct hns_roce_dev *hr_dev, u64 in_param,
/* this should be called with "poll_sem" */
static int __hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, u64 in_param,
u64 out_param, unsigned long in_modifier,
- u16 op, unsigned int timeout)
+ u16 op)
{
int ret;
@@ -62,18 +62,18 @@ static int __hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, u64 in_param,
return ret;
}
- return hr_dev->hw->poll_mbox_done(hr_dev, timeout);
+ return hr_dev->hw->poll_mbox_done(hr_dev);
}
static int hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, u64 in_param,
u64 out_param, unsigned long in_modifier,
- u16 op, unsigned int timeout)
+ u16 op)
{
int ret;
down(&hr_dev->cmd.poll_sem);
ret = __hns_roce_cmd_mbox_poll(hr_dev, in_param, out_param, in_modifier,
- op, timeout);
+ op);
up(&hr_dev->cmd.poll_sem);
return ret;
@@ -99,7 +99,7 @@ void hns_roce_cmd_event(struct hns_roce_dev *hr_dev, u16 token, u8 status,
static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
u64 out_param, unsigned long in_modifier,
- u16 op, unsigned int timeout)
+ u16 op)
{
struct hns_roce_cmdq *cmd = &hr_dev->cmd;
struct hns_roce_cmd_context *context;
@@ -130,7 +130,7 @@ static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
}
if (!wait_for_completion_timeout(&context->done,
- msecs_to_jiffies(timeout))) {
+ msecs_to_jiffies(HNS_ROCE_CMD_TIMEOUT_MSECS))) {
dev_err_ratelimited(dev, "[cmd] token 0x%x mailbox 0x%x timeout.\n",
context->token, op);
ret = -EBUSY;
@@ -149,20 +149,20 @@ static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
static int hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
u64 out_param, unsigned long in_modifier,
- u16 op, unsigned int timeout)
+ u16 op)
{
int ret;
down(&hr_dev->cmd.event_sem);
ret = __hns_roce_cmd_mbox_wait(hr_dev, in_param, out_param, in_modifier,
- op, timeout);
+ op);
up(&hr_dev->cmd.event_sem);
return ret;
}
int hns_roce_cmd_mbox(struct hns_roce_dev *hr_dev, u64 in_param, u64 out_param,
- unsigned long in_modifier, u16 op, unsigned int timeout)
+ unsigned long in_modifier, u16 op)
{
bool is_busy;
@@ -172,10 +172,10 @@ int hns_roce_cmd_mbox(struct hns_roce_dev *hr_dev, u64 in_param, u64 out_param,
if (hr_dev->cmd.use_events)
return hns_roce_cmd_mbox_wait(hr_dev, in_param, out_param,
- in_modifier, op, timeout);
+ in_modifier, op);
else
return hns_roce_cmd_mbox_poll(hr_dev, in_param, out_param,
- in_modifier, op, timeout);
+ in_modifier, op);
}
int hns_roce_cmd_init(struct hns_roce_dev *hr_dev)
@@ -140,7 +140,7 @@ enum {
};
int hns_roce_cmd_mbox(struct hns_roce_dev *hr_dev, u64 in_param, u64 out_param,
- unsigned long in_modifier, u16 op, unsigned int timeout);
+ unsigned long in_modifier, u16 op);
struct hns_roce_cmd_mailbox *
hns_roce_alloc_cmd_mailbox(struct hns_roce_dev *hr_dev);
@@ -141,7 +141,7 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
/* Send mailbox to hw */
ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, hr_cq->cqn,
- HNS_ROCE_CMD_CREATE_CQC, HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_CREATE_CQC);
hns_roce_free_cmd_mailbox(hr_dev, mailbox);
if (ret) {
ibdev_err(ibdev,
@@ -175,8 +175,7 @@ static void free_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
int ret;
ret = hns_roce_cmd_mbox(hr_dev, 0, 0, hr_cq->cqn,
- HNS_ROCE_CMD_DESTROY_CQC,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_DESTROY_CQC);
if (ret)
dev_err(dev, "DESTROY_CQ failed (%d) for CQN %06lx\n", ret,
hr_cq->cqn);
@@ -854,8 +854,7 @@ struct hns_roce_hw {
int (*post_mbox)(struct hns_roce_dev *hr_dev, u64 in_param,
u64 out_param, u32 in_modifier, u16 op,
u16 token, int event);
- int (*poll_mbox_done)(struct hns_roce_dev *hr_dev,
- unsigned int timeout);
+ int (*poll_mbox_done)(struct hns_roce_dev *hr_dev);
bool (*chk_mbox_avail)(struct hns_roce_dev *hr_dev, bool *is_busy);
int (*set_gid)(struct hns_roce_dev *hr_dev, int gid_index,
const union ib_gid *gid, const struct ib_gid_attr *attr);
@@ -1353,8 +1353,7 @@ static int config_hem_ba_to_hw(struct hns_roce_dev *hr_dev, unsigned long obj,
if (IS_ERR(mbox))
return PTR_ERR(mbox);
- ret = hns_roce_cmd_mbox(hr_dev, base_addr, mbox->dma, obj, op,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ ret = hns_roce_cmd_mbox(hr_dev, base_addr, mbox->dma, obj, op);
hns_roce_free_cmd_mailbox(hr_dev, mbox);
return ret;
}
@@ -2874,12 +2873,13 @@ static int v2_post_mbox(struct hns_roce_dev *hr_dev, u64 in_param,
return ret;
}
-static int v2_poll_mbox_done(struct hns_roce_dev *hr_dev, unsigned int timeout)
+static int v2_poll_mbox_done(struct hns_roce_dev *hr_dev)
{
u8 status = 0;
int ret;
- ret = v2_wait_mbox_complete(hr_dev, timeout, &status);
+ ret = v2_wait_mbox_complete(hr_dev, HNS_ROCE_CMD_TIMEOUT_MSECS,
+ &status);
if (!ret) {
if (status != MB_ST_COMPLETE_SUCC)
return -EBUSY;
@@ -3992,8 +3992,7 @@ static int hns_roce_v2_clear_hem(struct hns_roce_dev *hr_dev,
return PTR_ERR(mailbox);
/* configure the tag and op */
- ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, obj, op,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, obj, op);
hns_roce_free_cmd_mailbox(hr_dev, mailbox);
return ret;
@@ -4018,8 +4017,7 @@ static int hns_roce_v2_qp_modify(struct hns_roce_dev *hr_dev,
memcpy(mailbox->buf + qpc_size, qpc_mask, qpc_size);
ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, hr_qp->qpn,
- HNS_ROCE_CMD_MODIFY_QPC,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_MODIFY_QPC);
hns_roce_free_cmd_mailbox(hr_dev, mailbox);
@@ -5093,8 +5091,7 @@ static int hns_roce_v2_query_qpc(struct hns_roce_dev *hr_dev,
return PTR_ERR(mailbox);
ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, hr_qp->qpn,
- HNS_ROCE_CMD_QUERY_QPC,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_QUERY_QPC);
if (ret)
goto out;
@@ -5461,8 +5458,7 @@ static int hns_roce_v2_modify_srq(struct ib_srq *ibsrq,
hr_reg_clear(srqc_mask, SRQC_LIMIT_WL);
ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, srq->srqn,
- HNS_ROCE_CMD_MODIFY_SRQC,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_MODIFY_SRQC);
hns_roce_free_cmd_mailbox(hr_dev, mailbox);
if (ret) {
ibdev_err(&hr_dev->ib_dev,
@@ -5489,8 +5485,7 @@ static int hns_roce_v2_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr)
srq_context = mailbox->buf;
ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, srq->srqn,
- HNS_ROCE_CMD_QUERY_SRQC,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_QUERY_SRQC);
if (ret) {
ibdev_err(&hr_dev->ib_dev,
"failed to process cmd of querying SRQ, ret = %d.\n",
@@ -5541,8 +5536,7 @@ static int hns_roce_v2_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period)
hr_reg_clear(cqc_mask, CQC_CQ_PERIOD);
ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, hr_cq->cqn,
- HNS_ROCE_CMD_MODIFY_CQC,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_MODIFY_CQC);
hns_roce_free_cmd_mailbox(hr_dev, mailbox);
if (ret)
ibdev_err(&hr_dev->ib_dev,
@@ -5872,12 +5866,10 @@ static void hns_roce_v2_destroy_eqc(struct hns_roce_dev *hr_dev, u32 eqn)
if (eqn < hr_dev->caps.num_comp_vectors)
ret = hns_roce_cmd_mbox(hr_dev, 0, 0, eqn & HNS_ROCE_V2_EQN_M,
- HNS_ROCE_CMD_DESTROY_CEQC,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_DESTROY_CEQC);
else
ret = hns_roce_cmd_mbox(hr_dev, 0, 0, eqn & HNS_ROCE_V2_EQN_M,
- HNS_ROCE_CMD_DESTROY_AEQC,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_DESTROY_AEQC);
if (ret)
dev_err(dev, "[mailbox cmd] destroy eqc(%u) failed.\n", eqn);
}
@@ -6002,8 +5994,7 @@ static int hns_roce_v2_create_eq(struct hns_roce_dev *hr_dev,
if (ret)
goto err_cmd_mbox;
- ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, eq->eqn,
- eq_cmd, HNS_ROCE_CMD_TIMEOUT_MSECS);
+ ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, eq->eqn, eq_cmd);
if (ret) {
dev_err(hr_dev->dev, "[mailbox cmd] create eqc failed.\n");
goto err_cmd_mbox;
@@ -19,8 +19,7 @@ int hns_roce_v2_query_cqc_info(struct hns_roce_dev *hr_dev, u32 cqn,
cq_context = mailbox->buf;
ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, cqn,
- HNS_ROCE_CMD_QUERY_CQC,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_QUERY_CQC);
if (ret) {
dev_err(hr_dev->dev, "QUERY cqc cmd process error\n");
goto err_mailbox;
@@ -52,8 +52,7 @@ static int hns_roce_hw_create_mpt(struct hns_roce_dev *hr_dev,
unsigned long mpt_index)
{
return hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, mpt_index,
- HNS_ROCE_CMD_CREATE_MPT,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_CREATE_MPT);
}
int hns_roce_hw_destroy_mpt(struct hns_roce_dev *hr_dev,
@@ -61,8 +60,7 @@ int hns_roce_hw_destroy_mpt(struct hns_roce_dev *hr_dev,
unsigned long mpt_index)
{
return hns_roce_cmd_mbox(hr_dev, 0, mailbox ? mailbox->dma : 0,
- mpt_index, HNS_ROCE_CMD_DESTROY_MPT,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ mpt_index, HNS_ROCE_CMD_DESTROY_MPT);
}
static int alloc_mr_key(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr)
@@ -304,8 +302,7 @@ struct ib_mr *hns_roce_rereg_user_mr(struct ib_mr *ibmr, int flags, u64 start,
mtpt_idx = key_to_hw_index(mr->key) & (hr_dev->caps.num_mtpts - 1);
ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, mtpt_idx,
- HNS_ROCE_CMD_QUERY_MPT,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_QUERY_MPT);
if (ret)
goto free_cmd_mbox;
@@ -64,8 +64,7 @@ static int hns_roce_hw_create_srq(struct hns_roce_dev *dev,
unsigned long srq_num)
{
return hns_roce_cmd_mbox(dev, mailbox->dma, 0, srq_num,
- HNS_ROCE_CMD_CREATE_SRQ,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_CREATE_SRQ);
}
static int hns_roce_hw_destroy_srq(struct hns_roce_dev *dev,
@@ -73,8 +72,7 @@ static int hns_roce_hw_destroy_srq(struct hns_roce_dev *dev,
unsigned long srq_num)
{
return hns_roce_cmd_mbox(dev, 0, mailbox ? mailbox->dma : 0, srq_num,
- HNS_ROCE_CMD_DESTROY_SRQ,
- HNS_ROCE_CMD_TIMEOUT_MSECS);
+ HNS_ROCE_CMD_DESTROY_SRQ);
}
static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)