mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
octeon_ep: Relocate counter updates before NAPI
Relocate IQ/OQ IN/OUT_CNTS updates to occur before NAPI completion,
and replace napi_complete with napi_complete_done.
Moving the IQ/OQ counter updates before napi_complete_done ensures
1. Counter registers are updated before re-enabling interrupts.
2. Prevents a race where new packets arrive but counters aren't properly
synchronized.
napi_complete_done (vs napi_complete) allows for better
interrupt coalescing.
Fixes: 37d79d0596 ("octeon_ep: add Tx/Rx processing and interrupt support")
Signed-off-by: Sathesh Edara <sedara@marvell.com>
Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
Signed-off-by: Vimlesh Kumar <vimleshk@marvell.com>
Link: https://patch.msgid.link/20260227091402.1773833-2-vimleshk@marvell.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
210fd8f408
commit
18c04a808c
1 changed files with 15 additions and 4 deletions
|
|
@ -554,12 +554,12 @@ static void octep_clean_irqs(struct octep_device *oct)
|
|||
}
|
||||
|
||||
/**
|
||||
* octep_enable_ioq_irq() - Enable MSI-x interrupt of a Tx/Rx queue.
|
||||
* octep_update_pkt() - Update IQ/OQ IN/OUT_CNT registers.
|
||||
*
|
||||
* @iq: Octeon Tx queue data structure.
|
||||
* @oq: Octeon Rx queue data structure.
|
||||
*/
|
||||
static void octep_enable_ioq_irq(struct octep_iq *iq, struct octep_oq *oq)
|
||||
static void octep_update_pkt(struct octep_iq *iq, struct octep_oq *oq)
|
||||
{
|
||||
u32 pkts_pend = oq->pkts_pending;
|
||||
|
||||
|
|
@ -575,7 +575,17 @@ static void octep_enable_ioq_irq(struct octep_iq *iq, struct octep_oq *oq)
|
|||
}
|
||||
|
||||
/* Flush the previous wrties before writing to RESEND bit */
|
||||
wmb();
|
||||
smp_wmb();
|
||||
}
|
||||
|
||||
/**
|
||||
* octep_enable_ioq_irq() - Enable MSI-x interrupt of a Tx/Rx queue.
|
||||
*
|
||||
* @iq: Octeon Tx queue data structure.
|
||||
* @oq: Octeon Rx queue data structure.
|
||||
*/
|
||||
static void octep_enable_ioq_irq(struct octep_iq *iq, struct octep_oq *oq)
|
||||
{
|
||||
writeq(1UL << OCTEP_OQ_INTR_RESEND_BIT, oq->pkts_sent_reg);
|
||||
writeq(1UL << OCTEP_IQ_INTR_RESEND_BIT, iq->inst_cnt_reg);
|
||||
}
|
||||
|
|
@ -601,7 +611,8 @@ static int octep_napi_poll(struct napi_struct *napi, int budget)
|
|||
if (tx_pending || rx_done >= budget)
|
||||
return budget;
|
||||
|
||||
napi_complete(napi);
|
||||
octep_update_pkt(ioq_vector->iq, ioq_vector->oq);
|
||||
napi_complete_done(napi, rx_done);
|
||||
octep_enable_ioq_irq(ioq_vector->iq, ioq_vector->oq);
|
||||
return rx_done;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue