On Thu, Apr 01, 2021 at 03:32:19PM +0800, Weihang Li wrote: > From: Lang Cheng <chenglang@xxxxxxxxxx> > > Fix error of cmd's context number calculation algorithm to enable all of > 32 cmd entries and support 32 concurrent accesses. > > Signed-off-by: Lang Cheng <chenglang@xxxxxxxxxx> > Signed-off-by: Weihang Li <liweihang@xxxxxxxxxx> > --- > drivers/infiniband/hw/hns/hns_roce_cmd.c | 62 ++++++++++++----------------- > drivers/infiniband/hw/hns/hns_roce_device.h | 6 +-- > 2 files changed, 27 insertions(+), 41 deletions(-) <...> > - WARN_ON(cmd->free_head < 0); > - context = &cmd->context[cmd->free_head]; > - context->token += cmd->token_mask + 1; > - cmd->free_head = context->next; > + > + do { > + context = &cmd->context[cmd->free_head]; > + cmd->free_head = context->next; > + } while (context->busy); > + > + context->busy = 1; This "busy" flag after do-while together with release in __hns_roce_cmd_mbox_wait() is interesting thing. Are you sure that it won't loop forever here? Thanks