RE: [PATCH v2 net] net: mana: Fix doorbell out of order violation and avoid unnecessary doorbell rings
From: Long Li
Date: Thu Aug 08 2024 - 11:33:59 EST
> > + if (w < cq->budget) {
> > + mana_gd_ring_cq(gdma_queue, SET_ARM_BIT);
> > + cq->work_done_since_doorbell = 0;
> > + napi_complete_done(&cq->napi, w);
> > + } else if (cq->work_done_since_doorbell >
> > + cq->gdma_cq->queue_size / COMP_ENTRY_SIZE * 4) {
>
> should we define a macro for 4? may be 'CQ_WRAPAROUND_LIMIT'
I prefer to leaving the code as is. This is the only place it's used, and there is a comment explaining why this value is chosen.
>
> > + /* MANA hardware requires at least one doorbell ring every 8
> > + * wraparounds of CQ even if there is no need to arm the CQ.
> > + * This driver rings the doorbell as soon as we have exceeded
> > + * 4 wraparounds.
> > + */
> > + mana_gd_ring_cq(gdma_queue, 0);
> > + cq->work_done_since_doorbell = 0;
> > 2.17.1