linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] RDMA/bnxt_re: Change wr posting logic to accommodate variable wqes
@ 2020-07-24 10:28 dan.carpenter
  0 siblings, 0 replies; only message in thread
From: dan.carpenter @ 2020-07-24 10:28 UTC (permalink / raw)
  To: devesh.sharma; +Cc: linux-rdma

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-24 10:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24 10:28 [bug report] RDMA/bnxt_re: Change wr posting logic to accommodate variable wqes dan.carpenter

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).