mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-06-04 23:44:36 -04:00
octeon_ep_vf: Relocate counter updates before NAPI
Relocate IQ/OQ IN/OUT_CNTS updates to occur before NAPI completion.
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.
Fixes: 1cd3b40797 ("octeon_ep_vf: 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-4-vimleshk@marvell.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
43b3160cb6
commit
2ae7d20fb2
@@ -286,12 +286,13 @@ static void octep_vf_clean_irqs(struct octep_vf_device *oct)
|
||||
}
|
||||
|
||||
/**
|
||||
* octep_vf_enable_ioq_irq() - Enable MSI-x interrupt of a Tx/Rx queue.
|
||||
* octep_vf_update_pkt() - Update IQ/OQ IN/OUT_CNT registers.
|
||||
*
|
||||
* @iq: Octeon Tx queue data structure.
|
||||
* @oq: Octeon Rx queue data structure.
|
||||
*/
|
||||
static void octep_vf_enable_ioq_irq(struct octep_vf_iq *iq, struct octep_vf_oq *oq)
|
||||
|
||||
static void octep_vf_update_pkt(struct octep_vf_iq *iq, struct octep_vf_oq *oq)
|
||||
{
|
||||
u32 pkts_pend = oq->pkts_pending;
|
||||
|
||||
@@ -308,6 +309,17 @@ static void octep_vf_enable_ioq_irq(struct octep_vf_iq *iq, struct octep_vf_oq *
|
||||
|
||||
/* Flush the previous wrties before writing to RESEND bit */
|
||||
smp_wmb();
|
||||
}
|
||||
|
||||
/**
|
||||
* octep_vf_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_vf_enable_ioq_irq(struct octep_vf_iq *iq,
|
||||
struct octep_vf_oq *oq)
|
||||
{
|
||||
writeq(1UL << OCTEP_VF_OQ_INTR_RESEND_BIT, oq->pkts_sent_reg);
|
||||
writeq(1UL << OCTEP_VF_IQ_INTR_RESEND_BIT, iq->inst_cnt_reg);
|
||||
}
|
||||
@@ -333,6 +345,7 @@ static int octep_vf_napi_poll(struct napi_struct *napi, int budget)
|
||||
if (tx_pending || rx_done >= budget)
|
||||
return budget;
|
||||
|
||||
octep_vf_update_pkt(ioq_vector->iq, ioq_vector->oq);
|
||||
if (likely(napi_complete_done(napi, rx_done)))
|
||||
octep_vf_enable_ioq_irq(ioq_vector->iq, ioq_vector->oq);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user