Re: [PATCH v3 08/15] IB/pvrdma: Add support for Completion Queues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 07, 2016 at 05:25:30PM +0000, Adit Ranadive wrote:
> > > +
> > > +static int pvrdma_poll_one(struct pvrdma_cq *cq, struct pvrdma_qp
> > **cur_qp,
> > > +			   struct ib_wc *wc)
> > > +{
> > > +	struct pvrdma_dev *dev = to_vdev(cq->ibcq.device);
> > > +	int has_data;
> > > +	unsigned int head;
> > > +	bool tried = false;
> > > +	struct pvrdma_cqe *cqe;
> > > +
> > > +retry:
> > > +	has_data = pvrdma_idx_ring_has_data(&cq->ring_state->rx,
> > > +					    cq->ibcq.cqe, &head);
> > > +	if (has_data == 0) {
> > > +		u32 val;
> > > +
> > > +		if (tried)
> > > +			return -EAGAIN;
> > > +
> > > +		/* Pass down POLL to give physical HCA a chance to poll. */
> > > +		val = cq->cq_handle | PVRDMA_UAR_CQ_POLL;
> > > +		writel(cpu_to_le32(val),
> > > +		       dev->driver_uar.map + PVRDMA_UAR_CQ_OFFSET);
> > > +
> > > +		tried = true;
> > > +		goto retry;
> > > +	} else if (has_data == PVRDMA_INVALID_IDX) {
> > > +		/* Ring state could be corrupted. Treat as unrecoverable. */
> > > +		return -EINVAL;
> > 
> > Please try your best not to return anything but 0 or -EAGAIN from this
> > function.
> > Returning -EINVAL will cause caller (pvrdma_poll_cq) to drop all successive
> > CQE in tn batch.
> 
> This reason I want to return -EINVAL here is that its possible that the ring state is
> corrupted so any successive calls to poll_cq will likely not give any valid data.
> If that means successive CQEs are dropped then that should be okay since we have
> no idea now which CQEs were consumed.

In this case you should handle the problematic CQ in driver, ULPs are not
built to handle it.

We had this discussion before, see here:
http://marc.info/?l=linux-rdma&m=146851770732050&w=2
Or here:
https://www.spinics.net/lists/linux-rdma/msg38250.html

And eventually mlx4 driver was modified to return 0 or EAGAIN:
http://marc.info/?l=linux-rdma&m=147237113803425&w=2

> 
> Thanks,
> Adit
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux