[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250826155124.GA2134666@nvidia.com>
Date: Tue, 26 Aug 2025 12:51:24 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Abhijit Gangurde <abhijit.gangurde@....com>
Cc: brett.creeley@....com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, corbet@....net, leon@...nel.org,
andrew+netdev@...n.ch, sln@...main.com, allen.hubbe@....com,
nikhil.agarwal@....com, linux-rdma@...r.kernel.org,
netdev@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, Andrew Boyer <andrew.boyer@....com>
Subject: Re: [PATCH v5 11/14] RDMA/ionic: Register device ops for datapath
On Thu, Aug 14, 2025 at 11:08:57AM +0530, Abhijit Gangurde wrote:
> +static int ionic_poll_vcq_cq(struct ionic_ibdev *dev,
> + struct ionic_cq *cq,
> + int nwc, struct ib_wc *wc)
> +{
> + struct ionic_qp *qp, *qp_next;
> + struct ionic_v1_cqe *cqe;
> + int rc = 0, npolled = 0;
> + unsigned long irqflags;
> + u32 qtf, qid;
> + bool peek;
> + u8 type;
> +
> + if (nwc < 1)
> + return 0;
> +
> + spin_lock_irqsave(&cq->lock, irqflags);
> +
> + /* poll already indicated work completions for send queue */
> + list_for_each_entry_safe(qp, qp_next, &cq->poll_sq, cq_poll_sq) {
> + if (npolled == nwc)
> + goto out;
> +
> + spin_lock(&qp->sq_lock);
> + rc = ionic_poll_send_many(dev, cq, qp, wc + npolled,
> + nwc - npolled);
> + spin_unlock(&qp->sq_lock);
> +
> + if (rc > 0)
> + npolled += rc;
> +
> + if (npolled < nwc)
> + list_del_init(&qp->cq_poll_sq);
> + }
> +
> + /* poll for more work completions */
> + while (likely(ionic_next_cqe(dev, cq, &cqe))) {
> + if (npolled == nwc)
> + goto out;
> +
> + qtf = ionic_v1_cqe_qtf(cqe);
> + qid = ionic_v1_cqe_qtf_qid(qtf);
> + type = ionic_v1_cqe_qtf_type(qtf);
> +
> + qp = xa_load(&dev->qp_tbl, qid);
Why is this safe? Should have a comment explaining it or add the
missing locking.
Jason
Powered by blists - more mailing lists