RE: [PATCH rdma-next 4/6] RDMA/mana_ib: introduce a helper to remove cq callbacks

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

 



> > +void mana_ib_remove_cq_cb(struct mana_ib_dev *mdev, struct
> > mana_ib_cq
> > +*cq) {
> > +	struct gdma_context *gc = mdev_to_gc(mdev);
> > +
> > +	if (cq->queue.id >= gc->max_num_cqs)
> > +		return;
> > +
> > +	kfree(gc->cq_table[cq->queue.id]);
> > +	gc->cq_table[cq->queue.id] = NULL;
> 
> Why the check for (cq->queue.id != INVALID_QUEUE_ID) is removed?

As max_num_cqs is always less than INVALID_QUEUE_ID, it is included in the "if".
I can add " || cq->queue.id == INVALID_QUEUE_ID " to the condition if you want.

> > @@ -173,13 +171,6 @@ static int mana_ib_create_qp_rss(struct ib_qp
> > *ibqp, struct ib_pd *pd,
> >  		goto fail;
> >  	}
> >
> > -	gdma_cq_allocated = kcalloc(ind_tbl_size,
> > sizeof(*gdma_cq_allocated),
> > -				    GFP_KERNEL);
> > -	if (!gdma_cq_allocated) {
> > -		ret = -ENOMEM;
> > -		goto fail;
> > -	}
> > -
> 
> Why the allocation for CQs is removed? This is not related to this patch.

It becomes the dead code if I add the helper. You allocated gdma_cq_allocated to
temporary store gdma_queue to be able to deallocate them. The introduced helper
frees pointers to gdma_queue from kfree(gc->cq_table[cq->queue.id]), making
gdma_cq_allocated unused.





[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