linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <dan.carpenter@oracle.com>
To: devesh.sharma@broadcom.com
Cc: linux-rdma@vger.kernel.org
Subject: [bug report] RDMA/bnxt_re: Change wr posting logic to accommodate variable wqes
Date: Fri, 24 Jul 2020 13:28:57 +0300	[thread overview]
Message-ID: <20200724102857.GA319526@mwanda> (raw)

Hello Devesh Sharma,

The patch 2bb3c32c5c5f: "RDMA/bnxt_re: Change wr posting logic to
accommodate variable wqes" from Jul 15, 2020, leads to the following
static checker warning:

	drivers/infiniband/hw/bnxt_re/qplib_fp.c:1989 bnxt_qplib_post_recv()
	warn: struct type mismatch 'rq_wqe_hdr vs sq_sge'

drivers/infiniband/hw/bnxt_re/qplib_fp.c
  1945  int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp,
  1946                           struct bnxt_qplib_swqe *wqe)
  1947  {
  1948          struct bnxt_qplib_nq_work *nq_work = NULL;
  1949          struct bnxt_qplib_q *rq = &qp->rq;
  1950          struct rq_wqe_hdr *base_hdr;
                       ^^^^^^^^^^^^^^^^^^^^
  1951          struct rq_ext_hdr *ext_hdr;
                       ^^^^^^^^^^^^^^^^^^^
  1952          struct bnxt_qplib_hwq *hwq;
  1953          struct bnxt_qplib_swq *swq;
  1954          bool sch_handler = false;
  1955          u16 wqe_sz, idx;
  1956          u32 wqe_idx;
  1957          int rc = 0;
  1958  
  1959          hwq = &rq->hwq;
  1960          if (qp->state == CMDQ_MODIFY_QP_NEW_STATE_RESET) {
  1961                  dev_err(&hwq->pdev->dev,
  1962                          "QPLIB: FP: QP (0x%x) is in the 0x%x state",
  1963                          qp->id, qp->state);
  1964                  rc = -EINVAL;
  1965                  goto done;
  1966          }
  1967  
  1968          if (bnxt_qplib_queue_full(rq, rq->dbinfo.max_slot)) {
  1969                  dev_err(&hwq->pdev->dev,
  1970                          "FP: QP (0x%x) RQ is full!\n", qp->id);
  1971                  rc = -EINVAL;
  1972                  goto done;
  1973          }
  1974  
  1975          swq = bnxt_qplib_get_swqe(rq, &wqe_idx);
  1976          swq->wr_id = wqe->wr_id;
  1977          swq->slots = rq->dbinfo.max_slot;
  1978  
  1979          if (qp->state == CMDQ_MODIFY_QP_NEW_STATE_ERR) {
  1980                  sch_handler = true;
  1981                  dev_dbg(&hwq->pdev->dev,
  1982                          "%s: Error QP. Scheduling for poll_cq\n", __func__);
  1983                  goto queue_err;
  1984          }
  1985  
  1986          idx = 0;
  1987          base_hdr = bnxt_qplib_get_prod_qe(hwq, idx++);
  1988          ext_hdr = bnxt_qplib_get_prod_qe(hwq, idx++);
  1989          memset(base_hdr, 0, sizeof(struct sq_sge));
                                           ^^^^^^^^^^^^^
  1990          memset(ext_hdr, 0, sizeof(struct sq_sge));
                                          ^^^^^^^^^^^^^
The types are different.  Was this intentional?

  1991          wqe_sz = (sizeof(struct rq_wqe_hdr) +
  1992          wqe->num_sge * sizeof(struct sq_sge)) >> 4;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Also this line could be indented another tab.

  1993          bnxt_qplib_put_sges(hwq, wqe->sg_list, wqe->num_sge, &idx);
  1994          if (!wqe->num_sge) {
  1995                  struct sq_sge *sge;
  1996  
  1997                  sge = bnxt_qplib_get_prod_qe(hwq, idx++);
  1998                  sge->size = 0;
  1999                  wqe_sz++;
  2000          }
  2001          base_hdr->wqe_type = wqe->type;

regards,
dan carpenter

                 reply	other threads:[~2020-07-24 10:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200724102857.GA319526@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devesh.sharma@broadcom.com \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).